X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fregcache.c;h=8b588c60050b66d68605545491248ed588f16b4c;hb=9f1b45b0da430a7a7abf9e54acbe6f2ef9d3a763;hp=ca00f90d184a154ae87dea70ea37e04b2178bb25;hpb=e362b51003ad60f4984bf7bed3bc02259db10546;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/regcache.c b/gdb/regcache.c index ca00f90d18..8b588c6005 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -1,6 +1,6 @@ /* Cache and manage the values of registers for GDB, the GNU debugger. - Copyright (C) 1986-2013 Free Software Foundation, Inc. + Copyright (C) 1986-2014 Free Software Foundation, Inc. This file is part of GDB. @@ -25,11 +25,11 @@ #include "regcache.h" #include "reggroups.h" #include "gdb_assert.h" -#include "gdb_string.h" -#include "gdbcmd.h" /* For maintenanceprintlist. */ +#include #include "observer.h" #include "exceptions.h" #include "remote.h" +#include "valprint.h" /* * DATA STRUCTURE @@ -217,22 +217,22 @@ regcache_xmalloc_1 (struct gdbarch *gdbarch, struct address_space *aspace, gdb_assert (gdbarch != NULL); descr = regcache_descr (gdbarch); - regcache = XMALLOC (struct regcache); + regcache = XNEW (struct regcache); regcache->descr = descr; regcache->readonly_p = readonly_p; if (readonly_p) { regcache->registers - = XCALLOC (descr->sizeof_cooked_registers, gdb_byte); + = XCNEWVEC (gdb_byte, descr->sizeof_cooked_registers); regcache->register_status - = XCALLOC (descr->sizeof_cooked_register_status, gdb_byte); + = XCNEWVEC (signed char, descr->sizeof_cooked_register_status); } else { regcache->registers - = XCALLOC (descr->sizeof_raw_registers, gdb_byte); + = XCNEWVEC (gdb_byte, descr->sizeof_raw_registers); regcache->register_status - = XCALLOC (descr->sizeof_raw_register_status, gdb_byte); + = XCNEWVEC (signed char, descr->sizeof_raw_register_status); } regcache->aspace = aspace; regcache->ptid = minus_one_ptid; @@ -1090,27 +1090,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 +1237,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 +1258,9 @@ regcache_dump (struct regcache *regcache, struct ui_file *file, else if (status == REG_UNAVAILABLE) fprintf_unfiltered (file, ""); 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)); } }