From 876d71d0a2b35bef7f21563d687cdbfd89a2292f Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Tue, 11 Mar 2003 23:00:26 +0000 Subject: 2003-03-11 Andrew Cagney * frame-unwind.h (frame_this_id_ftype): Rename frame_unwind_id_ftype. (frame_prev_register_ftype): Rename frame_unwind_reg_ftype. (struct frame_unwind): Update. Rename "id" to "this_id", and "reg" to "prev_register". * frame.c (get_prev_frame): Update. Rename parameter next_frame to this frame. (frame_register_unwind): Update. --- gdb/ChangeLog | 11 ++++++++++ gdb/frame-unwind.h | 24 ++++++++++----------- gdb/frame.c | 61 +++++++++++++++++++++++++++--------------------------- 3 files changed, 54 insertions(+), 42 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8a1224fb71b..4edb58e8c48 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2003-03-11 Andrew Cagney + + * frame-unwind.h (frame_this_id_ftype): Rename + frame_unwind_id_ftype. + (frame_prev_register_ftype): Rename frame_unwind_reg_ftype. + (struct frame_unwind): Update. Rename "id" to "this_id", and + "reg" to "prev_register". + * frame.c (get_prev_frame): Update. Rename parameter next_frame + to this frame. + (frame_register_unwind): Update. + 2003-03-10 Andrew Cagney * frame.c (frame_pop): Merge with mainline diff --git a/gdb/frame-unwind.h b/gdb/frame-unwind.h index 3efe1e26f47..74fa0f6c519 100644 --- a/gdb/frame-unwind.h +++ b/gdb/frame-unwind.h @@ -72,9 +72,9 @@ extern const struct frame_unwind *frame_unwind_find_by_pc (struct gdbarch other unwind methods. Memory for that cache should be allocated using frame_obstack_zalloc(). */ -typedef void (frame_unwind_id_ftype) (struct frame_info *next_frame, - void **this_cache, - struct frame_id *this_id); +typedef void (frame_this_id_ftype) (struct frame_info *next_frame, + void **this_cache, + struct frame_id *this_id); /* Assuming the frame chain: (outer) prev <-> this <-> next (inner); use the NEXT frame, and its register unwind method, to unwind THIS @@ -94,21 +94,21 @@ typedef void (frame_unwind_id_ftype) (struct frame_info *next_frame, other unwind methods. Memory for that cache should be allocated using frame_obstack_zalloc(). */ -typedef void (frame_unwind_reg_ftype) (struct frame_info *next_frame, - void **this_cache, - int prev_regnum, - int *optimized, - enum lval_type * lvalp, - CORE_ADDR *addrp, - int *realnump, void *valuep); +typedef void (frame_prev_register_ftype) (struct frame_info *next_frame, + void **this_cache, + int prev_regnum, + int *optimized, + enum lval_type * lvalp, + CORE_ADDR *addrp, + int *realnump, void *valuep); struct frame_unwind { /* Should the frame's type go here? */ /* Should an attribute indicating the frame's address-in-block go here? */ - frame_unwind_id_ftype *id; - frame_unwind_reg_ftype *reg; + frame_this_id_ftype *this_id; + frame_prev_register_ftype *prev_register; }; #endif diff --git a/gdb/frame.c b/gdb/frame.c index b891463c685..866a0c4a9cd 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -249,9 +249,10 @@ frame_register_unwind (struct frame_info *this_frame, int prev_regnum, /* Ask this frame's register unwinder to return the value of PREV_REGNUM using register values unwound from the NEXT frame. */ - this_frame->unwind->reg (this_frame->next, &this_frame->unwind_cache, - prev_regnum, optimizedp, lvalp, addrp, realnump, - bufferp); + this_frame->unwind->prev_register (this_frame->next, + &this_frame->unwind_cache, + prev_regnum, optimizedp, lvalp, addrp, + realnump, bufferp); } void @@ -1220,7 +1221,7 @@ legacy_get_prev_frame (struct frame_info *next_frame) if there is no such frame. */ struct frame_info * -get_prev_frame (struct frame_info *next_frame) +get_prev_frame (struct frame_info *this_frame) { struct frame_info *prev_frame; @@ -1242,7 +1243,7 @@ get_prev_frame (struct frame_info *next_frame) that a frame isn't possible, rather than checking that the target has state and then calling get_current_frame() and get_prev_frame(). This is a guess mind. */ - if (next_frame == NULL) + if (this_frame == NULL) { /* NOTE: cagney/2002-11-09: There was a code segment here that would error out when CURRENT_FRAME was NULL. The comment @@ -1255,18 +1256,18 @@ get_prev_frame (struct frame_info *next_frame) thing to do.'' Per the above, this code shouldn't even be called with a NULL - NEXT_FRAME. */ + THIS_FRAME. */ return current_frame; } /* There is always a frame. If this assertion fails, suspect that something should be calling get_selected_frame() or get_current_frame(). */ - gdb_assert (next_frame != NULL); + gdb_assert (this_frame != NULL); - if (next_frame->level >= 0 + if (this_frame->level >= 0 && !backtrace_below_main - && inside_main_func (get_frame_pc (next_frame))) + && inside_main_func (get_frame_pc (this_frame))) /* Don't unwind past main(), bug always unwind the sentinel frame. Note, this is done _before_ the frame has been marked as previously unwound. That way if the user later decides to @@ -1279,9 +1280,9 @@ get_prev_frame (struct frame_info *next_frame) } /* Only try to do the unwind once. */ - if (next_frame->prev_p) - return next_frame->prev; - next_frame->prev_p = 1; + if (this_frame->prev_p) + return this_frame->prev; + this_frame->prev_p = 1; /* If we're inside the entry file, it isn't valid. Don't apply this test to a dummy frame - dummy frame PC's typically land in the @@ -1294,8 +1295,8 @@ get_prev_frame (struct frame_info *next_frame) /* NOTE: cagney/2003-01-10: If there is a way of disabling this test then it should probably be moved to before the ->prev_p test, above. */ - if (next_frame->type != DUMMY_FRAME && next_frame->level >= 0 - && inside_entry_file (get_frame_pc (next_frame))) + if (this_frame->type != DUMMY_FRAME && this_frame->level >= 0 + && inside_entry_file (get_frame_pc (this_frame))) { if (frame_debug) fprintf_unfiltered (gdb_stdlog, @@ -1311,8 +1312,8 @@ get_prev_frame (struct frame_info *next_frame) /* NOTE: cagney/2003-02-25: Don't enable until someone has found hard evidence that this is needed. */ if (0 - && next_frame->type != DUMMY_FRAME && next_frame->level >= 0 - && inside_entry_func (get_frame_pc (next_frame))) + && this_frame->type != DUMMY_FRAME && this_frame->level >= 0 + && inside_entry_func (get_frame_pc (this_frame))) { if (frame_debug) fprintf_unfiltered (gdb_stdlog, @@ -1328,9 +1329,9 @@ get_prev_frame (struct frame_info *next_frame) || DEPRECATED_INIT_FRAME_PC_FIRST_P () || DEPRECATED_INIT_EXTRA_FRAME_INFO_P () || FRAME_CHAIN_P ()) - && next_frame->level >= 0) + && this_frame->level >= 0) { - prev_frame = legacy_get_prev_frame (next_frame); + prev_frame = legacy_get_prev_frame (this_frame); if (frame_debug && prev_frame == NULL) fprintf_unfiltered (gdb_stdlog, "Outermost frame - legacy_get_prev_frame NULL.\n"); @@ -1348,7 +1349,7 @@ get_prev_frame (struct frame_info *next_frame) been here before' check above will stop repeated memory allocation calls. */ prev_frame = FRAME_OBSTACK_ZALLOC (struct frame_info); - prev_frame->level = next_frame->level + 1; + prev_frame->level = this_frame->level + 1; /* Try to unwind the PC. If that doesn't work, assume we've reached the oldest frame and simply return. Is there a better sentinal @@ -1358,16 +1359,16 @@ get_prev_frame (struct frame_info *next_frame) Note that the pc-unwind is intentionally performed before the frame chain. This is ok since, for old targets, both frame_pc_unwind (nee, FRAME_SAVED_PC) and FRAME_CHAIN()) assume - NEXT_FRAME's data structures have already been initialized (using + THIS_FRAME's data structures have already been initialized (using DEPRECATED_INIT_EXTRA_FRAME_INFO) and hence the call order doesn't matter. By unwinding the PC first, it becomes possible to, in the case of a dummy frame, avoid also unwinding the frame ID. This is because (well ignoring the PPC) a dummy frame can be located - using NEXT_FRAME's frame ID. */ + using THIS_FRAME's frame ID. */ - prev_frame->pc = frame_pc_unwind (next_frame); + prev_frame->pc = frame_pc_unwind (this_frame); if (prev_frame->pc == 0) { /* The allocated PREV_FRAME will be reclaimed when the frame @@ -1406,9 +1407,9 @@ get_prev_frame (struct frame_info *next_frame) frame_register_unwind to obtain the register values needed to determine the dummy frame's ID. */ prev_frame->id = gdbarch_unwind_dummy_id (current_gdbarch, - next_frame); + this_frame); } - else if (next_frame->level < 0) + else if (this_frame->level < 0) { /* We're unwinding a sentinel frame, the PC of which is pointing at a stack dummy. Fake up the dummy frame's ID @@ -1431,8 +1432,8 @@ get_prev_frame (struct frame_info *next_frame) break; case NORMAL_FRAME: case SIGTRAMP_FRAME: - prev_frame->unwind->id (next_frame, &prev_frame->unwind_cache, - &prev_frame->id); + prev_frame->unwind->this_id (this_frame, &prev_frame->unwind_cache, + &prev_frame->id); /* Check that the unwound ID is valid. */ if (!frame_id_p (prev_frame->id)) { @@ -1449,8 +1450,8 @@ get_prev_frame (struct frame_info *next_frame) sentinel frame's frame ID to a `sentinel'. Leave it until after the switch to storing the frame ID, instead of the frame base, in the frame object. */ - if (next_frame->level >= 0 - && frame_id_inner (prev_frame->id, get_frame_id (next_frame))) + if (this_frame->level >= 0 + && frame_id_inner (prev_frame->id, get_frame_id (this_frame))) error ("Unwound frame inner-to selected frame (corrupt stack?)"); /* Note that, due to frameless functions, the stronger test of the new frame being outer to the old frame can't be used - @@ -1467,8 +1468,8 @@ get_prev_frame (struct frame_info *next_frame) prev_frame->frame = prev_frame->id.base; /* Link it in. */ - next_frame->prev = prev_frame; - prev_frame->next = next_frame; + this_frame->prev = prev_frame; + prev_frame->next = this_frame; /* FIXME: cagney/2002-01-19: This call will go away. Instead of initializing extra info, all frames will use the frame_cache -- cgit v1.2.1