aboutsummaryrefslogtreecommitdiff
path: root/gdb/frame.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-07-11 14:52:17 +0000
committerAndrew Cagney <cagney@redhat.com>2003-07-11 14:52:17 +0000
commit8edd5d01538ad56dcaf67b8d35bef65748ab62b4 (patch)
treef5f95c0df5404e4f552a84c87b7ee89aeb590f1f /gdb/frame.c
parentc6baf75ed1463f657d61784cf9e5db2c89228482 (diff)
downloadgdb-8edd5d01538ad56dcaf67b8d35bef65748ab62b4.zip
gdb-8edd5d01538ad56dcaf67b8d35bef65748ab62b4.tar.gz
gdb-8edd5d01538ad56dcaf67b8d35bef65748ab62b4.tar.bz2
2003-07-11 Andrew Cagney <cagney@redhat.com>
* frame.h (get_frame_address_in_block): Declare. (frame_unwind_address_in_block): Declare. * frame.c (frame_unwind_address_in_block): New function. (get_frame_address_in_block): New function.
Diffstat (limited to 'gdb/frame.c')
-rw-r--r--gdb/frame.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gdb/frame.c b/gdb/frame.c
index 23fb5b1..1e364bd 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -2006,6 +2006,33 @@ get_frame_pc (struct frame_info *frame)
return frame_pc_unwind (frame->next);
}
+/* Return an address of that falls within the frame's code block. */
+
+CORE_ADDR
+frame_unwind_address_in_block (struct frame_info *next_frame)
+{
+ /* A draft address. */
+ CORE_ADDR pc = frame_pc_unwind (next_frame);
+
+ /* If THIS frame is not inner most (i.e., NEXT isn't the sentinel),
+ and NEXT is `normal' (i.e., not a sigtramp, dummy, ....) THIS
+ frame's PC ends up pointing at the instruction fallowing the
+ "call". Adjust that PC value so that it falls on the call
+ instruction (which, hopefully, falls within THIS frame's code
+ block. So far it's proved to be a very good approximation. See
+ get_frame_type for why ->type can't be used. */
+ if (next_frame->level >= 0
+ && get_frame_type (next_frame) == NORMAL_FRAME)
+ --pc;
+ return pc;
+}
+
+CORE_ADDR
+get_frame_address_in_block (struct frame_info *this_frame)
+{
+ return frame_unwind_address_in_block (this_frame->next);
+}
+
static int
pc_notcurrent (struct frame_info *frame)
{