* [rfa:dwarf2] Use frame_unwind_address_in_block
@ 2003-07-16 23:21 Andrew Cagney
2003-07-18 15:15 ` Andrew Cagney
2003-07-18 19:13 ` Elena Zannoni
0 siblings, 2 replies; 5+ messages in thread
From: Andrew Cagney @ 2003-07-16 23:21 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 378 bytes --]
Hello,
This, finally, is the tweak to the dwarf2-unwind code, to use the
frame's address-in-block, instead of the frame's PC to select the CFI
info. Two test cases stop failing:
1gdb.base/corefile.exp: backtrace in corefile.exp FAIL PASS
2gdb.base/gdb1250.exp: backtrace from abort KFAIL PASS
Ok for the mainline?
Ok to pull something equivalent into 6.0 branch?
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 2565 bytes --]
2003-07-16 Andrew Cagney <cagney@redhat.com>
* dwarf2-frame.c (dwarf2_frame_sniffer): Use
frame_unwind_address_in_block, instead of frame_pc_unwind.
(dwarf2_frame_cache): Ditto.
Index: dwarf2-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2-frame.c,v
retrieving revision 1.9
diff -u -r1.9 dwarf2-frame.c
--- dwarf2-frame.c 16 Jul 2003 22:29:13 -0000 1.9
+++ dwarf2-frame.c 16 Jul 2003 23:13:29 -0000
@@ -491,15 +491,12 @@
done for "normal" frames and not for resume-type frames (signal
handlers, sentinel frames, dummy frames).
- We don't do what GCC's does here (yet). It's not clear how
- reliable the method is. There's also a problem with finding the
- right FDE; see the comment in dwarf_frame_p. If dwarf_frame_p
- selected this frame unwinder because it found the FDE for the
- next function, using the adjusted return address might not yield
- a FDE at all. The problem isn't specific to DWARF CFI; other
- unwinders loose in similar ways. Therefore it's probably
- acceptable to leave things slightly broken for now. */
- fs->pc = frame_pc_unwind (next_frame);
+ frame_unwind_address_in_block does just this.
+
+ It's not clear how reliable the method is though - there is the
+ potential for the register state pre-call being different to that
+ on return. */
+ fs->pc = frame_unwind_address_in_block (next_frame);
/* Find the correct FDE. */
fde = dwarf2_frame_find_fde (&fs->pc);
@@ -710,15 +707,11 @@
const struct frame_unwind *
dwarf2_frame_sniffer (struct frame_info *next_frame)
{
- CORE_ADDR pc = frame_pc_unwind (next_frame);
- /* The way GDB works, this function can be called with PC just after
- the last instruction of the function we're supposed to return the
- unwind methods for. In that case we won't find the correct FDE;
- instead we find the FDE for the next function, or we won't find
- an FDE at all. There is a possible solution (see the comment in
- dwarf2_frame_cache), GDB doesn't pass us enough information to
- implement it. */
- if (dwarf2_frame_find_fde (&pc))
+ /* Grab an address that is guarenteed to reside somewhere within the
+ function. frame_pc_unwind(), for a no-return next function, can
+ end up returning something past the end of this function's body. */
+ CORE_ADDR block_addr = frame_unwind_address_in_block (next_frame);
+ if (dwarf2_frame_find_fde (&block_addr))
return &dwarf2_frame_unwind;
return NULL;
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [rfa:dwarf2] Use frame_unwind_address_in_block
2003-07-16 23:21 [rfa:dwarf2] Use frame_unwind_address_in_block Andrew Cagney
@ 2003-07-18 15:15 ` Andrew Cagney
2003-07-18 19:13 ` Elena Zannoni
1 sibling, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2003-07-18 15:15 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 446 bytes --]
> Hello,
>
> This, finally, is the tweak to the dwarf2-unwind code, to use the frame's address-in-block, instead of the frame's PC to select the CFI info. Two test cases stop failing:
>
> 1gdb.base/corefile.exp: backtrace in corefile.exp FAIL PASS 2gdb.base/gdb1250.exp: backtrace from abort KFAIL PASS
>
> Ok for the mainline?
> Ok to pull something equivalent into 6.0 branch?
FYI,
The attached is the equivalent for the branch.
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 4813 bytes --]
2003-07-18 Andrew Cagney <cagney@redhat.com>
* dwarf2-frame.h (dwarf2_frame_sniffer): Replace "dwarf2_frame_p".
* dwarf2-frame.c (dwarf2_frame_sniffer): Replace "dwarf2_frame_p".
(dwarf2_frame_cache): Use frame_unwind_address_in_block, instead
of frame_pc_unwind.
* i386-tdep.c (i386_gdbarch_init): Update.
* alpha-tdep.c (alpha_dwarf2_init_abi): Update.
Index: alpha-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/alpha-tdep.c,v
retrieving revision 1.116
diff -u -r1.116 alpha-tdep.c
--- alpha-tdep.c 14 Jun 2003 22:35:23 -0000 1.116
+++ alpha-tdep.c 18 Jul 2003 15:12:50 -0000
@@ -1583,7 +1583,7 @@
void
alpha_dwarf2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- frame_unwind_append_predicate (gdbarch, dwarf2_frame_p);
+ frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
frame_base_append_predicate (gdbarch, dwarf2_frame_base_p);
set_gdbarch_dwarf2_build_frame_info (gdbarch, dwarf2_build_frame_info);
}
Index: dwarf2-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2-frame.c,v
retrieving revision 1.7.4.1
diff -u -r1.7.4.1 dwarf2-frame.c
--- dwarf2-frame.c 11 Jul 2003 16:56:09 -0000 1.7.4.1
+++ dwarf2-frame.c 18 Jul 2003 15:12:51 -0000
@@ -491,15 +491,12 @@
done for "normal" frames and not for resume-type frames (signal
handlers, sentinel frames, dummy frames).
- We don't do what GCC's does here (yet). It's not clear how
- reliable the method is. There's also a problem with finding the
- right FDE; see the comment in dwarf_frame_p. If dwarf_frame_p
- selected this frame unwinder because it found the FDE for the
- next function, using the adjusted return address might not yield
- a FDE at all. The problem isn't specific to DWARF CFI; other
- unwinders loose in similar ways. Therefore it's probably
- acceptable to leave things slightly broken for now. */
- fs->pc = frame_pc_unwind (next_frame);
+ frame_unwind_address_in_block does just this.
+
+ It's not clear how reliable the method is though - there is the
+ potential for the register state pre-call being different to that
+ on return. */
+ fs->pc = frame_unwind_address_in_block (next_frame);
/* Find the correct FDE. */
fde = dwarf2_frame_find_fde (&fs->pc);
@@ -708,16 +705,13 @@
};
const struct frame_unwind *
-dwarf2_frame_p (CORE_ADDR pc)
+dwarf2_frame_sniffer (struct frame_info *next_frame)
{
- /* The way GDB works, this function can be called with PC just after
- the last instruction of the function we're supposed to return the
- unwind methods for. In that case we won't find the correct FDE;
- instead we find the FDE for the next function, or we won't find
- an FDE at all. There is a possible solution (see the comment in
- dwarf2_frame_cache), GDB doesn't pass us enough information to
- implement it. */
- if (dwarf2_frame_find_fde (&pc))
+ /* Grab an address that is guarenteed to reside somewhere within the
+ function. frame_pc_unwind(), for a no-return next function, can
+ end up returning something past the end of this function's body. */
+ CORE_ADDR block_addr = frame_unwind_address_in_block (next_frame);
+ if (dwarf2_frame_find_fde (&block_addr))
return &dwarf2_frame_unwind;
return NULL;
Index: dwarf2-frame.h
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2-frame.h,v
retrieving revision 1.1
diff -u -r1.1 dwarf2-frame.h
--- dwarf2-frame.h 31 May 2003 19:18:05 -0000 1.1
+++ dwarf2-frame.h 18 Jul 2003 15:12:51 -0000
@@ -29,7 +29,7 @@
/* Return the frame unwind methods for the function that contains PC,
or NULL if it can't be handled by DWARF CFI frame unwinder. */
-const struct frame_unwind *dwarf2_frame_p (CORE_ADDR pc);
+const struct frame_unwind *dwarf2_frame_sniffer (struct frame_info *next_frame);
/* Return the frame base methods for the function that contains PC, or
NULL if it can't be handled by the DWARF CFI frame unwinder. */
Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.158.2.2
diff -u -r1.158.2.2 i386-tdep.c
--- i386-tdep.c 2 Jul 2003 17:15:54 -0000 1.158.2.2
+++ i386-tdep.c 18 Jul 2003 15:12:52 -0000
@@ -1811,7 +1811,7 @@
set_gdbarch_fetch_pointer_argument (gdbarch, i386_fetch_pointer_argument);
/* Hook in the DWARF CFI frame unwinder. */
- frame_unwind_append_predicate (gdbarch, dwarf2_frame_p);
+ frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
set_gdbarch_dwarf2_build_frame_info (gdbarch, dwarf2_build_frame_info);
frame_base_set_default (gdbarch, &i386_frame_base);
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [rfa:dwarf2] Use frame_unwind_address_in_block
2003-07-16 23:21 [rfa:dwarf2] Use frame_unwind_address_in_block Andrew Cagney
2003-07-18 15:15 ` Andrew Cagney
@ 2003-07-18 19:13 ` Elena Zannoni
2003-07-18 20:02 ` Andrew Cagney
1 sibling, 1 reply; 5+ messages in thread
From: Elena Zannoni @ 2003-07-18 19:13 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
Andrew Cagney writes:
> Hello,
>
> This, finally, is the tweak to the dwarf2-unwind code, to use the
> frame's address-in-block, instead of the frame's PC to select the CFI
> info. Two test cases stop failing:
>
> 1gdb.base/corefile.exp: backtrace in corefile.exp FAIL PASS
> 2gdb.base/gdb1250.exp: backtrace from abort KFAIL PASS
>
> Ok for the mainline?
> Ok to pull something equivalent into 6.0 branch?
seems sane.
elena
>
> Andrew
> 2003-07-16 Andrew Cagney <cagney@redhat.com>
>
> * dwarf2-frame.c (dwarf2_frame_sniffer): Use
> frame_unwind_address_in_block, instead of frame_pc_unwind.
> (dwarf2_frame_cache): Ditto.
>
> Index: dwarf2-frame.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/dwarf2-frame.c,v
> retrieving revision 1.9
> diff -u -r1.9 dwarf2-frame.c
> --- dwarf2-frame.c 16 Jul 2003 22:29:13 -0000 1.9
> +++ dwarf2-frame.c 16 Jul 2003 23:13:29 -0000
> @@ -491,15 +491,12 @@
> done for "normal" frames and not for resume-type frames (signal
> handlers, sentinel frames, dummy frames).
>
> - We don't do what GCC's does here (yet). It's not clear how
> - reliable the method is. There's also a problem with finding the
> - right FDE; see the comment in dwarf_frame_p. If dwarf_frame_p
> - selected this frame unwinder because it found the FDE for the
> - next function, using the adjusted return address might not yield
> - a FDE at all. The problem isn't specific to DWARF CFI; other
> - unwinders loose in similar ways. Therefore it's probably
> - acceptable to leave things slightly broken for now. */
> - fs->pc = frame_pc_unwind (next_frame);
> + frame_unwind_address_in_block does just this.
> +
> + It's not clear how reliable the method is though - there is the
> + potential for the register state pre-call being different to that
> + on return. */
> + fs->pc = frame_unwind_address_in_block (next_frame);
>
> /* Find the correct FDE. */
> fde = dwarf2_frame_find_fde (&fs->pc);
> @@ -710,15 +707,11 @@
> const struct frame_unwind *
> dwarf2_frame_sniffer (struct frame_info *next_frame)
> {
> - CORE_ADDR pc = frame_pc_unwind (next_frame);
> - /* The way GDB works, this function can be called with PC just after
> - the last instruction of the function we're supposed to return the
> - unwind methods for. In that case we won't find the correct FDE;
> - instead we find the FDE for the next function, or we won't find
> - an FDE at all. There is a possible solution (see the comment in
> - dwarf2_frame_cache), GDB doesn't pass us enough information to
> - implement it. */
> - if (dwarf2_frame_find_fde (&pc))
> + /* Grab an address that is guarenteed to reside somewhere within the
> + function. frame_pc_unwind(), for a no-return next function, can
> + end up returning something past the end of this function's body. */
> + CORE_ADDR block_addr = frame_unwind_address_in_block (next_frame);
> + if (dwarf2_frame_find_fde (&block_addr))
> return &dwarf2_frame_unwind;
>
> return NULL;
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [rfa:dwarf2] Use frame_unwind_address_in_block
2003-07-18 19:13 ` Elena Zannoni
@ 2003-07-18 20:02 ` Andrew Cagney
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2003-07-18 20:02 UTC (permalink / raw)
To: Elena Zannoni; +Cc: gdb-patches
> Andrew Cagney writes:
> > Hello,
> >
> > This, finally, is the tweak to the dwarf2-unwind code, to use the
> > frame's address-in-block, instead of the frame's PC to select the CFI
> > info. Two test cases stop failing:
> >
> > 1gdb.base/corefile.exp: backtrace in corefile.exp FAIL PASS
> > 2gdb.base/gdb1250.exp: backtrace from abort KFAIL PASS
> >
> > Ok for the mainline?
> > Ok to pull something equivalent into 6.0 branch?
>
> seems sane.
Committed to mainline. I'll leave 6.0 until next week.
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [rfa:dwarf2] Use frame_unwind_address_in_block
@ 2003-07-17 19:43 Michael Elizabeth Chastain
0 siblings, 0 replies; 5+ messages in thread
From: Michael Elizabeth Chastain @ 2003-07-17 19:43 UTC (permalink / raw)
To: ac131313, gdb-patches
Works for me with dwarf-2, but stabs+ is still broken.
No regressions though.
I tested this in mainline with:
native i686-pc-linux-gnu
gcc 2.95.3, gcc 3.3, gcc HEAD
dwarf-2 and stabs+
Michael C
===
2003-07-16 Andrew Cagney <cagney@redhat.com>
* dwarf2-frame.c (dwarf2_frame_sniffer): Use
frame_unwind_address_in_block, instead of frame_pc_unwind.
(dwarf2_frame_cache): Ditto.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-07-18 20:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-16 23:21 [rfa:dwarf2] Use frame_unwind_address_in_block Andrew Cagney
2003-07-18 15:15 ` Andrew Cagney
2003-07-18 19:13 ` Elena Zannoni
2003-07-18 20:02 ` Andrew Cagney
2003-07-17 19:43 Michael Elizabeth Chastain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox