aboutsummaryrefslogtreecommitdiff
path: root/gdb/frame.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2007-02-27 20:17:19 +0000
committerDaniel Jacobowitz <drow@false.org>2007-02-27 20:17:19 +0000
commit93d42b302eb91d758191675dcaf3bd90323b5224 (patch)
treeeb45d933ae4389284a4e1a14f2d1c564bca3da47 /gdb/frame.c
parent206415a3eac4f69d24cf872f880f554d3d43f1bb (diff)
downloadgdb-93d42b302eb91d758191675dcaf3bd90323b5224.zip
gdb-93d42b302eb91d758191675dcaf3bd90323b5224.tar.gz
gdb-93d42b302eb91d758191675dcaf3bd90323b5224.tar.bz2
* dwarf2-frame.c (dwarf2_frame_cache, dwarf2_frame_this_id)
(dwarf2_frame_sniffer): Update. (dwarf2_signal_frame_this_id): New function. (dwarf2_signal_frame_unwind): Use it. (dwarf2_frame_base_sniffer): Use frame_unwind_address_in_block. * frame.c (frame_func_unwind): Add this_type argument. (get_frame_func): Update. (frame_unwind_address_in_block): Add this_type argument and check it. Fix a typo. (get_frame_address_in_block): Update. * frame.h (enum frame_type): Move higher in the file. (frame_unwind_address_in_block, frame_func_unwind): Add enum frame_type argument. * alpha-mdebug-tdep.c, alpha-tdep.c, amd64-tdep.c, amd64obsd-tdep.c, arm-tdep.c, avr-tdep.c, cris-tdep.c, frv-tdep.c, h8300-tdep.c, hppa-tdep.c, i386-tdep.c, i386obsd-tdep.c, ia64-tdep.c, libunwind-frame.c, m32c-tdep.c, m32r-linux-tdep.c, m32r-tdep.c, m68hc11-tdep.c, m68k-tdep.c, m88k-tdep.c, mips-mdebug-tdep.c, mips-tdep.c, mn10300-tdep.c, mt-tdep.c, rs6000-tdep.c, s390-tdep.c, score-tdep.c, sh-tdep.c, sh64-tdep.c, sparc-tdep.c, sparc64obsd-tdep.c, spu-tdep.c, v850-tdep.c, vax-tdep.c, xstormy16-tdep.c, xtensa-tdep.c: Update calls to frame_func_unwind and frame_unwind_address_in_block to specify the frame type. Use frame_unwind_address_in_block instead of frame_pc_unwind in sniffers. * gdb.arch/i386-signal.c, gdb.arch/i386-signal.exp: New files.
Diffstat (limited to 'gdb/frame.c')
-rw-r--r--gdb/frame.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/gdb/frame.c b/gdb/frame.c
index e84371c4..ff8078b 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -471,13 +471,13 @@ frame_pc_unwind (struct frame_info *this_frame)
}
CORE_ADDR
-frame_func_unwind (struct frame_info *fi)
+frame_func_unwind (struct frame_info *fi, enum frame_type this_type)
{
if (!fi->prev_func.p)
{
/* Make certain that this, and not the adjacent, function is
found. */
- CORE_ADDR addr_in_block = frame_unwind_address_in_block (fi);
+ CORE_ADDR addr_in_block = frame_unwind_address_in_block (fi, this_type);
fi->prev_func.p = 1;
fi->prev_func.addr = get_pc_function_start (addr_in_block);
if (frame_debug)
@@ -491,7 +491,7 @@ frame_func_unwind (struct frame_info *fi)
CORE_ADDR
get_frame_func (struct frame_info *fi)
{
- return frame_func_unwind (fi->next);
+ return frame_func_unwind (fi->next, get_frame_type (fi));
}
static int
@@ -1496,20 +1496,31 @@ 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. */
+/* Return an address that falls within NEXT_FRAME's caller's code
+ block, assuming that the caller is a THIS_TYPE frame. */
CORE_ADDR
-frame_unwind_address_in_block (struct frame_info *next_frame)
+frame_unwind_address_in_block (struct frame_info *next_frame,
+ enum frame_type this_type)
{
/* A draft address. */
CORE_ADDR pc = frame_pc_unwind (next_frame);
+ /* If NEXT_FRAME was called by a signal frame or dummy frame, then
+ we shold not adjust the unwound PC. These frames may not call
+ their next frame in the normal way; the operating system or GDB
+ may have pushed their resume address manually onto the stack, so
+ it may be the very first instruction. Even if the resume address
+ was not manually pushed, they expect to be returned to. */
+ if (this_type != NORMAL_FRAME)
+ return pc;
+
/* 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
+ 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)
@@ -1520,7 +1531,8 @@ frame_unwind_address_in_block (struct frame_info *next_frame)
CORE_ADDR
get_frame_address_in_block (struct frame_info *this_frame)
{
- return frame_unwind_address_in_block (this_frame->next);
+ return frame_unwind_address_in_block (this_frame->next,
+ get_frame_type (this_frame));
}
static int