Add predicate for PUSH_RETURN_ADDRESS.

This commit is contained in:
Andrew Cagney 2001-11-06 18:06:00 +00:00
parent f8deed93c6
commit 69a0d5f4fa
5 changed files with 54 additions and 17 deletions

View File

@ -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

View File

@ -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)
{

View File

@ -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);

View File

@ -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

View File

@ -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))
{