diff options
author | Andrew Cagney <cagney@redhat.com> | 2001-11-06 18:06:00 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2001-11-06 18:06:00 +0000 |
commit | 69a0d5f4faf69df010fda32619a31359d4bedf04 (patch) | |
tree | df68e564237bc70eafdecf94786c3548605306e9 /gdb | |
parent | f8deed93c68458a446ff52314e008c910e26a1a5 (diff) | |
download | gdb-69a0d5f4faf69df010fda32619a31359d4bedf04.zip gdb-69a0d5f4faf69df010fda32619a31359d4bedf04.tar.gz gdb-69a0d5f4faf69df010fda32619a31359d4bedf04.tar.bz2 |
Add predicate for PUSH_RETURN_ADDRESS.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/gdbarch.c | 10 | ||||
-rw-r--r-- | gdb/gdbarch.h | 25 | ||||
-rwxr-xr-x | gdb/gdbarch.sh | 2 | ||||
-rw-r--r-- | gdb/valops.c | 24 |
5 files changed, 54 insertions, 17 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 51d071a..d453520 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2001-11-05 Andrew Cagney <ac131313@redhat.com> + + * gdbarch.sh (push_return_address): Change to a function with + predicate. + * gdbarch.h, gdbarch.c: Re-generate. + * valops.c (hand_function_call): Replace #ifdef + PUSH_RETURN_ADDRESS with run-time test of PUSH_RETURN_ADDRESS_P. + 2001-11-06 Corinna Vinschen <vinschen@redhat.com> * arch-utils.c (generic_in_function_epilogue_p): New function. @@ -22,7 +30,7 @@ 2001-11-05 Andrew Cagney <ac131313@redhat.com> * gdbarch.sh (init_extra_frame_info): Change to a function with - pedicate. + predicate. * gdbarch.h, gdbarch.c: Re-generate. * blockframe.c (create_new_frame): Replace #ifdef INIT_EXTRA_FRAME_INFO with run-time test of diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 94cac02..d2a7928 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -678,9 +678,7 @@ verify_gdbarch (struct gdbarch *gdbarch) if ((GDB_MULTI_ARCH >= 2) && (gdbarch->push_dummy_frame == 0)) fprintf_unfiltered (log, "\n\tpush_dummy_frame"); - if ((GDB_MULTI_ARCH >= 1) - && (gdbarch->push_return_address == 0)) - fprintf_unfiltered (log, "\n\tpush_return_address"); + /* Skip verify of push_return_address, has predicate */ if ((GDB_MULTI_ARCH >= 2) && (gdbarch->pop_frame == 0)) fprintf_unfiltered (log, "\n\tpop_frame"); @@ -3489,6 +3487,12 @@ set_gdbarch_push_dummy_frame (struct gdbarch *gdbarch, gdbarch->push_dummy_frame = push_dummy_frame; } +int +gdbarch_push_return_address_p (struct gdbarch *gdbarch) +{ + return gdbarch->push_return_address != 0; +} + CORE_ADDR gdbarch_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp) { diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index f41a35d..2ed6b21 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -1332,6 +1332,31 @@ extern void set_gdbarch_push_dummy_frame (struct gdbarch *gdbarch, gdbarch_push_ #endif #endif +#if defined (PUSH_RETURN_ADDRESS) +/* Legacy for systems yet to multi-arch PUSH_RETURN_ADDRESS */ +#if !defined (PUSH_RETURN_ADDRESS_P) +#define PUSH_RETURN_ADDRESS_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (PUSH_RETURN_ADDRESS_P) +#define PUSH_RETURN_ADDRESS_P() (0) +#endif + +extern int gdbarch_push_return_address_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PUSH_RETURN_ADDRESS_P) +#error "Non multi-arch definition of PUSH_RETURN_ADDRESS" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PUSH_RETURN_ADDRESS_P) +#define PUSH_RETURN_ADDRESS_P() (gdbarch_push_return_address_p (current_gdbarch)) +#endif + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (PUSH_RETURN_ADDRESS) +#define PUSH_RETURN_ADDRESS(pc, sp) (internal_error (__FILE__, __LINE__, "PUSH_RETURN_ADDRESS"), 0) +#endif + typedef CORE_ADDR (gdbarch_push_return_address_ftype) (CORE_ADDR pc, CORE_ADDR sp); extern CORE_ADDR gdbarch_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp); extern void set_gdbarch_push_return_address (struct gdbarch *gdbarch, gdbarch_push_return_address_ftype *push_return_address); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 34be94e..acd69f2 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -478,7 +478,7 @@ f:2:RETURN_VALUE_ON_STACK:int:return_value_on_stack:struct type *type:type:::gen f:2:EXTRACT_RETURN_VALUE:void:extract_return_value:struct type *type, char *regbuf, char *valbuf:type, regbuf, valbuf::0:0 f:1:PUSH_ARGUMENTS:CORE_ADDR:push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr::0:0 f:2:PUSH_DUMMY_FRAME:void:push_dummy_frame:void:-:::0 -f:1:PUSH_RETURN_ADDRESS:CORE_ADDR:push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0 +F:1:PUSH_RETURN_ADDRESS:CORE_ADDR:push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0 f:2:POP_FRAME:void:pop_frame:void:-:::0 # f:2:STORE_STRUCT_RETURN:void:store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp:::0 diff --git a/gdb/valops.c b/gdb/valops.c index 22c6948..e0642ee 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1570,18 +1570,18 @@ You must use a pointer to function type variable. Command ignored.", arg_name); sp = PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr); -#ifdef PUSH_RETURN_ADDRESS /* for targets that use no CALL_DUMMY */ - /* There are a number of targets now which actually don't write any - CALL_DUMMY instructions into the target, but instead just save the - machine state, push the arguments, and jump directly to the callee - function. Since this doesn't actually involve executing a JSR/BSR - instruction, the return address must be set up by hand, either by - pushing onto the stack or copying into a return-address register - as appropriate. Formerly this has been done in PUSH_ARGUMENTS, - but that's overloading its functionality a bit, so I'm making it - explicit to do it here. */ - sp = PUSH_RETURN_ADDRESS (real_pc, sp); -#endif /* PUSH_RETURN_ADDRESS */ + if (PUSH_RETURN_ADDRESS_P ()) + /* for targets that use no CALL_DUMMY */ + /* There are a number of targets now which actually don't write + any CALL_DUMMY instructions into the target, but instead just + save the machine state, push the arguments, and jump directly + to the callee function. Since this doesn't actually involve + executing a JSR/BSR instruction, the return address must be set + up by hand, either by pushing onto the stack or copying into a + return-address register as appropriate. Formerly this has been + done in PUSH_ARGUMENTS, but that's overloading its + functionality a bit, so I'm making it explicit to do it here. */ + sp = PUSH_RETURN_ADDRESS (real_pc, sp); if (STACK_ALIGN_P () && !INNER_THAN (1, 2)) { |