Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(609)

Unified Diff: gdb/regcache.c

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/regcache.h ('k') | gdb/regformats/aarch64.dat » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/regcache.c
diff --git a/gdb/regcache.c b/gdb/regcache.c
index c7162802379bdd6ca4a8d25d25027b072aa643b5..e847455f15c58c0e9729bf27e94ad406d13265e9 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -1,7 +1,6 @@
/* Cache and manage the values of registers for GDB, the GNU debugger.
- Copyright (C) 1986-1987, 1989, 1991, 1994-1996, 1998, 2000-2002,
- 2004, 2007-2012 Free Software Foundation, Inc.
+ Copyright (C) 1986-2013 Free Software Foundation, Inc.
This file is part of GDB.
@@ -26,11 +25,12 @@
#include "regcache.h"
#include "reggroups.h"
#include "gdb_assert.h"
-#include "gdb_string.h"
+#include <string.h>
#include "gdbcmd.h" /* For maintenanceprintlist. */
#include "observer.h"
#include "exceptions.h"
#include "remote.h"
+#include "valprint.h"
/*
* DATA STRUCTURE
@@ -226,14 +226,14 @@ regcache_xmalloc_1 (struct gdbarch *gdbarch, struct address_space *aspace,
regcache->registers
= XCALLOC (descr->sizeof_cooked_registers, gdb_byte);
regcache->register_status
- = XCALLOC (descr->sizeof_cooked_register_status, gdb_byte);
+ = XCALLOC (descr->sizeof_cooked_register_status, signed char);
}
else
{
regcache->registers
= XCALLOC (descr->sizeof_raw_registers, gdb_byte);
regcache->register_status
- = XCALLOC (descr->sizeof_raw_register_status, gdb_byte);
+ = XCALLOC (descr->sizeof_raw_register_status, signed char);
}
regcache->aspace = aspace;
regcache->ptid = minus_one_ptid;
@@ -411,7 +411,7 @@ regcache_dup (struct regcache *src)
return newbuf;
}
-int
+enum register_status
regcache_register_status (const struct regcache *regcache, int regnum)
{
gdb_assert (regcache != NULL);
@@ -707,8 +707,6 @@ regcache_cooked_read (struct regcache *regcache, int regnum, gdb_byte *buf)
{
/* Read-only register cache, perhaps the cooked value was
cached? */
- struct gdbarch *gdbarch = regcache->descr->gdbarch;
-
if (regcache->register_status[regnum] == REG_VALID)
memcpy (buf, register_buffer (regcache, regnum),
regcache->descr->sizeof_register[regnum]);
@@ -1093,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 unsigned char *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,
@@ -1133,7 +1110,7 @@ regcache_dump (struct regcache *regcache, struct ui_file *file,
int footnote_register_offset = 0;
int footnote_register_type_name_null = 0;
long register_offset = 0;
- unsigned char buf[MAX_REGISTER_SIZE];
+ gdb_byte buf[MAX_REGISTER_SIZE];
#if 0
fprintf_unfiltered (file, "nr_raw_registers %d\n",
@@ -1261,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));
}
}
@@ -1283,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));
}
}
« no previous file with comments | « gdb/regcache.h ('k') | gdb/regformats/aarch64.dat » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698