aboutsummaryrefslogtreecommitdiff
path: root/gdb/frame.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2004-11-09 01:16:42 +0000
committerAndrew Cagney <cagney@redhat.com>2004-11-09 01:16:42 +0000
commitcbafadeb88b139e212f4e453a8f93304c813b2df (patch)
tree39958aeb28a32b2b09ed71a4eabe0c968b27fc81 /gdb/frame.c
parenta77a9021ea85cf83d077a32391e682c6320adc88 (diff)
downloadbinutils-cbafadeb88b139e212f4e453a8f93304c813b2df.zip
binutils-cbafadeb88b139e212f4e453a8f93304c813b2df.tar.gz
binutils-cbafadeb88b139e212f4e453a8f93304c813b2df.tar.bz2
2004-11-08 Andrew Cagney <cagney@gnu.org>
* sentinel-frame.c (sentinel_frame_prev_pc): New function. (sentinel_frame_unwinder): Add the prev_pc method. * frame.c (frame_pc_unwind): Use the per-frame pc unwinder when available. Do not handle the sentinel-frame case. * frame-unwind.h (frame_prev_register_ftype): Define. (struct frame_unwind): Add prev_pc;
Diffstat (limited to 'gdb/frame.c')
-rw-r--r--gdb/frame.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/gdb/frame.c b/gdb/frame.c
index d9de0e6..61a9520 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -390,7 +390,15 @@ frame_pc_unwind (struct frame_info *this_frame)
if (!this_frame->prev_pc.p)
{
CORE_ADDR pc;
- if (gdbarch_unwind_pc_p (current_gdbarch))
+ if (this_frame->unwind == NULL)
+ this_frame->unwind
+ = frame_unwind_find_by_frame (this_frame->next,
+ &this_frame->prologue_cache);
+ if (this_frame->unwind->prev_pc != NULL)
+ /* A per-frame unwinder, prefer it. */
+ pc = this_frame->unwind->prev_pc (this_frame->next,
+ &this_frame->prologue_cache);
+ else if (gdbarch_unwind_pc_p (current_gdbarch))
{
/* The right way. The `pure' way. The one true way. This
method depends solely on the register-unwind code to
@@ -410,17 +418,8 @@ frame_pc_unwind (struct frame_info *this_frame)
different ways that a PC could be unwound. */
pc = gdbarch_unwind_pc (current_gdbarch, this_frame);
}
- else if (this_frame->level < 0)
- {
- /* FIXME: cagney/2003-03-06: Old code and a sentinel
- frame. Do like was always done. Fetch the PC's value
- directly from the global registers array (via read_pc).
- This assumes that this frame belongs to the current
- global register cache. The assumption is dangerous. */
- pc = read_pc ();
- }
else
- internal_error (__FILE__, __LINE__, "No gdbarch_unwind_pc method");
+ internal_error (__FILE__, __LINE__, "No unwind_pc method");
this_frame->prev_pc.value = pc;
this_frame->prev_pc.p = 1;
if (frame_debug)