This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] Fix spu-linux-nat.c coding style issues


Hello,

I just noticed the ARI shows a couple of coding style violations in
spu-linux-nat.c.  Oops.  Fixed by this patch.

Tested on spu-elf.  Committed to mainline.

Bye,
Ulrich


ChangeLog:

	* spu-linux-nat.c: Include "gdb_stdint.h".
	(fetch_ppc_register): Use uint64_t instead of unsigned long long.
	(fetch_ppc_memory_1, store_ppc_memory_1): Likewise.
	(fetch_ppc_memory, store_ppc_memory): Fix coding style.
	(spu_symbol_file_add_from_memory): Use strtoulst instead of sscanf.
	(spu_child_wait): Mark up string for translation.


diff -urNp gdb-orig/gdb/Makefile.in gdb-head/gdb/Makefile.in
--- gdb-orig/gdb/Makefile.in	2007-05-08 14:37:44.000000000 +0200
+++ gdb-head/gdb/Makefile.in	2007-05-09 01:03:45.521645976 +0200
@@ -2675,7 +2675,7 @@ sparc-tdep.o: sparc-tdep.c $(defs_h) $(a
 	$(value_h) $(gdb_assert_h) $(gdb_string_h) $(sparc_tdep_h)
 spu-linux-nat.o: spu-linux-nat.c $(defs_h) $(gdbcore_h) $(gdb_string_h) \
 	$(target_h) $(inferior_h) $(inf_ptrace_h) $(regcache_h) $(symfile_h) \
-	$(gdb_wait_h) $(spu_tdep_h)
+	$(gdb_wait_h) $(gdb_stdint_h) $(spu_tdep_h)
 spu-tdep.o: spu-tdep.c $(defs_h) $(arch_utils_h) $(gdbtypes_h) $(gdbcmd_h) \
 	$(gdbcore_h) $(gdb_string_h) $(gdb_assert_h) $(frame_h) \
 	$(frame_unwind_h) $(frame_base_h) $(trad_frame_h) $(symtab_h) \
diff -urNp gdb-orig/gdb/spu-linux-nat.c gdb-head/gdb/spu-linux-nat.c
--- gdb-orig/gdb/spu-linux-nat.c	2007-05-09 00:47:48.207891000 +0200
+++ gdb-head/gdb/spu-linux-nat.c	2007-05-09 01:01:49.983699187 +0200
@@ -29,6 +29,7 @@
 #include "regcache.h"
 #include "symfile.h"
 #include "gdb_wait.h"
+#include "gdb_stdint.h"
 
 #include <sys/ptrace.h>
 #include <asm/ptrace.h>
@@ -67,7 +68,7 @@ fetch_ppc_register (int regno)
       ptrace (PPC_PTRACE_PEEKUSR_3264, tid,
 	      (PTRACE_TYPE_ARG3) (regno * 8 + 4), buf + 4);
     if (errno == 0)
-      return (ULONGEST) *(unsigned long long *)buf;
+      return (ULONGEST) *(uint64_t *)buf;
   }
 #endif
 
@@ -93,7 +94,7 @@ fetch_ppc_memory_1 (int tid, ULONGEST me
 #ifndef __powerpc64__
   if (memaddr >> 32)
     {
-      unsigned long long addr_8 = (unsigned long long) memaddr;
+      uint64_t addr_8 = (uint64_t) memaddr;
       ptrace (PPC_PTRACE_PEEKTEXT_3264, tid, (PTRACE_TYPE_ARG3) &addr_8, word);
     }
   else
@@ -112,7 +113,7 @@ store_ppc_memory_1 (int tid, ULONGEST me
 #ifndef __powerpc64__
   if (memaddr >> 32)
     {
-      unsigned long long addr_8 = (unsigned long long) memaddr;
+      uint64_t addr_8 = (uint64_t) memaddr;
       ptrace (PPC_PTRACE_POKEDATA_3264, tid, (PTRACE_TYPE_ARG3) &addr_8, word);
     }
   else
@@ -139,8 +140,11 @@ fetch_ppc_memory (ULONGEST memaddr, gdb_
 
   buffer = (PTRACE_TYPE_RET *) alloca (count * sizeof (PTRACE_TYPE_RET));
   for (i = 0; i < count; i++, addr += sizeof (PTRACE_TYPE_RET))
-    if ((ret = fetch_ppc_memory_1 (tid, addr, &buffer[i])) != 0)
-      return ret;
+    {
+      ret = fetch_ppc_memory_1 (tid, addr, &buffer[i]);
+      if (ret)
+	return ret;
+    }
 
   memcpy (myaddr,
 	  (char *) buffer + (memaddr & (sizeof (PTRACE_TYPE_RET) - 1)),
@@ -167,21 +171,30 @@ store_ppc_memory (ULONGEST memaddr, cons
   buffer = (PTRACE_TYPE_RET *) alloca (count * sizeof (PTRACE_TYPE_RET));
 
   if (addr != memaddr || len < (int) sizeof (PTRACE_TYPE_RET))
-    if ((ret = fetch_ppc_memory_1 (tid, addr, &buffer[0])) != 0)
-      return ret;
+    {
+      ret = fetch_ppc_memory_1 (tid, addr, &buffer[0]);
+      if (ret)
+	return ret;
+    }
 
   if (count > 1)
-    if ((ret = fetch_ppc_memory_1 (tid, addr + (count - 1)
+    {
+      ret = fetch_ppc_memory_1 (tid, addr + (count - 1)
 					       * sizeof (PTRACE_TYPE_RET),
-				   &buffer[count - 1])) != 0)
-      return ret;
+				&buffer[count - 1]);
+      if (ret)
+	return ret;
+    }
 
   memcpy ((char *) buffer + (memaddr & (sizeof (PTRACE_TYPE_RET) - 1)),
           myaddr, len);
 
   for (i = 0; i < count; i++, addr += sizeof (PTRACE_TYPE_RET))
-    if ((ret = store_ppc_memory_1 (tid, addr, buffer[i])) != 0)
-      return ret;
+    {
+      ret = store_ppc_memory_1 (tid, addr, buffer[i]);
+      if (ret)
+	return ret;
+    }
 
   return 0;
 }
@@ -337,7 +350,8 @@ spu_symbol_file_add_from_memory (int inf
   if (len <= 0 || len >= sizeof id)
     return;
   id[len] = 0;
-  if (sscanf (id, "0x%llx", &addr) != 1)
+  addr = strtoulst (id, NULL, 16);
+  if (!addr)
     return;
 
   /* Open BFD representing SPE executable and read its symbols.  */
@@ -426,7 +440,7 @@ spu_child_wait (ptid_t ptid, struct targ
 
   if (pid == -1)
     {
-      warning ("Child process unexpectedly missing: %s",
+      warning (_("Child process unexpectedly missing: %s"),
 	       safe_strerror (save_errno));
 
       /* Claim it exited with unknown signal.  */
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]