aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2-frame.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-11-13 11:10:55 -0700
committerTom Tromey <tromey@redhat.com>2013-11-22 11:02:01 -0700
commitda2b2fdf57a96f7a5b6b153e94afb747e212b17f (patch)
tree8c60ba7bea00cadcb485eb9d3ea0aeec9fa02be2 /gdb/dwarf2-frame.c
parent6eeee81c8e59511962bdd83df5e7785bfdf871d2 (diff)
downloadfsf-binutils-gdb-da2b2fdf57a96f7a5b6b153e94afb747e212b17f.zip
fsf-binutils-gdb-da2b2fdf57a96f7a5b6b153e94afb747e212b17f.tar.gz
fsf-binutils-gdb-da2b2fdf57a96f7a5b6b153e94afb747e212b17f.tar.bz2
handle an unspecified return address column
Debugging PR 16155 further, I found that the DWARF unwinder found the function in question, but thought it had no registers saved (fs->regs.num_regs == 0). It seems to me that if a frame does not specify the return address column, or if the return address column is explicitly marked as DWARF2_FRAME_REG_UNSPECIFIED, then we should set the "undefined_retaddr" flag and let the DWARF unwinder gracefully stop. This patch implements that idea. With this patch the backtrace works properly: (gdb) bt #0 0x0000007fb7ed485c in nanosleep () from /lib64/libc.so.6 #1 0x0000007fb7ed4508 in sleep () from /lib64/libc.so.6 #2 0x00000000004008bc in thread_function (arg=0x4) at threadapply.c:73 #3 0x0000007fb7fad950 in start_thread () from /lib64/libpthread.so.0 #4 0x0000007fb7f0956c in clone () from /lib64/libc.so.6 2013-11-22 Tom Tromey <tromey@redhat.com> PR backtrace/16155: * dwarf2-frame.c (dwarf2_frame_cache): Set undefined_retaddr if the return address column is unspecified. 2013-11-22 Tom Tromey <tromey@redhat.com> * gdb.dwarf2/dw2-bad-cfi.c: New file. * gdb.dwarf2/dw2-bad-cfi.exp: New file. * gdb.dwarf2/dw2-bad-cfi.S: New file.
Diffstat (limited to 'gdb/dwarf2-frame.c')
-rw-r--r--gdb/dwarf2-frame.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index c4f8771..f185ca6 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -1245,6 +1245,10 @@ incomplete CFI data; unspecified registers (e.g., %s) at %s"),
if (fs->retaddr_column < fs->regs.num_regs
&& fs->regs.reg[fs->retaddr_column].how == DWARF2_FRAME_REG_UNDEFINED)
cache->undefined_retaddr = 1;
+ else if (fs->retaddr_column >= fs->regs.num_regs
+ || (fs->regs.reg[fs->retaddr_column].how
+ == DWARF2_FRAME_REG_UNSPECIFIED))
+ cache->undefined_retaddr = 1;
do_cleanups (old_chain);
discard_cleanups (reset_cache_cleanup);