This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [rfc] [4/6] Replace DEPRECATED_REGISTER_SIZE
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: deuling at de dot ibm dot com (Markus Deuling)
- Cc: gdb-patches at sourceware dot org (GDB Patches)
- Date: Mon, 18 Jun 2007 21:01:24 +0200 (CEST)
- Subject: Re: [rfc] [4/6] Replace DEPRECATED_REGISTER_SIZE
Markus Deuling wrote:
> this patch replaces DEPRECATED_REGISTER_SIZE by gdbarch_deprecated_register_size
We should really just get rid of this right away. The sole remaining use
in arm-tdep.c is obsolete -- here, DEPRECATED_REGISTER_SIZE must always
evaluate to 4, so we can just replace it with the arm-tdep.h defined
macro INT_REGISTER_SIZE used elsewhere in arm-tdep.c.
As there is no further use of the macro, it is then safe to remove the
gdbarch value completely.
I've committed the following patch to this purpose.
Bye,
Ulrich
ChangeLog:
* gdbarch.sh (deprecated_register_size): Remove.
* gdbarch.h, gdbarch.c: Regenerate.
* arm-tdep.c (arm_push_dummy_call): Replace DEPRECATED_REGISTER_SIZE
by INT_REGISTER_SIZE.
(thumb_get_next_pc, arm_return_in_memory): Likewise.
(arm_gdbarch_init): Do not call set_gdbarch_deprecated_register_size.
* ia64-tdep.c (ia64_gdbarch_init): Do not call
set_gdbarch_deprecated_register_size.
diff -urNp gdb-orig/gdb/arm-tdep.c gdb-head/gdb/arm-tdep.c
--- gdb-orig/gdb/arm-tdep.c 2007-06-16 00:44:08.000000000 +0200
+++ gdb-head/gdb/arm-tdep.c 2007-06-18 20:45:48.543981318 +0200
@@ -1282,7 +1282,7 @@ arm_push_dummy_call (struct gdbarch *gdb
registers and stack. */
while (len > 0)
{
- int partial_len = len < DEPRECATED_REGISTER_SIZE ? len : DEPRECATED_REGISTER_SIZE;
+ int partial_len = len < INT_REGISTER_SIZE ? len : INT_REGISTER_SIZE;
if (argreg <= ARM_LAST_ARG_REGNUM)
{
@@ -1294,7 +1294,7 @@ arm_push_dummy_call (struct gdbarch *gdb
argnum,
gdbarch_register_name
(current_gdbarch, argreg),
- phex (regval, DEPRECATED_REGISTER_SIZE));
+ phex (regval, INT_REGISTER_SIZE));
regcache_cooked_write_unsigned (regcache, argreg, regval);
argreg++;
}
@@ -1304,8 +1304,8 @@ arm_push_dummy_call (struct gdbarch *gdb
if (arm_debug)
fprintf_unfiltered (gdb_stdlog, "arg %d @ sp + %d\n",
argnum, nstack);
- si = push_stack_item (si, val, DEPRECATED_REGISTER_SIZE);
- nstack += DEPRECATED_REGISTER_SIZE;
+ si = push_stack_item (si, val, INT_REGISTER_SIZE);
+ nstack += INT_REGISTER_SIZE;
}
len -= partial_len;
@@ -1622,7 +1622,7 @@ thumb_get_next_pc (struct frame_info *fr
/* Fetch the saved PC from the stack. It's stored above
all of the other registers. */
- offset = bitcount (bits (inst1, 0, 7)) * DEPRECATED_REGISTER_SIZE;
+ offset = bitcount (bits (inst1, 0, 7)) * INT_REGISTER_SIZE;
sp = get_frame_register_unsigned (frame, ARM_SP_REGNUM);
nextpc = (CORE_ADDR) read_memory_unsigned_integer (sp + offset, 4);
nextpc = gdbarch_addr_bits_remove (current_gdbarch, nextpc);
@@ -2138,7 +2138,7 @@ arm_return_in_memory (struct gdbarch *gd
/* In the ARM ABI, "integer" like aggregate types are returned in
registers. For an aggregate type to be integer like, its size
- must be less than or equal to DEPRECATED_REGISTER_SIZE and the
+ must be less than or equal to INT_REGISTER_SIZE and the
offset of each addressable subfield must be zero. Note that bit
fields are not addressable, and all addressable subfields of
unions always start at offset zero.
@@ -2155,7 +2155,7 @@ arm_return_in_memory (struct gdbarch *gd
/* All aggregate types that won't fit in a register must be returned
in memory. */
- if (TYPE_LENGTH (type) > DEPRECATED_REGISTER_SIZE)
+ if (TYPE_LENGTH (type) > INT_REGISTER_SIZE)
{
return 1;
}
@@ -2182,7 +2182,7 @@ arm_return_in_memory (struct gdbarch *gd
int i;
/* Need to check if this struct/union is "integer" like. For
this to be true, its size must be less than or equal to
- DEPRECATED_REGISTER_SIZE and the offset of each addressable
+ INT_REGISTER_SIZE and the offset of each addressable
subfield must be zero. Note that bit fields are not
addressable, and unions always start at offset zero. If any
of the subfields is a floating point type, the struct/union
@@ -2968,8 +2968,6 @@ arm_gdbarch_init (struct gdbarch_info in
set_gdbarch_dwarf2_reg_to_regnum (gdbarch, arm_dwarf_reg_to_regnum);
set_gdbarch_register_sim_regno (gdbarch, arm_register_sim_regno);
- /* Integer registers are 4 bytes. */
- set_gdbarch_deprecated_register_size (gdbarch, 4);
set_gdbarch_register_name (gdbarch, arm_register_name);
/* Returning results. */
diff -urNp gdb-orig/gdb/gdbarch.c gdb-head/gdb/gdbarch.c
--- gdb-orig/gdb/gdbarch.c 2007-06-18 20:32:15.965520000 +0200
+++ gdb-head/gdb/gdbarch.c 2007-06-18 20:42:34.008434414 +0200
@@ -166,7 +166,6 @@ struct gdbarch
gdbarch_unwind_dummy_id_ftype *unwind_dummy_id;
int deprecated_fp_regnum;
gdbarch_push_dummy_call_ftype *push_dummy_call;
- int deprecated_register_size;
int call_dummy_location;
gdbarch_push_dummy_code_ftype *push_dummy_code;
gdbarch_print_registers_info_ftype *print_registers_info;
@@ -288,7 +287,6 @@ struct gdbarch startup_gdbarch =
0, /* unwind_dummy_id */
-1, /* deprecated_fp_regnum */
0, /* push_dummy_call */
- 0, /* deprecated_register_size */
0, /* call_dummy_location */
0, /* push_dummy_code */
default_print_registers_info, /* print_registers_info */
@@ -734,14 +732,6 @@ gdbarch_dump (struct gdbarch *current_gd
fprintf_unfiltered (file,
"gdbarch_dump: deprecated_reg_struct_has_addr = <0x%lx>\n",
(long) current_gdbarch->deprecated_reg_struct_has_addr);
-#ifdef DEPRECATED_REGISTER_SIZE
- fprintf_unfiltered (file,
- "gdbarch_dump: DEPRECATED_REGISTER_SIZE # %s\n",
- XSTRING (DEPRECATED_REGISTER_SIZE));
-#endif
- fprintf_unfiltered (file,
- "gdbarch_dump: deprecated_register_size = %s\n",
- paddr_d (current_gdbarch->deprecated_register_size));
fprintf_unfiltered (file,
"gdbarch_dump: deprecated_use_struct_convention = <0x%lx>\n",
(long) current_gdbarch->deprecated_use_struct_convention);
@@ -1746,22 +1736,6 @@ set_gdbarch_push_dummy_call (struct gdba
}
int
-gdbarch_deprecated_register_size (struct gdbarch *gdbarch)
-{
- gdb_assert (gdbarch != NULL);
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_register_size called\n");
- return gdbarch->deprecated_register_size;
-}
-
-void
-set_gdbarch_deprecated_register_size (struct gdbarch *gdbarch,
- int deprecated_register_size)
-{
- gdbarch->deprecated_register_size = deprecated_register_size;
-}
-
-int
gdbarch_call_dummy_location (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
diff -urNp gdb-orig/gdb/gdbarch.h gdb-head/gdb/gdbarch.h
--- gdb-orig/gdb/gdbarch.h 2007-06-18 20:30:12.189426000 +0200
+++ gdb-head/gdb/gdbarch.h 2007-06-18 20:42:16.058354813 +0200
@@ -270,17 +270,6 @@ typedef CORE_ADDR (gdbarch_push_dummy_ca
extern CORE_ADDR gdbarch_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
extern void set_gdbarch_push_dummy_call (struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype *push_dummy_call);
-/* DEPRECATED_REGISTER_SIZE can be deleted. */
-
-extern int gdbarch_deprecated_register_size (struct gdbarch *gdbarch);
-extern void set_gdbarch_deprecated_register_size (struct gdbarch *gdbarch, int deprecated_register_size);
-#if !defined (GDB_TM_FILE) && defined (DEPRECATED_REGISTER_SIZE)
-#error "Non multi-arch definition of DEPRECATED_REGISTER_SIZE"
-#endif
-#if !defined (DEPRECATED_REGISTER_SIZE)
-#define DEPRECATED_REGISTER_SIZE (gdbarch_deprecated_register_size (current_gdbarch))
-#endif
-
extern int gdbarch_call_dummy_location (struct gdbarch *gdbarch);
extern void set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, int call_dummy_location);
diff -urNp gdb-orig/gdb/gdbarch.sh gdb-head/gdb/gdbarch.sh
--- gdb-orig/gdb/gdbarch.sh 2007-06-18 20:30:12.232419000 +0200
+++ gdb-head/gdb/gdbarch.sh 2007-06-18 20:42:06.026201946 +0200
@@ -467,8 +467,6 @@ v::int:deprecated_fp_regnum:::-1:-1::0
# See gdbint.texinfo. See infcall.c.
M::CORE_ADDR:push_dummy_call:struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:function, regcache, bp_addr, nargs, args, sp, struct_return, struct_addr
-# DEPRECATED_REGISTER_SIZE can be deleted.
-v:=:int:deprecated_register_size
v::int:call_dummy_location::::AT_ENTRY_POINT::0
M::CORE_ADDR:push_dummy_code:CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr, struct regcache *regcache:sp, funaddr, using_gcc, args, nargs, value_type, real_pc, bp_addr, regcache
diff -urNp gdb-orig/gdb/ia64-tdep.c gdb-head/gdb/ia64-tdep.c
--- gdb-orig/gdb/ia64-tdep.c 2007-06-18 20:27:02.205873000 +0200
+++ gdb-head/gdb/ia64-tdep.c 2007-06-18 20:41:42.229032361 +0200
@@ -3525,9 +3525,6 @@ ia64_gdbarch_init (struct gdbarch_info i
set_gdbarch_fp0_regnum (gdbarch, IA64_FR0_REGNUM);
set_gdbarch_register_name (gdbarch, ia64_register_name);
- /* FIXME: Following interface should not be needed, however, without it recurse.exp
- gets a number of extra failures. */
- set_gdbarch_deprecated_register_size (gdbarch, 8);
set_gdbarch_register_type (gdbarch, ia64_register_type);
set_gdbarch_pseudo_register_read (gdbarch, ia64_pseudo_register_read);
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com