diff options
author | Daniel Jacobowitz <drow@false.org> | 2009-06-28 00:05:14 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2009-06-28 00:05:14 +0000 |
commit | c7ce8faacb57cd10f919caff6c5018c4526e752e (patch) | |
tree | 7faa96895297e983653ca7d7a842608504c71631 | |
parent | cd953ae9d0650069424e9a5e8652f3c77d02574b (diff) | |
download | gdb-c7ce8faacb57cd10f919caff6c5018c4526e752e.zip gdb-c7ce8faacb57cd10f919caff6c5018c4526e752e.tar.gz gdb-c7ce8faacb57cd10f919caff6c5018c4526e752e.tar.bz2 |
* frame.c (frame_unwind_id): Renamed to ...
(frame_unwind_caller_id): ... this. All callers updated.
(frame_pc_unwind): Renamed to ...
(frame_unwind_caller_pc): ... this. All callers updated.
* frame.h: Document frame_unwind_caller_WHAT functions.
(frame_unwind_id): Renamed to ...
(frame_unwind_caller_id): ... this.
(frame_pc_unwind): Renamed to ...
(frame_unwind_caller_pc): ... this.
* hppa-tdep.c (hppa_find_unwind_entry_in_block): Correct comment.
* stack.c (parse_frame_specification_1): Do not rely on
frame_unwind_id.
-rw-r--r-- | gdb/ChangeLog | 15 | ||||
-rw-r--r-- | gdb/frame.c | 8 | ||||
-rw-r--r-- | gdb/frame.h | 9 | ||||
-rw-r--r-- | gdb/glibc-tdep.c | 2 | ||||
-rw-r--r-- | gdb/hppa-tdep.c | 2 | ||||
-rw-r--r-- | gdb/infrun.c | 14 | ||||
-rw-r--r-- | gdb/mips-linux-tdep.c | 4 | ||||
-rw-r--r-- | gdb/obsd-tdep.c | 2 | ||||
-rw-r--r-- | gdb/sol2-tdep.c | 2 | ||||
-rw-r--r-- | gdb/stack.c | 14 |
10 files changed, 51 insertions, 21 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b1c640b..ad81a37 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,18 @@ +2009-06-27 Daniel Jacobowitz <dan@codesourcery.com> + + * frame.c (frame_unwind_id): Renamed to ... + (frame_unwind_caller_id): ... this. All callers updated. + (frame_pc_unwind): Renamed to ... + (frame_unwind_caller_pc): ... this. All callers updated. + * frame.h: Document frame_unwind_caller_WHAT functions. + (frame_unwind_id): Renamed to ... + (frame_unwind_caller_id): ... this. + (frame_pc_unwind): Renamed to ... + (frame_unwind_caller_pc): ... this. + * hppa-tdep.c (hppa_find_unwind_entry_in_block): Correct comment. + * stack.c (parse_frame_specification_1): Do not rely on + frame_unwind_id. + 2009-06-27 Michael Snyder <msnyder@vmware.com> * infrun.c (handle_inferior_event): Improve handling of diff --git a/gdb/frame.c b/gdb/frame.c index 44a9c65..74671a4 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -271,7 +271,7 @@ get_frame_id (struct frame_info *fi) } struct frame_id -frame_unwind_id (struct frame_info *next_frame) +frame_unwind_caller_id (struct frame_info *next_frame) { /* Use prev_frame, and not get_prev_frame. The latter will truncate the frame chain, leading to this function unintentionally @@ -460,7 +460,7 @@ frame_find_by_id (struct frame_id id) } CORE_ADDR -frame_pc_unwind (struct frame_info *this_frame) +frame_unwind_caller_pc (struct frame_info *this_frame) { if (!this_frame->prev_pc.p) { @@ -491,7 +491,7 @@ frame_pc_unwind (struct frame_info *this_frame) this_frame->prev_pc.p = 1; if (frame_debug) fprintf_unfiltered (gdb_stdlog, - "{ frame_pc_unwind (this_frame=%d) -> 0x%s }\n", + "{ frame_unwind_caller_pc (this_frame=%d) -> 0x%s }\n", this_frame->level, paddr_nz (this_frame->prev_pc.value)); } @@ -1564,7 +1564,7 @@ CORE_ADDR get_frame_pc (struct frame_info *frame) { gdb_assert (frame->next != NULL); - return frame_pc_unwind (frame->next); + return frame_unwind_caller_pc (frame->next); } /* Return an address that falls within THIS_FRAME's code block. */ diff --git a/gdb/frame.h b/gdb/frame.h index 18a62a1..255e392 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -34,6 +34,11 @@ frame_unwind_WHAT...(): Unwind THIS frame's WHAT from the NEXT frame. + frame_unwind_caller_WHAT...(): Unwind WHAT for NEXT stack frame's + real caller. Any inlined functions in NEXT's stack frame are + skipped. Use these to ignore any potentially inlined functions, + e.g. inlined into the first instruction of a library trampoline. + put_frame_WHAT...(): Put a value into this frame (unsafe, need to invalidate the frame / regcache afterwards) (better name more strongly hinting at its unsafeness) @@ -345,7 +350,7 @@ extern CORE_ADDR get_frame_base (struct frame_info *); instead, since that avoids the bug. */ extern struct frame_id get_frame_id (struct frame_info *fi); -extern struct frame_id frame_unwind_id (struct frame_info *next_frame); +extern struct frame_id frame_unwind_caller_id (struct frame_info *next_frame); /* Assuming that a frame is `normal', return its base-address, or 0 if the information isn't available. NOTE: This address is really only @@ -489,7 +494,7 @@ extern void put_frame_register_bytes (struct frame_info *frame, int regnum, calling frame. For GDB, `pc' is the resume address and not a specific register. */ -extern CORE_ADDR frame_pc_unwind (struct frame_info *frame); +extern CORE_ADDR frame_unwind_caller_pc (struct frame_info *frame); /* Discard the specified frame. Restoring the registers to the state of the caller. */ diff --git a/gdb/glibc-tdep.c b/gdb/glibc-tdep.c index d0f822a..135a15e 100644 --- a/gdb/glibc-tdep.c +++ b/gdb/glibc-tdep.c @@ -97,7 +97,7 @@ glibc_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) fixup = lookup_minimal_symbol ("fixup", NULL, objfile); if (fixup && SYMBOL_VALUE_ADDRESS (fixup) == pc) - return frame_pc_unwind (get_current_frame ()); + return frame_unwind_caller_pc (get_current_frame ()); } return 0; diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 59dec66..c97f30d 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -1799,7 +1799,7 @@ hppa_find_unwind_entry_in_block (struct frame_info *this_frame) /* FIXME drow/20070101: Calling gdbarch_addr_bits_remove on the result of get_frame_address_in_block implies a problem. The bits should have been removed earlier, before the return - value of frame_pc_unwind. That might be happening already; + value of gdbarch_unwind_pc. That might be happening already; if it isn't, it should be fixed. Then this call can be removed. */ pc = gdbarch_addr_bits_remove (get_frame_arch (this_frame), pc); diff --git a/gdb/infrun.c b/gdb/infrun.c index 167252a..5f1b16b 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3729,7 +3729,7 @@ infrun: not switching back to stepped thread, it has vanished\n"); previous frame must have valid frame IDs. */ if (!frame_id_eq (get_frame_id (frame), ecs->event_thread->step_frame_id) - && (frame_id_eq (frame_unwind_id (frame), + && (frame_id_eq (frame_unwind_caller_id (frame), ecs->event_thread->step_frame_id) || execution_direction == EXEC_REVERSE)) { @@ -3928,7 +3928,7 @@ infrun: not switching back to stepped thread, it has vanished\n"); set step-mode) or we no longer know how to get back to the call site. */ if (step_stop_if_no_debug - || !frame_id_p (frame_unwind_id (frame))) + || !frame_id_p (frame_unwind_caller_id (frame))) { /* If we have no line number and the step-stop-if-no-debug is set, we stop the step so that the user has a chance to @@ -4204,7 +4204,7 @@ insert_step_resume_breakpoint_at_frame (struct frame_info *return_frame) This is a separate function rather than reusing insert_step_resume_breakpoint_at_frame in order to avoid get_prev_frame, which may stop prematurely (see the implementation - of frame_unwind_id for an example). */ + of frame_unwind_caller_id for an example). */ static void insert_step_resume_breakpoint_at_caller (struct frame_info *next_frame) @@ -4214,14 +4214,16 @@ insert_step_resume_breakpoint_at_caller (struct frame_info *next_frame) /* We shouldn't have gotten here if we don't know where the call site is. */ - gdb_assert (frame_id_p (frame_unwind_id (next_frame))); + gdb_assert (frame_id_p (frame_unwind_caller_id (next_frame))); init_sal (&sr_sal); /* initialize to zeros */ - sr_sal.pc = gdbarch_addr_bits_remove (gdbarch, frame_pc_unwind (next_frame)); + sr_sal.pc = gdbarch_addr_bits_remove (gdbarch, + frame_unwind_caller_pc (next_frame)); sr_sal.section = find_pc_overlay (sr_sal.pc); - insert_step_resume_breakpoint_at_sal (sr_sal, frame_unwind_id (next_frame)); + insert_step_resume_breakpoint_at_sal (sr_sal, + frame_unwind_caller_id (next_frame)); } /* Insert a "longjmp-resume" breakpoint at PC. This is used to set a diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index 242196a..7f4c1b1 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -702,7 +702,7 @@ mips_linux_skip_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) resolver = lookup_minimal_symbol ("__dl_runtime_resolve", NULL, NULL); if (resolver && SYMBOL_VALUE_ADDRESS (resolver) == pc) - return frame_pc_unwind (get_current_frame ()); + return frame_unwind_caller_pc (get_current_frame ()); return glibc_skip_solib_resolver (gdbarch, pc); } @@ -1117,7 +1117,7 @@ mips_linux_syscall_next_pc (struct frame_info *frame) || v0 == MIPS_NR_rt_sigreturn || v0 == MIPS_NR_N64_rt_sigreturn || v0 == MIPS_NR_N32_rt_sigreturn) - return frame_pc_unwind (get_current_frame ()); + return frame_unwind_caller_pc (get_current_frame ()); return pc + 4; } diff --git a/gdb/obsd-tdep.c b/gdb/obsd-tdep.c index 2d9e7ed..781193d 100644 --- a/gdb/obsd-tdep.c +++ b/gdb/obsd-tdep.c @@ -30,7 +30,7 @@ obsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) msym = lookup_minimal_symbol("_dl_bind", NULL, NULL); if (msym && SYMBOL_VALUE_ADDRESS (msym) == pc) - return frame_pc_unwind (get_current_frame ()); + return frame_unwind_caller_pc (get_current_frame ()); else return find_solib_trampoline_target (get_current_frame (), pc); } diff --git a/gdb/sol2-tdep.c b/gdb/sol2-tdep.c index de9e018..0c80ece 100644 --- a/gdb/sol2-tdep.c +++ b/gdb/sol2-tdep.c @@ -31,7 +31,7 @@ sol2_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) msym = lookup_minimal_symbol("elf_bndr", NULL, NULL); if (msym && SYMBOL_VALUE_ADDRESS (msym) == pc) - return frame_pc_unwind (get_current_frame ()); + return frame_unwind_caller_pc (get_current_frame ()); return 0; } diff --git a/gdb/stack.c b/gdb/stack.c index 3a4cc7f..7d942d6 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -899,8 +899,16 @@ parse_frame_specification_1 (const char *frame_exp, const char *message, { if (frame_id_eq (id, get_frame_id (fid))) { - while (frame_id_eq (id, frame_unwind_id (fid))) - fid = get_prev_frame (fid); + struct frame_info *prev_frame; + + while (1) + { + prev_frame = get_prev_frame (fid); + if (!prev_frame + || !frame_id_eq (id, get_frame_id (prev_frame))) + break; + fid = prev_frame; + } return fid; } } @@ -1022,7 +1030,7 @@ frame_info (char *addr_exp, int from_tty) puts_filtered ("; "); wrap_here (" "); printf_filtered ("saved %s ", pc_regname); - fputs_filtered (paddress (frame_pc_unwind (fi)), gdb_stdout); + fputs_filtered (paddress (frame_unwind_caller_pc (fi)), gdb_stdout); printf_filtered ("\n"); if (calling_frame_info == NULL) |