In regcache use print_hex_chars.
authorAndrew Burgess <aburgess@broadcom.com>
Mon, 23 Sep 2013 16:48:43 +0000 (16:48 +0000)
committerAndrew Burgess <aburgess@broadcom.com>
Mon, 23 Sep 2013 16:48:43 +0000 (16:48 +0000)
  https://sourceware.org/ml/gdb-patches/2013-09/msg00815.html

gdb/ChangeLog

        * regcache.c: Add include of valprint.h.
        (dump_endian_bytes): Delete.
        (regcache_dump): Use print_hex_chars not dump_endian_bytes.

gdb/ChangeLog
gdb/regcache.c

index b016136ad2d2b9dc37079141574e5c5dc4abd6a8..c0ec10fbc1cbe64e35188389fd6934fd1f0712f2 100644 (file)
@@ -1,3 +1,9 @@
+2013-09-23  Andrew Burgess  <aburgess@broadcom.com>
+
+       * regcache.c: Add include of valprint.h.
+       (dump_endian_bytes): Delete.
+       (regcache_dump): Use print_hex_chars not dump_endian_bytes.
+
 2013-09-23  Andrew Burgess  <aburgess@broadcom.com>
 
        * sh64-tdep.c (sh64_do_fp_register): Use print_hex_chars.
index 57d29e4b6434cb0a556f8f2a3b71d2ae373e6bba..7ec75c80944b49ba2748f32327f8c68e89cf8dea 100644 (file)
@@ -30,6 +30,7 @@
 #include "observer.h"
 #include "exceptions.h"
 #include "remote.h"
+#include "valprint.h"
 
 /*
  * DATA STRUCTURE
@@ -1090,27 +1091,6 @@ reg_flush_command (char *command, int from_tty)
     printf_filtered (_("Register cache flushed.\n"));
 }
 
-static void
-dump_endian_bytes (struct ui_file *file, enum bfd_endian endian,
-                  const gdb_byte *buf, long len)
-{
-  int i;
-
-  switch (endian)
-    {
-    case BFD_ENDIAN_BIG:
-      for (i = 0; i < len; i++)
-       fprintf_unfiltered (file, "%02x", buf[i]);
-      break;
-    case BFD_ENDIAN_LITTLE:
-      for (i = len - 1; i >= 0; i--)
-       fprintf_unfiltered (file, "%02x", buf[i]);
-      break;
-    default:
-      internal_error (__FILE__, __LINE__, _("Bad switch"));
-    }
-}
-
 enum regcache_dump_what
 {
   regcache_dump_none, regcache_dump_raw,
@@ -1258,10 +1238,9 @@ regcache_dump (struct regcache *regcache, struct ui_file *file,
          else
            {
              regcache_raw_read (regcache, regnum, buf);
-             fprintf_unfiltered (file, "0x");
-             dump_endian_bytes (file,
-                                gdbarch_byte_order (gdbarch), buf,
-                                regcache->descr->sizeof_register[regnum]);
+             print_hex_chars (file, buf,
+                              regcache->descr->sizeof_register[regnum],
+                              gdbarch_byte_order (gdbarch));
            }
        }
 
@@ -1280,12 +1259,9 @@ regcache_dump (struct regcache *regcache, struct ui_file *file,
              else if (status == REG_UNAVAILABLE)
                fprintf_unfiltered (file, "<unavailable>");
              else
-               {
-                 fprintf_unfiltered (file, "0x");
-                 dump_endian_bytes (file,
-                                    gdbarch_byte_order (gdbarch), buf,
-                                    regcache->descr->sizeof_register[regnum]);
-               }
+               print_hex_chars (file, buf,
+                                regcache->descr->sizeof_register[regnum],
+                                gdbarch_byte_order (gdbarch));
            }
        }
 
This page took 0.045261 seconds and 4 git commands to generate.