* [patch] fix dwarf2 missing frame base problem
@ 2005-11-03 20:03 James E Wilson
2005-11-12 2:38 ` James E Wilson
0 siblings, 1 reply; 4+ messages in thread
From: James E Wilson @ 2005-11-03 20:03 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1570 bytes --]
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 #2: patch.frame.address --]
[-- Type: text/plain, Size: 1561 bytes --]
2005-11-01 James E Wilson <wilson@specifix.com>
PR 2024
* dwarf2loc.c (dwarf_expr_frame_base): Use get_frame_address_in_block
instead of get_frame_pc.
(loclist_read_variable): Likewise.
Index: dwarf2loc.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2loc.c,v
retrieving revision 1.29
diff -p -p -r1.29 dwarf2loc.c
*** dwarf2loc.c 12 Jul 2005 13:06:54 -0000 1.29
--- dwarf2loc.c 2 Nov 2005 00:13:36 -0000
*************** dwarf_expr_frame_base (void *baton, gdb_
*** 165,172 ****
{
struct dwarf2_loclist_baton *symbaton;
symbaton = SYMBOL_LOCATION_BATON (framefunc);
! *start = find_location_expression (symbaton, length,
! get_frame_pc (debaton->frame));
}
else
{
--- 165,173 ----
{
struct dwarf2_loclist_baton *symbaton;
symbaton = SYMBOL_LOCATION_BATON (framefunc);
! *start
! = find_location_expression (symbaton, length,
! get_frame_address_in_block (debaton->frame));
}
else
{
*************** loclist_read_variable (struct symbol *sy
*** 580,586 ****
size_t size;
data = find_location_expression (dlbaton, &size,
! frame ? get_frame_pc (frame) : 0);
if (data == NULL)
{
val = allocate_value (SYMBOL_TYPE (symbol));
--- 581,588 ----
size_t size;
data = find_location_expression (dlbaton, &size,
! frame ? get_frame_address_in_block (frame)
! : 0);
if (data == NULL)
{
val = allocate_value (SYMBOL_TYPE (symbol));
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] fix dwarf2 missing frame base problem
2005-11-03 20:03 [patch] fix dwarf2 missing frame base problem James E Wilson
@ 2005-11-12 2:38 ` James E Wilson
2005-11-13 18:40 ` Daniel Jacobowitz
0 siblings, 1 reply; 4+ messages in thread
From: James E Wilson @ 2005-11-12 2:38 UTC (permalink / raw)
To: gdb-patches
On Thu, 2005-11-03 at 10:59, James E Wilson wrote:
> This fixes GCC PR 24490, which I refiled as GDB PR 2024.
> http://sources.redhat.com/ml/gdb-patches/2005-11/msg00059.html
Could someone please review this patch? I never received permission to
install it. Also, I noticed that a gdb-6.4 branch was created last
week. May I also have permission to add it to the branch? It would be
nice if gdb-6.4 worked correctly with gcc-4.1.
--
Jim Wilson, GNU Tools Support, http://www.specifix.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] fix dwarf2 missing frame base problem
2005-11-12 2:38 ` James E Wilson
@ 2005-11-13 18:40 ` Daniel Jacobowitz
2005-11-15 8:52 ` James E Wilson
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2005-11-13 18:40 UTC (permalink / raw)
To: James E Wilson; +Cc: gdb-patches
On Fri, Nov 11, 2005 at 01:49:47PM -0800, James E Wilson wrote:
> On Thu, 2005-11-03 at 10:59, James E Wilson wrote:
> > This fixes GCC PR 24490, which I refiled as GDB PR 2024.
> > http://sources.redhat.com/ml/gdb-patches/2005-11/msg00059.html
>
> Could someone please review this patch? I never received permission to
> install it. Also, I noticed that a gdb-6.4 branch was created last
> week. May I also have permission to add it to the branch? It would be
> nice if gdb-6.4 worked correctly with gcc-4.1.
This is OK for both head and branch. Could you please use a temporary
variable though? You're out to 82 columns.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] fix dwarf2 missing frame base problem
2005-11-13 18:40 ` Daniel Jacobowitz
@ 2005-11-15 8:52 ` James E Wilson
0 siblings, 0 replies; 4+ messages in thread
From: James E Wilson @ 2005-11-15 8:52 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 322 bytes --]
On Sun, 2005-11-13 at 10:27, Daniel Jacobowitz wrote:
> This is OK for both head and branch. Could you please use a temporary
> variable though? You're out to 82 columns.
OK, thanks. Here is the revised and retested patch that I added to the
head and branch.
--
Jim Wilson, GNU Tools Support, http://www.specifix.com
[-- Attachment #2: patch.frame.address --]
[-- Type: text/plain, Size: 1716 bytes --]
2005-11-14 James E Wilson <wilson@specifix.com>
PR 2024
* dwarf2loc.c (dwarf_expr_frame_base): Use get_frame_address_in_block
instead of get_frame_pc.
(loclist_read_variable): Likewise.
Index: dwarf2loc.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2loc.c,v
retrieving revision 1.29
diff -p -p -r1.29 dwarf2loc.c
*** dwarf2loc.c 12 Jul 2005 13:06:54 -0000 1.29
--- dwarf2loc.c 14 Nov 2005 20:42:17 -0000
*************** dwarf_expr_frame_base (void *baton, gdb_
*** 164,172 ****
if (SYMBOL_OPS (framefunc) == &dwarf2_loclist_funcs)
{
struct dwarf2_loclist_baton *symbaton;
symbaton = SYMBOL_LOCATION_BATON (framefunc);
*start = find_location_expression (symbaton, length,
! get_frame_pc (debaton->frame));
}
else
{
--- 164,174 ----
if (SYMBOL_OPS (framefunc) == &dwarf2_loclist_funcs)
{
struct dwarf2_loclist_baton *symbaton;
+ struct frame_info *frame = debaton->frame;
+
symbaton = SYMBOL_LOCATION_BATON (framefunc);
*start = find_location_expression (symbaton, length,
! get_frame_address_in_block (frame));
}
else
{
*************** loclist_read_variable (struct symbol *sy
*** 580,586 ****
size_t size;
data = find_location_expression (dlbaton, &size,
! frame ? get_frame_pc (frame) : 0);
if (data == NULL)
{
val = allocate_value (SYMBOL_TYPE (symbol));
--- 582,589 ----
size_t size;
data = find_location_expression (dlbaton, &size,
! frame ? get_frame_address_in_block (frame)
! : 0);
if (data == NULL)
{
val = allocate_value (SYMBOL_TYPE (symbol));
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-11-14 22:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-03 20:03 [patch] fix dwarf2 missing frame base problem James E Wilson
2005-11-12 2:38 ` James E Wilson
2005-11-13 18:40 ` Daniel Jacobowitz
2005-11-15 8:52 ` James E Wilson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox