From 9710e734be97ab818b961fd5d7552cf46018e2ab Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Thu, 7 Aug 2003 23:41:57 +0000 Subject: [PATCH] 2003-08-07 Andrew Cagney * inferior.h (AT_SYMBOL): Define. * blockframe.c (inside_entry_file): Check for AT_SYMBOL. * infcall.c (call_function_by_hand): Add code to handle AT_SYMBOL. * mips-tdep.c (mips_call_dummy_address): Delete function. (mips_gdbarch_init): Set call_dummy_location to AT_SYMBOL, do not set call_dummy_address. --- gdb/ChangeLog | 9 +++++++++ gdb/blockframe.c | 3 ++- gdb/infcall.c | 17 +++++++++++++++++ gdb/inferior.h | 1 + gdb/mips-tdep.c | 24 ++++-------------------- 5 files changed, 33 insertions(+), 21 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f18e73bd794..df69767afef 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2003-08-07 Andrew Cagney + + * inferior.h (AT_SYMBOL): Define. + * blockframe.c (inside_entry_file): Check for AT_SYMBOL. + * infcall.c (call_function_by_hand): Add code to handle AT_SYMBOL. + * mips-tdep.c (mips_call_dummy_address): Delete function. + (mips_gdbarch_init): Set call_dummy_location to AT_SYMBOL, do not + set call_dummy_address. + 2003-08-07 Andrew Cagney * language.c (op_error): Delete function. diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 9a11c900578..4e689ac644b 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -59,7 +59,8 @@ inside_entry_file (CORE_ADDR addr) return 1; if (symfile_objfile == 0) return 0; - if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT) + if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT + || CALL_DUMMY_LOCATION == AT_SYMBOL) { /* Do not stop backtracing if the pc is in the call dummy at the entry point. */ diff --git a/gdb/infcall.c b/gdb/infcall.c index 4fd97ae5652..a4a6ac10608 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -547,6 +547,23 @@ call_function_by_hand (struct value *function, int nargs, struct value **args) it's address is the same as the address of the dummy. */ bp_addr = dummy_addr; break; + case AT_SYMBOL: + /* Some executables define a symbol __CALL_DUMMY_ADDRESS whose + address is the location where the breakpoint should be + placed. Once all targets are using the overhauled frame code + this can be deleted - ON_STACK is a better option. */ + { + struct minimal_symbol *sym; + + sym = lookup_minimal_symbol ("__CALL_DUMMY_ADDRESS", NULL, NULL); + real_pc = funaddr; + if (sym) + dummy_addr = SYMBOL_VALUE_ADDRESS (sym); + else + dummy_addr = entry_point_address (); + bp_addr = dummy_addr; + break; + } default: internal_error (__FILE__, __LINE__, "bad switch"); } diff --git a/gdb/inferior.h b/gdb/inferior.h index ed49d2315d9..60191f2b98f 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -438,6 +438,7 @@ extern int attach_flag; /* Possible values for CALL_DUMMY_LOCATION. */ #define ON_STACK 1 #define AT_ENTRY_POINT 4 +#define AT_SYMBOL 5 /* FIXME: cagney/2000-04-17: gdbarch should manage this. The default shouldn't be necessary. */ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index d1d2e38b869..ab860a7b840 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -5540,25 +5540,6 @@ mips_ignore_helper (CORE_ADDR pc) } -/* Return a location where we can set a breakpoint that will be hit - when an inferior function call returns. This is normally the - program's entry point. Executables that don't have an entry - point (e.g. programs in ROM) should define a symbol __CALL_DUMMY_ADDRESS - whose address is the location where the breakpoint should be placed. */ - -static CORE_ADDR -mips_call_dummy_address (void) -{ - struct minimal_symbol *sym; - - sym = lookup_minimal_symbol ("__CALL_DUMMY_ADDRESS", NULL, NULL); - if (sym) - return SYMBOL_VALUE_ADDRESS (sym); - else - return entry_point_address (); -} - - /* When debugging a 64 MIPS target running a 32 bit ABI, the size of the register stored on the stack (32) is different to its real raw size (64). The below ensures that registers are fetched from the @@ -6113,7 +6094,10 @@ mips_gdbarch_init (struct gdbarch_info info, /* MIPS version of CALL_DUMMY */ - set_gdbarch_call_dummy_address (gdbarch, mips_call_dummy_address); + /* NOTE: cagney/2003-08-05: Eventually call dummy location will be + replaced by a command, and all targets will default to on stack + (regardless of the stack's execute status). */ + set_gdbarch_call_dummy_location (gdbarch, AT_SYMBOL); set_gdbarch_deprecated_pop_frame (gdbarch, mips_pop_frame); set_gdbarch_frame_align (gdbarch, mips_frame_align); set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); -- 2.30.2