aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2007-04-28 21:52:38 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2007-04-28 21:52:38 +0000
commit6ed7ea50e87eddecb4c6774de0c0fc0f9c503552 (patch)
tree71101c046ab227bc0b35313084317109e6cbdbe8 /gdb
parentefc72ef5c00fc2d069b8d5cca7906c8004eca819 (diff)
downloadgdb-6ed7ea50e87eddecb4c6774de0c0fc0f9c503552.zip
gdb-6ed7ea50e87eddecb4c6774de0c0fc0f9c503552.tar.gz
gdb-6ed7ea50e87eddecb4c6774de0c0fc0f9c503552.tar.bz2
* gdbarch.sh: Remove deprecated_register_byte.
* gdbarch.c, gdbarch.h: Regenerate. * arch-utils.h (generic_register_size, generic_register_byte): Remove. * arch-utils.c (generic_register_size, generic_register_byte): Remove. * regcache.h (regcache_valid_p): Make REGCACHE parameter const. * regcache.c (regcache_valid_p): Allow to query cooked registers in read-only register caches. Make REGCACHE parameter const. (regcache_dump): Do not check DEPRECATED_REGISTER_BYTE. * mi/mi-main.c (old_regs): Remove. (mi_setup_architecture_data, _initialize_mi_main): Remove. (register_changed_p): Reimplement to compare two register caches. (mi_cmd_data_list_changed_registers): Update caller. * mi/mi-main.h (mi_setup_architecture_data): Remove. * mi/mi-interp.c (mi_interpreter_init): Do not call mi_setup_architecture_data.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog20
-rw-r--r--gdb/arch-utils.c26
-rw-r--r--gdb/arch-utils.h8
-rw-r--r--gdb/gdbarch.c47
-rw-r--r--gdb/gdbarch.h33
-rwxr-xr-xgdb/gdbarch.sh8
-rw-r--r--gdb/mi/mi-interp.c4
-rw-r--r--gdb/mi/mi-main.c62
-rw-r--r--gdb/mi/mi-main.h2
-rw-r--r--gdb/regcache.c10
-rw-r--r--gdb/regcache.h2
11 files changed, 60 insertions, 162 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5948a5b..555171e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,25 @@
2007-04-28 Ulrich Weigand <uweigand@de.ibm.com>
+ * gdbarch.sh: Remove deprecated_register_byte.
+ * gdbarch.c, gdbarch.h: Regenerate.
+ * arch-utils.h (generic_register_size, generic_register_byte): Remove.
+ * arch-utils.c (generic_register_size, generic_register_byte): Remove.
+
+ * regcache.h (regcache_valid_p): Make REGCACHE parameter const.
+ * regcache.c (regcache_valid_p): Allow to query cooked registers in
+ read-only register caches. Make REGCACHE parameter const.
+ (regcache_dump): Do not check DEPRECATED_REGISTER_BYTE.
+
+ * mi/mi-main.c (old_regs): Remove.
+ (mi_setup_architecture_data, _initialize_mi_main): Remove.
+ (register_changed_p): Reimplement to compare two register caches.
+ (mi_cmd_data_list_changed_registers): Update caller.
+ * mi/mi-main.h (mi_setup_architecture_data): Remove.
+ * mi/mi-interp.c (mi_interpreter_init): Do not call
+ mi_setup_architecture_data.
+
+2007-04-28 Ulrich Weigand <uweigand@de.ibm.com>
+
* alpha-nat.c (ALPHA_REGSET_BASE, ALPHA_REGSET_UNIQUE): Do not define,
inline definition at the places the macros are used.
* alpha-linux-nat.c (ALPHA_REGSET_BASE, ALPHA_REGSET_UNIQUE): Likewise.
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index bf93c7b..7b32b06 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -207,32 +207,6 @@ legacy_virtual_frame_pointer (CORE_ADDR pc,
*frame_offset = 0;
}
-/* Assume the world is sane, every register's virtual and real size
- is identical. */
-
-int
-generic_register_size (int regnum)
-{
- gdb_assert (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS);
- return TYPE_LENGTH (register_type (current_gdbarch, regnum));
-}
-
-/* Assume all registers are adjacent. */
-
-int
-generic_register_byte (int regnum)
-{
- int byte;
- int i;
- gdb_assert (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS);
- byte = 0;
- for (i = 0; i < regnum; i++)
- {
- byte += generic_register_size (i);
- }
- return byte;
-}
-
int
generic_convert_register_p (int regnum, struct type *type)
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index 7906f76..1b29a83 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -89,14 +89,6 @@ extern int generic_in_solib_return_trampoline (CORE_ADDR pc, char *name);
extern int generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc);
-/* Assume that the world is sane, a registers raw and virtual size
- both match its type. */
-
-extern int generic_register_size (int regnum);
-
-/* Assume that the world is sane, the registers are all adjacent. */
-extern int generic_register_byte (int regnum);
-
/* By default, registers are not convertible. */
extern int generic_convert_register_p (int regnum, struct type *type);
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 0710374..96d9b8f 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -165,7 +165,6 @@ struct gdbarch
gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum;
gdbarch_register_name_ftype *register_name;
gdbarch_register_type_ftype *register_type;
- gdbarch_deprecated_register_byte_ftype *deprecated_register_byte;
gdbarch_unwind_dummy_id_ftype *unwind_dummy_id;
int deprecated_fp_regnum;
gdbarch_push_dummy_call_ftype *push_dummy_call;
@@ -293,7 +292,6 @@ struct gdbarch startup_gdbarch =
0, /* dwarf2_reg_to_regnum */
0, /* register_name */
0, /* register_type */
- generic_register_byte, /* deprecated_register_byte */
0, /* unwind_dummy_id */
-1, /* deprecated_fp_regnum */
0, /* push_dummy_call */
@@ -426,7 +424,6 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->dwarf_reg_to_regnum = no_op_reg_to_regnum;
current_gdbarch->sdb_reg_to_regnum = no_op_reg_to_regnum;
current_gdbarch->dwarf2_reg_to_regnum = no_op_reg_to_regnum;
- current_gdbarch->deprecated_register_byte = generic_register_byte;
current_gdbarch->deprecated_fp_regnum = -1;
current_gdbarch->call_dummy_location = AT_ENTRY_POINT;
current_gdbarch->print_registers_info = default_print_registers_info;
@@ -552,7 +549,6 @@ verify_gdbarch (struct gdbarch *current_gdbarch)
/* Skip verify of sdb_reg_to_regnum, invalid_p == 0 */
/* Skip verify of dwarf2_reg_to_regnum, invalid_p == 0 */
/* Skip verify of register_type, has predicate */
- /* Skip verify of deprecated_register_byte, has predicate */
/* Skip verify of unwind_dummy_id, has predicate */
/* Skip verify of deprecated_fp_regnum, invalid_p == 0 */
/* Skip verify of push_dummy_call, has predicate */
@@ -893,24 +889,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file)
fprintf_unfiltered (file,
"gdbarch_dump: deprecated_reg_struct_has_addr = <0x%lx>\n",
(long) current_gdbarch->deprecated_reg_struct_has_addr);
-#ifdef DEPRECATED_REGISTER_BYTE_P
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "DEPRECATED_REGISTER_BYTE_P()",
- XSTRING (DEPRECATED_REGISTER_BYTE_P ()));
-#endif
- fprintf_unfiltered (file,
- "gdbarch_dump: gdbarch_deprecated_register_byte_p() = %d\n",
- gdbarch_deprecated_register_byte_p (current_gdbarch));
-#ifdef DEPRECATED_REGISTER_BYTE
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "DEPRECATED_REGISTER_BYTE(reg_nr)",
- XSTRING (DEPRECATED_REGISTER_BYTE (reg_nr)));
-#endif
- fprintf_unfiltered (file,
- "gdbarch_dump: deprecated_register_byte = <0x%lx>\n",
- (long) current_gdbarch->deprecated_register_byte);
#ifdef DEPRECATED_REGISTER_SIZE
fprintf_unfiltered (file,
"gdbarch_dump: DEPRECATED_REGISTER_SIZE # %s\n",
@@ -2260,31 +2238,6 @@ set_gdbarch_register_type (struct gdbarch *gdbarch,
}
int
-gdbarch_deprecated_register_byte_p (struct gdbarch *gdbarch)
-{
- gdb_assert (gdbarch != NULL);
- return gdbarch->deprecated_register_byte != generic_register_byte;
-}
-
-int
-gdbarch_deprecated_register_byte (struct gdbarch *gdbarch, int reg_nr)
-{
- gdb_assert (gdbarch != NULL);
- gdb_assert (gdbarch->deprecated_register_byte != NULL);
- /* Do not check predicate: gdbarch->deprecated_register_byte != generic_register_byte, allow call. */
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_byte called\n");
- return gdbarch->deprecated_register_byte (reg_nr);
-}
-
-void
-set_gdbarch_deprecated_register_byte (struct gdbarch *gdbarch,
- gdbarch_deprecated_register_byte_ftype deprecated_register_byte)
-{
- gdbarch->deprecated_register_byte = deprecated_register_byte;
-}
-
-int
gdbarch_unwind_dummy_id_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index ef81c5f..e696340 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -481,39 +481,6 @@ typedef struct type * (gdbarch_register_type_ftype) (struct gdbarch *gdbarch, in
extern struct type * gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr);
extern void set_gdbarch_register_type (struct gdbarch *gdbarch, gdbarch_register_type_ftype *register_type);
-/* If the value returned by DEPRECATED_REGISTER_BYTE agrees with the
- register offsets computed using just REGISTER_TYPE, this can be
- deleted. See: maint print registers. NOTE: cagney/2002-05-02: This
- function with predicate has a valid (callable) initial value. As a
- consequence, even when the predicate is false, the corresponding
- function works. This simplifies the migration process - old code,
- calling DEPRECATED_REGISTER_BYTE, doesn't need to be modified. */
-
-#if defined (DEPRECATED_REGISTER_BYTE)
-/* Legacy for systems yet to multi-arch DEPRECATED_REGISTER_BYTE */
-#if !defined (DEPRECATED_REGISTER_BYTE_P)
-#define DEPRECATED_REGISTER_BYTE_P() (1)
-#endif
-#endif
-
-extern int gdbarch_deprecated_register_byte_p (struct gdbarch *gdbarch);
-#if !defined (GDB_TM_FILE) && defined (DEPRECATED_REGISTER_BYTE_P)
-#error "Non multi-arch definition of DEPRECATED_REGISTER_BYTE"
-#endif
-#if !defined (DEPRECATED_REGISTER_BYTE_P)
-#define DEPRECATED_REGISTER_BYTE_P() (gdbarch_deprecated_register_byte_p (current_gdbarch))
-#endif
-
-typedef int (gdbarch_deprecated_register_byte_ftype) (int reg_nr);
-extern int gdbarch_deprecated_register_byte (struct gdbarch *gdbarch, int reg_nr);
-extern void set_gdbarch_deprecated_register_byte (struct gdbarch *gdbarch, gdbarch_deprecated_register_byte_ftype *deprecated_register_byte);
-#if !defined (GDB_TM_FILE) && defined (DEPRECATED_REGISTER_BYTE)
-#error "Non multi-arch definition of DEPRECATED_REGISTER_BYTE"
-#endif
-#if !defined (DEPRECATED_REGISTER_BYTE)
-#define DEPRECATED_REGISTER_BYTE(reg_nr) (gdbarch_deprecated_register_byte (current_gdbarch, reg_nr))
-#endif
-
/* See gdbint.texinfo, and PUSH_DUMMY_CALL. */
extern int gdbarch_unwind_dummy_id_p (struct gdbarch *gdbarch);
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 2e30031..aa46ceb 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -461,14 +461,6 @@ f:=:const char *:register_name:int regnr:regnr
# the register cache should call this function directly; others should
# use "register_type".
M::struct type *:register_type:int reg_nr:reg_nr
-# If the value returned by DEPRECATED_REGISTER_BYTE agrees with the
-# register offsets computed using just REGISTER_TYPE, this can be
-# deleted. See: maint print registers. NOTE: cagney/2002-05-02: This
-# function with predicate has a valid (callable) initial value. As a
-# consequence, even when the predicate is false, the corresponding
-# function works. This simplifies the migration process - old code,
-# calling DEPRECATED_REGISTER_BYTE, doesn't need to be modified.
-F:=:int:deprecated_register_byte:int reg_nr:reg_nr:generic_register_byte:generic_register_byte
# See gdbint.texinfo, and PUSH_DUMMY_CALL.
M::struct frame_id:unwind_dummy_id:struct frame_info *info:info
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 8e6c9b5..a8ffa0f 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -70,10 +70,6 @@ mi_interpreter_init (void)
{
struct mi_interp *mi = XMALLOC (struct mi_interp);
- /* Why is this a part of the mi architecture? */
-
- mi_setup_architecture_data ();
-
/* HACK: We need to force stdout/stderr to point at the console. This avoids
any potential side effects caused by legacy code that is still
using the TUI / fputs_unfiltered_hook. So we set up output channels for
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index bdbb309..96bf423 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -99,7 +99,6 @@ static int do_timings = 0;
static char *last_async_command;
static char *previous_async_command;
char *mi_error_message;
-static char *old_regs;
extern void _initialize_mi_main (void);
static enum mi_cmd_result mi_cmd_execute (struct mi_parse *parse);
@@ -110,7 +109,8 @@ static enum mi_cmd_result mi_execute_async_cli_command (char *mi, char *args, in
static void mi_exec_async_cli_cmd_continuation (struct continuation_arg *arg);
-static int register_changed_p (int regnum);
+static int register_changed_p (int regnum, struct regcache *,
+ struct regcache *);
static int get_register (int regnum, int format);
/* Command implementations. FIXME: Is this libgdb? No. This is the MI
@@ -332,10 +332,20 @@ mi_cmd_data_list_register_names (char *command, char **argv, int argc)
enum mi_cmd_result
mi_cmd_data_list_changed_registers (char *command, char **argv, int argc)
{
+ static struct regcache *this_regs = NULL;
+ struct regcache *prev_regs;
int regnum, numregs, changed;
int i;
struct cleanup *cleanup;
+ /* The last time we visited this function, the current frame's register
+ contents were saved in THIS_REGS. Move THIS_REGS over to PREV_REGS,
+ and refresh THIS_REGS with the now-current register contents. */
+
+ prev_regs = this_regs;
+ this_regs = frame_save_as_regcache (get_selected_frame (NULL));
+ cleanup = make_cleanup_regcache_xfree (prev_regs);
+
/* Note that the test for a valid register must include checking the
REGISTER_NAME because NUM_REGS may be allocated for the union of
the register sets within a family of related processors. In this
@@ -344,7 +354,7 @@ mi_cmd_data_list_changed_registers (char *command, char **argv, int argc)
numregs = NUM_REGS + NUM_PSEUDO_REGS;
- cleanup = make_cleanup_ui_out_list_begin_end (uiout, "changed-registers");
+ make_cleanup_ui_out_list_begin_end (uiout, "changed-registers");
if (argc == 0) /* No args, just do all the regs. */
{
@@ -355,7 +365,7 @@ mi_cmd_data_list_changed_registers (char *command, char **argv, int argc)
if (REGISTER_NAME (regnum) == NULL
|| *(REGISTER_NAME (regnum)) == '\0')
continue;
- changed = register_changed_p (regnum);
+ changed = register_changed_p (regnum, prev_regs, this_regs);
if (changed < 0)
{
do_cleanups (cleanup);
@@ -377,7 +387,7 @@ mi_cmd_data_list_changed_registers (char *command, char **argv, int argc)
&& REGISTER_NAME (regnum) != NULL
&& *REGISTER_NAME (regnum) != '\000')
{
- changed = register_changed_p (regnum);
+ changed = register_changed_p (regnum, prev_regs, this_regs);
if (changed < 0)
{
do_cleanups (cleanup);
@@ -399,23 +409,29 @@ mi_cmd_data_list_changed_registers (char *command, char **argv, int argc)
}
static int
-register_changed_p (int regnum)
+register_changed_p (int regnum, struct regcache *prev_regs,
+ struct regcache *this_regs)
{
- gdb_byte raw_buffer[MAX_REGISTER_SIZE];
-
- if (! frame_register_read (get_selected_frame (NULL), regnum, raw_buffer))
- return -1;
+ struct gdbarch *gdbarch = get_regcache_arch (this_regs);
+ gdb_byte prev_buffer[MAX_REGISTER_SIZE];
+ gdb_byte this_buffer[MAX_REGISTER_SIZE];
- if (memcmp (&old_regs[DEPRECATED_REGISTER_BYTE (regnum)], raw_buffer,
- register_size (current_gdbarch, regnum)) == 0)
+ /* Registers not valid in this frame return count as unchanged. */
+ if (!regcache_valid_p (this_regs, regnum))
return 0;
- /* Found a changed register. Return 1. */
+ /* First time through or after gdbarch change consider all registers as
+ changed. Same for registers not valid in the previous frame. */
+ if (!prev_regs || get_regcache_arch (prev_regs) != gdbarch
+ || !regcache_valid_p (prev_regs, regnum))
+ return 1;
- memcpy (&old_regs[DEPRECATED_REGISTER_BYTE (regnum)], raw_buffer,
- register_size (current_gdbarch, regnum));
+ /* Get register contents and compare. */
+ regcache_cooked_read (prev_regs, regnum, prev_buffer);
+ regcache_cooked_read (this_regs, regnum, this_buffer);
- return 1;
+ return memcmp (prev_buffer, this_buffer,
+ register_size (gdbarch, regnum)) != 0;
}
/* Return a list of register number and value pairs. The valid
@@ -1506,20 +1522,6 @@ mi_load_progress (const char *section_name,
uiout = saved_uiout;
}
-void
-mi_setup_architecture_data (void)
-{
- old_regs = xmalloc ((NUM_REGS + NUM_PSEUDO_REGS) * MAX_REGISTER_SIZE + 1);
- memset (old_regs, 0, (NUM_REGS + NUM_PSEUDO_REGS) * MAX_REGISTER_SIZE + 1);
-}
-
-void
-_initialize_mi_main (void)
-{
- DEPRECATED_REGISTER_GDBARCH_SWAP (old_regs);
- deprecated_register_gdbarch_swap (NULL, 0, mi_setup_architecture_data);
-}
-
static void
timestamp (struct mi_timestamp *tv)
{
diff --git a/gdb/mi/mi-main.h b/gdb/mi/mi-main.h
index 302ba25..889e0b5 100644
--- a/gdb/mi/mi-main.h
+++ b/gdb/mi/mi-main.h
@@ -22,8 +22,6 @@
#ifndef MI_MAIN_H
#define MI_MAIN_H
-extern void mi_setup_architecture_data (void);
-
extern void mi_load_progress (const char *section_name,
unsigned long sent_so_far,
unsigned long total_section,
diff --git a/gdb/regcache.c b/gdb/regcache.c
index a8fdac96..11810ef 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -381,10 +381,15 @@ regcache_dup_no_passthrough (struct regcache *src)
}
int
-regcache_valid_p (struct regcache *regcache, int regnum)
+regcache_valid_p (const struct regcache *regcache, int regnum)
{
gdb_assert (regcache != NULL);
- gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
+ gdb_assert (regnum >= 0);
+ if (regcache->readonly_p)
+ gdb_assert (regnum < regcache->descr->nr_cooked_registers);
+ else
+ gdb_assert (regnum < regcache->descr->nr_raw_registers);
+
return regcache->register_valid_p[regnum];
}
@@ -1107,7 +1112,6 @@ regcache_dump (struct regcache *regcache, struct ui_file *file,
fprintf_unfiltered (file, " %6ld",
regcache->descr->register_offset[regnum]);
if (register_offset != regcache->descr->register_offset[regnum]
- || register_offset != DEPRECATED_REGISTER_BYTE (regnum)
|| (regnum > 0
&& (regcache->descr->register_offset[regnum]
!= (regcache->descr->register_offset[regnum - 1]
diff --git a/gdb/regcache.h b/gdb/regcache.h
index fc24559..88192c7 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -59,7 +59,7 @@ void regcache_raw_read_part (struct regcache *regcache, int regnum,
void regcache_raw_write_part (struct regcache *regcache, int regnum,
int offset, int len, const gdb_byte *buf);
-int regcache_valid_p (struct regcache *regcache, int regnum);
+int regcache_valid_p (const struct regcache *regcache, int regnum);
/* Transfer a cooked register [0..NUM_REGS+NUM_PSEUDO_REGS). */
void regcache_cooked_read (struct regcache *regcache, int rawnum,