From ff65ac781b9d55627fc98749494d52cae79f148d Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sun, 1 Aug 2004 23:13:41 +0000 Subject: [PATCH] 2004-08-01 Andrew Cagney * frame.h (deprecated_pop_dummy_frame) (deprecated_read_register_dummy) (deprecated_generic_find_dummy_frame): Delete. * dummy-frame.c (deprecated_generic_find_dummy_frame) (deprecated_read_register_dummy) (deprecated_find_dummy_frame_regcache) (discard_innermost_dummy) (deprecated_pop_dummy_frame): Delete. (dummy_frame_this_id): Simplify. (struct dummy_frame): Delete "fp" and "sp". (find_dummy_frame): Simplify. (generic_push_dummy_frame): Do not set "fp" or "sp". (fprint_dummy_frames): Do not print "fp" and "sp" --- gdb/ChangeLog | 16 ++++++ gdb/dummy-frame.c | 152 ++++++------------------------------------------------ gdb/frame.h | 12 ----- 3 files changed, 33 insertions(+), 147 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c375e24..9039dfc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,19 @@ +2004-08-01 Andrew Cagney + + * frame.h (deprecated_pop_dummy_frame) + (deprecated_read_register_dummy) + (deprecated_generic_find_dummy_frame): Delete. + * dummy-frame.c (deprecated_generic_find_dummy_frame) + (deprecated_read_register_dummy) + (deprecated_find_dummy_frame_regcache) + (discard_innermost_dummy) + (deprecated_pop_dummy_frame): Delete. + (dummy_frame_this_id): Simplify. + (struct dummy_frame): Delete "fp" and "sp". + (find_dummy_frame): Simplify. + (generic_push_dummy_frame): Do not set "fp" or "sp". + (fprint_dummy_frames): Do not print "fp" and "sp" + 2004-08-01 Mark Kettenis * i386-tdep.c (I386_MAX_INSN_LEN): New define. diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c index bc9fc6a..635c835 100644 --- a/gdb/dummy-frame.c +++ b/gdb/dummy-frame.c @@ -49,8 +49,6 @@ struct dummy_frame /* These values belong to the caller (the previous frame, the frame that this unwinds back to). */ CORE_ADDR pc; - CORE_ADDR fp; - CORE_ADDR sp; CORE_ADDR top; struct frame_id id; struct regcache *regcache; @@ -83,28 +81,11 @@ find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp) if (!(pc >= dummyframe->call_lo && pc < dummyframe->call_hi)) continue; /* Does the FP match? */ - if (dummyframe->top != 0) - { - /* If the target architecture explicitly saved the - top-of-stack before the inferior function call, assume - that that same architecture will always pass in an FP - (frame base) value that eactly matches that saved TOS. - Don't check the saved SP and SP as they can lead to false - hits. */ - if (fp != dummyframe->top) - continue; - } - else - { - /* An older target that hasn't explicitly or implicitly - saved the dummy frame's top-of-stack. Try matching the - FP against the saved SP and FP. NOTE: If you're trying - to fix a problem with GDB not correctly finding a dummy - frame, check the comments that go with FRAME_ALIGN() and - UNWIND_DUMMY_ID(). */ - if (fp != dummyframe->fp && fp != dummyframe->sp) - continue; - } + /* "infcall.c" explicitly saved the top-of-stack before the + inferior function call, assume unwind_dummy_id() returns that + same stack value. */ + if (fp != dummyframe->top) + continue; /* The FP matches this dummy frame. */ return dummyframe; } @@ -112,25 +93,6 @@ find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp) return NULL; } -static struct regcache * -deprecated_find_dummy_frame_regcache (CORE_ADDR pc, CORE_ADDR fp) -{ - struct dummy_frame *dummy = find_dummy_frame (pc, fp); - if (dummy != NULL) - return dummy->regcache; - else - return NULL; -} - -char * -deprecated_generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp) -{ - struct regcache *regcache = deprecated_find_dummy_frame_regcache (pc, fp); - if (regcache == NULL) - return NULL; - return deprecated_grub_regcache_for_registers (regcache); -} - /* Function: pc_in_call_dummy (pc) Return true if the PC falls in a dummy frame created by gdb for an @@ -168,33 +130,6 @@ pc_in_dummy_frame (CORE_ADDR pc) return 0; } -/* Function: read_register_dummy - Find a saved register from before GDB calls a function in the inferior */ - -CORE_ADDR -deprecated_read_register_dummy (CORE_ADDR pc, CORE_ADDR fp, int regno) -{ - struct regcache *dummy_regs = deprecated_find_dummy_frame_regcache (pc, fp); - - if (dummy_regs) - { - /* NOTE: cagney/2002-08-12: Replaced a call to - regcache_raw_read_as_address() with a call to - regcache_cooked_read_unsigned(). The old, ...as_address - function was eventually calling extract_unsigned_integer (nee - extract_address) to unpack the registers value. The below is - doing an unsigned extract so that it is functionally - equivalent. The read needs to be cooked as, otherwise, it - will never correctly return the value of a register in the - [NUM_REGS .. NUM_REGS+NUM_PSEUDO_REGS) range. */ - ULONGEST val; - regcache_cooked_read_unsigned (dummy_regs, regno, &val); - return val; - } - else - return 0; -} - /* Save all the registers on the dummy frame stack. Most ports save the registers on the target stack. This results in lots of unnecessary memory references, which are slow when debugging via a serial line. Instead, we @@ -214,7 +149,8 @@ generic_push_dummy_frame (void) dummy_frame = dummy_frame_stack; while (dummy_frame) - if (INNER_THAN (dummy_frame->fp, fp)) /* stale -- destroy! */ + if (gdbarch_inner_than (current_gdbarch, dummy_frame->top, fp)) + /* stale -- destroy! */ { dummy_frame_stack = dummy_frame->next; regcache_xfree (dummy_frame->regcache); @@ -228,9 +164,7 @@ generic_push_dummy_frame (void) dummy_frame->regcache = regcache_xmalloc (current_gdbarch); dummy_frame->pc = read_pc (); - dummy_frame->sp = read_sp (); dummy_frame->top = 0; - dummy_frame->fp = fp; dummy_frame->id = get_frame_id (get_current_frame ()); regcache_cpy (dummy_frame->regcache, current_regcache); dummy_frame->next = dummy_frame_stack; @@ -252,34 +186,6 @@ generic_save_call_dummy_addr (CORE_ADDR lo, CORE_ADDR hi) dummy_frame_stack->call_hi = hi; } -/* Discard the innermost dummy frame from the dummy frame stack - (passed in as a parameter). */ - -static void -discard_innermost_dummy (struct dummy_frame **stack) -{ - struct dummy_frame *tbd = (*stack); - (*stack) = (*stack)->next; - regcache_xfree (tbd->regcache); - xfree (tbd); -} - -void -deprecated_pop_dummy_frame (void) -{ - struct dummy_frame *dummy_frame = dummy_frame_stack; - - /* FIXME: what if the first frame isn't the right one, eg.. - because one call-by-hand function has done a longjmp into another one? */ - - if (!dummy_frame) - error ("Can't pop dummy frame!"); - regcache_cpy (current_regcache, dummy_frame->regcache); - flush_cached_frames (); - - discard_innermost_dummy (&dummy_frame_stack); -} - /* Given a call-dummy dummy-frame, return the registers. Here the register value is taken from the local copy of the register buffer. */ @@ -337,38 +243,16 @@ dummy_frame_this_id (struct frame_info *next_frame, /* When unwinding a normal frame, the stack structure is determined by analyzing the frame's function's code (be it using brute force prologue analysis, or the dwarf2 CFI). In the case of a dummy - frame, that simply isn't possible. The The PC is either the - program entry point, or some random address on the stack. Trying - to use that PC to apply standard frame ID unwind techniques is - just asking for trouble. */ - if (gdbarch_unwind_dummy_id_p (current_gdbarch)) - { - /* Use an architecture specific method to extract the prev's - dummy ID from the next frame. Note that this method uses - frame_register_unwind to obtain the register values needed to - determine the dummy frame's ID. */ - (*this_id) = gdbarch_unwind_dummy_id (current_gdbarch, next_frame); - } - else if (get_frame_type (next_frame) == SENTINEL_FRAME) - { - /* We're unwinding a sentinel frame, the PC of which is pointing - at a stack dummy. Fake up the dummy frame's ID using the - same sequence as is found a traditional unwinder. Once all - architectures supply the unwind_dummy_id method, this code - can go away. */ - (*this_id) = frame_id_build (deprecated_read_fp (), read_pc ()); - } - else - { - /* Ouch! We're not trying to find the innermost frame's ID yet - we're trying to unwind to a dummy. The architecture must - provide the unwind_dummy_id() method. Abandon the unwind - process but only after first warning the user. */ - internal_warning (__FILE__, __LINE__, - "Missing unwind_dummy_id architecture method"); - (*this_id) = null_frame_id; - return; - } + frame, that simply isn't possible. The PC is either the program + entry point, or some random address on the stack. Trying to use + that PC to apply standard frame ID unwind techniques is just + asking for trouble. */ + /* Use an architecture specific method to extract the prev's dummy + ID from the next frame. Note that this method uses + frame_register_unwind to obtain the register values needed to + determine the dummy frame's ID. */ + gdb_assert (gdbarch_unwind_dummy_id_p (current_gdbarch)); + (*this_id) = gdbarch_unwind_dummy_id (current_gdbarch, next_frame); (*this_prologue_cache) = find_dummy_frame ((*this_id).code_addr, (*this_id).stack_addr); } @@ -399,8 +283,6 @@ fprint_dummy_frames (struct ui_file *file) gdb_print_host_address (s, file); fprintf_unfiltered (file, ":"); fprintf_unfiltered (file, " pc=0x%s", paddr (s->pc)); - fprintf_unfiltered (file, " fp=0x%s", paddr (s->fp)); - fprintf_unfiltered (file, " sp=0x%s", paddr (s->sp)); fprintf_unfiltered (file, " top=0x%s", paddr (s->top)); fprintf_unfiltered (file, " id="); fprint_frame_id (file, s->id); diff --git a/gdb/frame.h b/gdb/frame.h index adb6e9d..347b27a 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -572,22 +572,10 @@ extern void print_frame_info (struct frame_info *, int print_level, extern struct frame_info *block_innermost_frame (struct block *); -/* NOTE: cagney/2002-09-13: There is no need for this function. */ -extern CORE_ADDR deprecated_read_register_dummy (CORE_ADDR pc, - CORE_ADDR fp, int); extern void generic_push_dummy_frame (void); -extern void deprecated_pop_dummy_frame (void); extern int deprecated_pc_in_call_dummy (CORE_ADDR pc); -/* NOTE: cagney/2002-06-26: Targets should no longer use this - function. Instead, the contents of a dummy frame register can be - obtained by applying: frame_register_unwind to the dummy frame; or - frame_register_unwind() to the next outer frame. */ - -extern char *deprecated_generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp); - - extern void generic_save_call_dummy_addr (CORE_ADDR lo, CORE_ADDR hi); /* FIXME: cagney/2003-02-02: Should be deprecated or replaced with a -- 2.7.4