From 90ba813f1fcbda33d35d1dac4fda91ce26eb12d8 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Mon, 22 Mar 2004 15:36:47 +0000 Subject: [PATCH] 2004-03-22 Andrew Cagney * frame.h (deprecated_pc_in_call_dummy): Rename generic_pc_in_call_dummy. * dummy-frame.h (pc_in_dummy_frame): Delete declaration. * dummy-frame.c (deprecated_pc_in_call_dummy): Rename generic_pc_in_call_dummy. (pc_in_dummy_frame): Make static. * gdbarch.sh (DEPRECATED_PC_IN_CALL_DUMMY): Update. * gdbarch.h, gdbarch.c: Re-generate. * dummy-frame.c (dummy_frame_sniffer): Simplify. * frame.c (frame_type_from_pc): Call deprecated_pc_in_call_dummy. (legacy_get_prev_frame): Ditto. * inferior.h: Delete reference to generic_pc_in_call_dummy in comment. --- gdb/ChangeLog | 16 ++++++++++++++++ gdb/dummy-frame.c | 11 ++++++----- gdb/dummy-frame.h | 25 ------------------------- gdb/frame.c | 10 ++-------- gdb/frame.h | 4 ++-- gdb/gdbarch.c | 8 ++++---- gdb/gdbarch.sh | 2 +- gdb/inferior.h | 8 ++++---- 8 files changed, 35 insertions(+), 49 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5ea55d83066..8062186f06c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,19 @@ +2004-03-22 Andrew Cagney + + * frame.h (deprecated_pc_in_call_dummy): Rename + generic_pc_in_call_dummy. + * dummy-frame.h (pc_in_dummy_frame): Delete declaration. + * dummy-frame.c (deprecated_pc_in_call_dummy): Rename + generic_pc_in_call_dummy. + (pc_in_dummy_frame): Make static. + * gdbarch.sh (DEPRECATED_PC_IN_CALL_DUMMY): Update. + * gdbarch.h, gdbarch.c: Re-generate. + * dummy-frame.c (dummy_frame_sniffer): Simplify. + * frame.c (frame_type_from_pc): Call deprecated_pc_in_call_dummy. + (legacy_get_prev_frame): Ditto. + * inferior.h: Delete reference to generic_pc_in_call_dummy in + comment. + 2004-03-21 Andrew Cagney * inferior.h (deprecated_pc_in_call_dummy_at_entry_point): Delete diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c index 3b10c51640b..66918b6d219 100644 --- a/gdb/dummy-frame.c +++ b/gdb/dummy-frame.c @@ -36,6 +36,8 @@ static void dummy_frame_this_id (struct frame_info *next_frame, void **this_prologue_cache, struct frame_id *this_id); +static int pc_in_dummy_frame (CORE_ADDR pc); + /* Dummy frame. This saves the processor state just prior to setting up the inferior function call. Older targets save the registers on the target stack (but that really slows down function calls). */ @@ -137,7 +139,7 @@ deprecated_generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp) subtracted out. */ int -generic_pc_in_call_dummy (CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR fp) +deprecated_pc_in_call_dummy (CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR fp) { return pc_in_dummy_frame (pc); } @@ -155,7 +157,7 @@ generic_pc_in_call_dummy (CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR fp) !DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET_P yet generic dummy targets set DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET. True?). */ -int +static int pc_in_dummy_frame (CORE_ADDR pc) { struct dummy_frame *dummyframe; @@ -411,9 +413,8 @@ const struct frame_unwind * dummy_frame_sniffer (struct frame_info *next_frame) { CORE_ADDR pc = frame_pc_unwind (next_frame); - if (DEPRECATED_PC_IN_CALL_DUMMY_P () - ? DEPRECATED_PC_IN_CALL_DUMMY (pc, 0, 0) - : pc_in_dummy_frame (pc)) + gdb_assert (DEPRECATED_USE_GENERIC_DUMMY_FRAMES); + if (pc_in_dummy_frame (pc)) return &dummy_frame_unwind; else return NULL; diff --git a/gdb/dummy-frame.h b/gdb/dummy-frame.h index cde9eb7f12f..6d565d1091a 100644 --- a/gdb/dummy-frame.h +++ b/gdb/dummy-frame.h @@ -50,31 +50,6 @@ struct frame_id; extern const struct frame_unwind *dummy_frame_sniffer (struct frame_info *next_frame); -/* Does the PC fall in a dummy frame? - - This function is used by "frame.c" when creating a new `struct - frame_info'. - - Note that there is also very similar code in breakpoint.c (where - the bpstat stop reason is computed). It is looking for a PC - falling on a dummy_frame breakpoint. Perhaphs this, and that code - should be combined? - - Architecture dependant code, that has access to a frame, should not - use this function. Instead (get_frame_type() == DUMMY_FRAME) - should be used. - - Hmm, but what about threads? When the dummy-frame code tries to - relocate a dummy frame's saved registers it definitly needs to - differentiate between threads (otherwize it will do things like - clean-up the wrong threads frames). However, when just trying to - identify a dummy-frame that shouldn't matter. The wost that can - happen is that a thread is marked as sitting in a dummy frame when, - in reality, its corrupted its stack, to the point that a PC is - pointing into a dummy frame. */ - -extern int pc_in_dummy_frame (CORE_ADDR pc); - /* Return the regcache that belongs to the dummy-frame identifed by PC and FP, or NULL if no such frame exists. */ /* FIXME: cagney/2002-11-08: The function only exists because of diff --git a/gdb/frame.c b/gdb/frame.c index 7df7c43e296..e5f41689f3b 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1154,12 +1154,8 @@ deprecated_generic_get_saved_register (char *raw_buffer, int *optimized, static enum frame_type frame_type_from_pc (CORE_ADDR pc) { - /* FIXME: cagney/2002-11-24: Can't yet directly call - pc_in_dummy_frame() as some architectures don't set - PC_IN_CALL_DUMMY() to generic_pc_in_call_dummy() (remember the - latter is implemented by simply calling pc_in_dummy_frame). */ if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES - && DEPRECATED_PC_IN_CALL_DUMMY (pc, 0, 0)) + && deprecated_pc_in_call_dummy (pc, 0, 0)) return DUMMY_FRAME; else { @@ -1688,9 +1684,7 @@ legacy_get_prev_frame (struct frame_info *this_frame) initialization, as seen in create_new_frame(), should occur before the INIT function has been called. */ if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES - && (DEPRECATED_PC_IN_CALL_DUMMY_P () - ? DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (prev), 0, 0) - : pc_in_dummy_frame (get_frame_pc (prev)))) + && deprecated_pc_in_call_dummy (get_frame_pc (prev), 0, 0)) prev->type = DUMMY_FRAME; else { diff --git a/gdb/frame.h b/gdb/frame.h index 0cdae6d31dc..8d7ff1a88b4 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -568,8 +568,8 @@ extern void generic_push_dummy_frame (void); extern void generic_pop_current_frame (void (*)(struct frame_info *)); extern void generic_pop_dummy_frame (void); -extern int generic_pc_in_call_dummy (CORE_ADDR pc, - CORE_ADDR sp, CORE_ADDR fp); +extern int deprecated_pc_in_call_dummy (CORE_ADDR pc, CORE_ADDR sp, + CORE_ADDR fp); /* NOTE: cagney/2002-06-26: Targets should no longer use this function. Instead, the contents of a dummy frames registers can be diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 79279251446..46dc08fa5dd 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -347,7 +347,7 @@ struct gdbarch startup_gdbarch = 0, /* cannot_fetch_register */ 0, /* cannot_store_register */ 0, /* get_longjmp_target */ - generic_pc_in_call_dummy, /* deprecated_pc_in_call_dummy */ + deprecated_pc_in_call_dummy, /* deprecated_pc_in_call_dummy */ 0, /* deprecated_init_frame_pc_first */ 0, /* deprecated_init_frame_pc */ 0, /* believe_pcc_promotion */ @@ -499,7 +499,7 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->register_sim_regno = legacy_register_sim_regno; current_gdbarch->cannot_fetch_register = cannot_register_not; current_gdbarch->cannot_store_register = cannot_register_not; - current_gdbarch->deprecated_pc_in_call_dummy = generic_pc_in_call_dummy; + current_gdbarch->deprecated_pc_in_call_dummy = deprecated_pc_in_call_dummy; current_gdbarch->convert_register_p = legacy_convert_register_p; current_gdbarch->register_to_value = legacy_register_to_value; current_gdbarch->value_to_register = legacy_value_to_register; @@ -3767,7 +3767,7 @@ int gdbarch_deprecated_pc_in_call_dummy_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - return gdbarch->deprecated_pc_in_call_dummy != generic_pc_in_call_dummy; + return gdbarch->deprecated_pc_in_call_dummy != deprecated_pc_in_call_dummy; } int @@ -3775,7 +3775,7 @@ gdbarch_deprecated_pc_in_call_dummy (struct gdbarch *gdbarch, CORE_ADDR pc, CORE { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->deprecated_pc_in_call_dummy != NULL); - /* Do not check predicate: gdbarch->deprecated_pc_in_call_dummy != generic_pc_in_call_dummy, allow call. */ + /* Do not check predicate: gdbarch->deprecated_pc_in_call_dummy != deprecated_pc_in_call_dummy, allow call. */ if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_pc_in_call_dummy called\n"); return gdbarch->deprecated_pc_in_call_dummy (pc, sp, frame_address); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index f5d6b056917..cde55710d23 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -562,7 +562,7 @@ F:2:GET_LONGJMP_TARGET:int:get_longjmp_target:CORE_ADDR *pc:pc # is false, the corresponding function works. This simplifies the # migration process - old code, calling DEPRECATED_PC_IN_CALL_DUMMY(), # doesn't need to be modified. -F::DEPRECATED_PC_IN_CALL_DUMMY:int:deprecated_pc_in_call_dummy:CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address:pc, sp, frame_address::generic_pc_in_call_dummy:generic_pc_in_call_dummy +F::DEPRECATED_PC_IN_CALL_DUMMY:int:deprecated_pc_in_call_dummy:CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address:pc, sp, frame_address::deprecated_pc_in_call_dummy:deprecated_pc_in_call_dummy F:2:DEPRECATED_INIT_FRAME_PC_FIRST:CORE_ADDR:deprecated_init_frame_pc_first:int fromleaf, struct frame_info *prev:fromleaf, prev F:2:DEPRECATED_INIT_FRAME_PC:CORE_ADDR:deprecated_init_frame_pc:int fromleaf, struct frame_info *prev:fromleaf, prev # diff --git a/gdb/inferior.h b/gdb/inferior.h index 115ffe1e3d8..ab5a25bfc86 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -454,10 +454,10 @@ extern int attach_flag; /* Are we in a call dummy? */ -/* NOTE: cagney/2002-11-24: Targets need to both switch to generic - dummy frames, and use generic_pc_in_call_dummy(). The generic - version should be able to handle all cases since that code works by - saving the address of the dummy's breakpoint (where ever it is). */ +/* NOTE: cagney/2002-11-24 cagney/2004-03-22: Targets need to both + switch to generic dummy frames. The generic version should be able + to handle all cases since that code works by saving the address of + the dummy's breakpoint (where ever it is). */ extern int deprecated_pc_in_call_dummy_on_stack (CORE_ADDR pc, CORE_ADDR sp, -- 2.30.2