This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] fix dwarf2 missing frame base problem


This fixes GCC PR 24490, which I refiled as GDB PR 2024.

The testcase has a function that ends with a call to abort.  If you
compile it with gcc-4.1 and run it under gdb until it stops in abort,
and then generate a backtrace, you get an error saying the frame base
can't be found.
#2  0x00afb888 in abort () from /lib/libc.so.6
#3  0x080483a5 in main (argc=Could not find the frame base for "main".)
at test.c:4

Gcc optimized away the function epilogue, which makes the call to abort
the last instruction in the function.  The return address from abort is
thus past the end of the function.  Gcc emitted a location list for the
frame base that maps every address inside the function to the frame base
value at that point in the function.  But gdb is trying to use an
address outside the function, and hence can't find any frame base value.

Dan Jacobowitz suggested that changing get_frame_pc calls to
get_frame_address_in_block calls might work, and indeed it does.  There
are two such calls in dwarf2loc.c that need to be fixed.

I ran the gdb testsuite with and without the patch.  Ignoring some
spurious failures I am getting in gdb.mi, there is only one difference
in the results.  Without the patch, I get this failure
FAIL: gdb.base/corefile.exp: print func2::coremaker_local
and with the patch it does not fail.  Looking at the gdb log, I see that
this is exactly the problem I am trying to fix, as without the patch I
get
   print func2::coremaker_local
   Could not find the frame base for "func2".
-- 
Jim Wilson, GNU Tools Support, http://www.specifix.com

Attachment: patch.frame.address
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]