summaryrefslogtreecommitdiff
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
commita95504160dbb45d1716497659cf76d620ee8cebb (patch)
tree9a9ddbba3df7283bf65e285eecb060734686649c /gdb/frame.c
parent40f0e33f2c5577f6eac7fbbcbca602dd1bcf91d7 (diff)
downloadgdb-a95504160dbb45d1716497659cf76d620ee8cebb.tar.gz
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 23fb5b17f62..1e364bdcb78 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)
{