This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch rfc] Add func_addr param to push_dummy_call
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Fri, 30 May 2003 17:15:40 -0400
- Subject: [patch rfc] Add func_addr param to push_dummy_call
Hello,
In trying to clean up the MIPS inferior function call code I found that
push_dummy_call needed the address of the callee's entry point - MIPS
needs to shove that into T9.
The attached:
- adds that FUNC_ADDR parameter
- updates DUMMY_ADDR to the more correct BP_ADDR
- updates all calls
Eli, note the doco change,
I'll commit the non-doco part tomorrow.
Andrew
2003-05-30 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (PUSH_DUMMY_CALL): Add "func_addr" parameter. Rename
"dummy_addr" to "bp_addr".
* infcall.c (call_function_by_hand): Pass "funaddr" to
gdbarch_push_dummy_call.
* gdbarch.h, gdbarch.c: Re-generate.
* i386-tdep.c (i386_push_dummy_call): Update.
* arm-tdep.c (arm_push_dummy_call): Update.
* d10v-tdep.c (d10v_push_dummy_call): Update.
Index: doc/ChangeLog
2003-05-30 Andrew Cagney <cagney@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Add "func_addr"
parameter to "push_dummy_call". Rename "dummy_addr" to "bp_addr".
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.135
diff -u -r1.135 arm-tdep.c
--- arm-tdep.c 17 May 2003 05:59:57 -0000 1.135
+++ arm-tdep.c 30 May 2003 21:10:34 -0000
@@ -1405,19 +1405,20 @@
we should probably support some of them based on the selected ABI. */
static CORE_ADDR
-arm_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache,
- CORE_ADDR dummy_addr, int nargs, struct value **args,
- CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
+arm_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp, int struct_return,
+ CORE_ADDR struct_addr)
{
int argnum;
int argreg;
int nstack;
struct stack_item *si = NULL;
- /* Set the return address. For the ARM, the return breakpoint is always
- at DUMMY_ADDR. */
+ /* Set the return address. For the ARM, the return breakpoint is
+ always at BP_ADDR. */
/* XXX Fix for Thumb. */
- regcache_cooked_write_unsigned (regcache, ARM_LR_REGNUM, dummy_addr);
+ regcache_cooked_write_unsigned (regcache, ARM_LR_REGNUM, bp_addr);
/* Walk through the list of args and determine how large a temporary
stack is required. Need to take care here as structs may be
Index: d10v-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/d10v-tdep.c,v
retrieving revision 1.116
diff -u -r1.116 d10v-tdep.c
--- d10v-tdep.c 8 May 2003 18:46:47 -0000 1.116
+++ d10v-tdep.c 30 May 2003 21:10:35 -0000
@@ -977,9 +977,10 @@
}
static CORE_ADDR
-d10v_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache,
- CORE_ADDR dummy_addr, int nargs, struct value **args,
- CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
+d10v_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
+ struct regcache *regcache, CORE_ADDR bp_addr,
+ int nargs, struct value **args, CORE_ADDR sp, int struct_return,
+ CORE_ADDR struct_addr)
{
int i;
int regnum = ARG1_REGNUM;
@@ -987,9 +988,9 @@
long val;
/* Set the return address. For the d10v, the return breakpoint is
- always at DUMMY_ADDR. */
+ always at BP_ADDR. */
regcache_cooked_write_unsigned (regcache, LR_REGNUM,
- d10v_convert_iaddr_to_raw (dummy_addr));
+ d10v_convert_iaddr_to_raw (bp_addr));
/* If STRUCT_RETURN is true, then the struct return address (in
STRUCT_ADDR) will consume the first argument-passing register.
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.237
diff -u -r1.237 gdbarch.sh
--- gdbarch.sh 17 May 2003 05:59:58 -0000 1.237
+++ gdbarch.sh 30 May 2003 21:10:39 -0000
@@ -568,7 +568,7 @@
f:2:RETURN_VALUE_ON_STACK:int:return_value_on_stack:struct type *type:type:::generic_return_value_on_stack_not::0
# Replaced by PUSH_DUMMY_CALL
F:2:DEPRECATED_PUSH_ARGUMENTS:CORE_ADDR:deprecated_push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr
-M::PUSH_DUMMY_CALL:CORE_ADDR:push_dummy_call:struct regcache *regcache, CORE_ADDR dummy_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:regcache, dummy_addr, nargs, args, sp, struct_return, struct_addr
+M::PUSH_DUMMY_CALL:CORE_ADDR:push_dummy_call:CORE_ADDR func_addr, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:func_addr, regcache, bp_addr, nargs, args, sp, struct_return, struct_addr
F:2:DEPRECATED_PUSH_DUMMY_FRAME:void:deprecated_push_dummy_frame:void:-:::0
# NOTE: This can be handled directly in push_dummy_call.
F:2:DEPRECATED_PUSH_RETURN_ADDRESS:CORE_ADDR:deprecated_push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0
Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.145
diff -u -r1.145 i386-tdep.c
--- i386-tdep.c 30 May 2003 19:24:29 -0000 1.145
+++ i386-tdep.c 30 May 2003 21:10:39 -0000
@@ -1005,9 +1005,10 @@
static CORE_ADDR
-i386_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache,
- CORE_ADDR dummy_addr, int nargs, struct value **args,
- CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
+i386_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp, int struct_return,
+ CORE_ADDR struct_addr)
{
char buf[4];
int i;
@@ -1038,7 +1039,7 @@
/* Store return address. */
sp -= 4;
- store_unsigned_integer (buf, 4, dummy_addr);
+ store_unsigned_integer (buf, 4, bp_addr);
write_memory (sp, buf, 4);
/* Finally, update the stack pointer... */
Index: infcall.c
===================================================================
RCS file: /cvs/src/src/gdb/infcall.c,v
retrieving revision 1.12
diff -u -r1.12 infcall.c
--- infcall.c 30 May 2003 18:43:38 -0000 1.12
+++ infcall.c 30 May 2003 21:10:39 -0000
@@ -747,7 +747,7 @@
/* When there is no push_dummy_call method, should this code
simply error out. That would the implementation of this method
for all ABIs (which is probably a good thing). */
- sp = gdbarch_push_dummy_call (current_gdbarch, current_regcache,
+ sp = gdbarch_push_dummy_call (current_gdbarch, funaddr, current_regcache,
bp_addr, nargs, args, sp, struct_return,
struct_addr);
else if (DEPRECATED_PUSH_ARGUMENTS_P ())
Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.147
diff -u -r1.147 gdbint.texinfo
--- doc/gdbint.texinfo 21 May 2003 19:52:39 -0000 1.147
+++ doc/gdbint.texinfo 30 May 2003 21:10:42 -0000
@@ -3678,14 +3678,13 @@
If defined, used by @code{frame_pop} to remove a stack frame. This
method has been superseeded by generic code.
-@item push_dummy_call (@var{gdbarch}, @var{regcache}, @var{dummy_addr}, @var{nargs}, @var{args}, @var{sp}, @var{struct_return}, @var{struct_addr})
+@item push_dummy_call (@var{gdbarch}, @var{func_addr}, @var{regcache}, @var{pc_addr}, @var{nargs}, @var{args}, @var{sp}, @var{struct_return}, @var{struct_addr})
@findex push_dummy_call
@findex DEPRECATED_PUSH_ARGUMENTS.
-@anchor{push_dummy_call}
-Define this to push the dummy frame's call to the inferior function onto
-the stack. In addition to pushing @var{nargs}, the code should push
-@var{struct_addr} (when @var{struct_return}), and the return value (in
-the call dummy at @var{dummy_addr}).
+@anchor{push_dummy_call} Define this to push the dummy frame's call to
+the inferior function onto the stack. In addition to pushing
+@var{nargs}, the code should push @var{struct_addr} (when
+@var{struct_return}), and the return address (@var{bp_addr}).
Returns the updated top-of-stack pointer.