This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] [5/6] Replace DEPRECATED_FP_REGNUM
- From: Markus Deuling <deuling at de dot ibm dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>
- Cc: Ulrich Weigand <uweigand at de dot ibm dot com>
- Date: Mon, 18 Jun 2007 11:02:31 +0200
- Subject: [rfc] [5/6] Replace DEPRECATED_FP_REGNUM
Hello,
this patch replaces DEPRECATED_FP_REGNUM by gdbarch_deprecated_fp_regnum.
ChangeLog:
* gdbarch.sh (DEPRECATED_FP_REGNUM): Replace by
gdbarch_deprecated_fp_regnum.
* std-regs.c (value_of_builtin_frame_fp_reg): Likewise.
* remote-mips.c (mips_wait, mips_fetch_registers): Likewise.
* arch-utils.c (legacy_virtual_frame_pointer): Likewise.
* arch-utils.h (gdbarch_virtual_frame_pointer_ftype): Likewise
(comment).
* gdbarch.c, gdbarch.h: Regenerate.
Is this ok to commit ?
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
diff -urN src/gdb/arch-utils.c dev/gdb/arch-utils.c
--- src/gdb/arch-utils.c 2007-06-18 05:36:40.000000000 +0200
+++ dev/gdb/arch-utils.c 2007-06-18 10:23:21.000000000 +0200
@@ -173,7 +173,7 @@
}
/* Legacy version of target_virtual_frame_pointer(). Assumes that
- there is an DEPRECATED_FP_REGNUM and that it is the same, cooked or
+ there is an gdbarch_deprecated_fp_regnum and that it is the same, cooked or
raw. */
void
@@ -186,9 +186,10 @@
register and an offset can determine this. I think it should
instead generate a byte code expression as that would work better
with things like Dwarf2's CFI. */
- if (DEPRECATED_FP_REGNUM >= 0
- && DEPRECATED_FP_REGNUM < gdbarch_num_regs (current_gdbarch))
- *frame_regnum = DEPRECATED_FP_REGNUM;
+ if (gdbarch_deprecated_fp_regnum (current_gdbarch) >= 0
+ && gdbarch_deprecated_fp_regnum (current_gdbarch)
+ < gdbarch_num_regs (current_gdbarch))
+ *frame_regnum = gdbarch_deprecated_fp_regnum (current_gdbarch);
else if (SP_REGNUM >= 0 && SP_REGNUM < gdbarch_num_regs (current_gdbarch))
*frame_regnum = SP_REGNUM;
else
diff -urN src/gdb/arch-utils.h dev/gdb/arch-utils.h
--- src/gdb/arch-utils.h 2007-06-18 05:36:40.000000000 +0200
+++ dev/gdb/arch-utils.h 2007-06-18 10:23:45.000000000 +0200
@@ -72,7 +72,7 @@
int cannot_register_not (int regnum);
/* Legacy version of target_virtual_frame_pointer(). Assumes that
- there is an DEPRECATED_FP_REGNUM and that it is the same, cooked or
+ there is an gdbarch_deprecated_fp_regnum and that it is the same, cooked or
raw. */
extern gdbarch_virtual_frame_pointer_ftype legacy_virtual_frame_pointer;
diff -urN src/gdb/gdbarch.c dev/gdb/gdbarch.c
--- src/gdb/gdbarch.c 2007-06-18 05:36:42.000000000 +0200
+++ dev/gdb/gdbarch.c 2007-06-18 10:20:08.000000000 +0200
@@ -743,11 +743,6 @@
fprintf_unfiltered (file,
"gdbarch_dump: deprecated_extract_struct_value_address = <0x%lx>\n",
(long) current_gdbarch->deprecated_extract_struct_value_address);
-#ifdef DEPRECATED_FP_REGNUM
- fprintf_unfiltered (file,
- "gdbarch_dump: DEPRECATED_FP_REGNUM # %s\n",
- XSTRING (DEPRECATED_FP_REGNUM));
-#endif
fprintf_unfiltered (file,
"gdbarch_dump: deprecated_fp_regnum = %s\n",
paddr_d (current_gdbarch->deprecated_fp_regnum));
diff -urN src/gdb/gdbarch.h dev/gdb/gdbarch.h
--- src/gdb/gdbarch.h 2007-06-18 05:36:42.000000000 +0200
+++ dev/gdb/gdbarch.h 2007-06-18 10:19:58.000000000 +0200
@@ -281,16 +281,10 @@
extern void set_gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, gdbarch_unwind_dummy_id_ftype *unwind_dummy_id);
/* Implement UNWIND_DUMMY_ID and PUSH_DUMMY_CALL, then delete
- DEPRECATED_FP_REGNUM. */
+ deprecated_fp_regnum. */
extern int gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch);
extern void set_gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch, int deprecated_fp_regnum);
-#if !defined (GDB_TM_FILE) && defined (DEPRECATED_FP_REGNUM)
-#error "Non multi-arch definition of DEPRECATED_FP_REGNUM"
-#endif
-#if !defined (DEPRECATED_FP_REGNUM)
-#define DEPRECATED_FP_REGNUM (gdbarch_deprecated_fp_regnum (current_gdbarch))
-#endif
/* See gdbint.texinfo. See infcall.c. */
diff -urN src/gdb/gdbarch.sh dev/gdb/gdbarch.sh
--- src/gdb/gdbarch.sh 2007-06-18 05:36:42.000000000 +0200
+++ dev/gdb/gdbarch.sh 2007-06-18 10:19:51.000000000 +0200
@@ -462,8 +462,8 @@
# See gdbint.texinfo, and PUSH_DUMMY_CALL.
M::struct frame_id:unwind_dummy_id:struct frame_info *info:info
# Implement UNWIND_DUMMY_ID and PUSH_DUMMY_CALL, then delete
-# DEPRECATED_FP_REGNUM.
-v:=:int:deprecated_fp_regnum:::-1:-1::0
+# deprecated_fp_regnum.
+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
diff -urN src/gdb/remote-mips.c dev/gdb/remote-mips.c
--- src/gdb/remote-mips.c 2007-06-18 05:36:43.000000000 +0200
+++ dev/gdb/remote-mips.c 2007-06-18 10:22:25.000000000 +0200
@@ -1767,8 +1767,13 @@
store_unsigned_integer (buf, register_size (current_gdbarch, SP_REGNUM), rsp);
regcache_raw_supply (regcache, SP_REGNUM, buf);
- store_unsigned_integer (buf, register_size (current_gdbarch, DEPRECATED_FP_REGNUM), 0);
- regcache_raw_supply (regcache, DEPRECATED_FP_REGNUM, buf);
+ store_unsigned_integer (buf,
+ register_size (current_gdbarch,
+ gdbarch_deprecated_fp_regnum
+ (current_gdbarch)),
+ 0);
+ regcache_raw_supply (regcache,
+ gdbarch_deprecated_fp_regnum (current_gdbarch), buf);
if (nfields == 9)
{
@@ -1905,8 +1910,9 @@
return;
}
- if (regno == DEPRECATED_FP_REGNUM || regno == MIPS_ZERO_REGNUM)
- /* DEPRECATED_FP_REGNUM on the mips is a hack which is just
+ if (regno == gdbarch_deprecated_fp_regnum (current_gdbarch)
+ || regno == MIPS_ZERO_REGNUM)
+ /* gdbarch_deprecated_fp_regnum on the mips is a hack which is just
supposed to read zero (see also mips-nat.c). */
val = 0;
else
diff -urN src/gdb/std-regs.c dev/gdb/std-regs.c
--- src/gdb/std-regs.c 2007-06-18 05:36:44.000000000 +0200
+++ dev/gdb/std-regs.c 2007-06-18 10:19:33.000000000 +0200
@@ -32,14 +32,15 @@
static struct value *
value_of_builtin_frame_fp_reg (struct frame_info *frame, const void *baton)
{
- if (DEPRECATED_FP_REGNUM >= 0)
+ if (gdbarch_deprecated_fp_regnum (current_gdbarch) >= 0)
/* NOTE: cagney/2003-04-24: Since the mere presence of "fp" in the
register name table overrides this built-in $fp register, there
- is no real reason for this DEPRECATED_FP_REGNUM trickery here.
+ is no real reason for this gdbarch_deprecated_fp_regnum trickery here.
An architecture wanting to implement "$fp" as alias for a raw
register can do so by adding "fp" to register name table (mind
you, doing this is probably a dangerous thing). */
- return value_of_register (DEPRECATED_FP_REGNUM, frame);
+ return value_of_register (gdbarch_deprecated_fp_regnum (current_gdbarch),
+ frame);
else
{
struct value *val = allocate_value (builtin_type_void_data_ptr);