Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* dwarf2 and frame bases
@ 2004-11-10 23:57 Randolph Chung
  2004-11-10 23:58 ` Daniel Jacobowitz
  0 siblings, 1 reply; 9+ messages in thread
From: Randolph Chung @ 2004-11-10 23:57 UTC (permalink / raw)
  To: gdb

The "recurse" test has been failing on hppa for a long time. I think I
finally understand what is happening, but not sure of a fix....

the symptom of the problem is that watchpoints fail during recursion:

(gdb) watch b
Watchpoint 2: b
(gdb) continue
Continuing.
Watchpoint 2: b

Old value = 0
New value = 10
recurse (a=10) at ../../../gdb-cvs/gdb/testsuite/gdb.base/recurse.c:19
19        b *= recurse (a - 1);
(gdb) continue
Continuing.
Error evaluating expression for watchpoint 2
Cannot access memory at address 0x8
Watchpoint 2 deleted.

hppa-linux uses dwarf2, and doesn't implement hardware watchpoints.

The dwarf2 description for recurse looks like this:

 <1><a1d>: Abbrev Number: 2 (DW_TAG_subprogram)
     DW_AT_sibling     : <a53>
     DW_AT_name        : recurse
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 12
     DW_AT_type        : <a53>
     DW_AT_low_pc      : 0x10518
     DW_AT_high_pc     : 0x10598
     DW_AT_frame_base  : 1 byte block: 53       (DW_OP_reg3)
 <2><a3a>: Abbrev Number: 3 (DW_TAG_formal_parameter)
     DW_AT_name        : a
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 10
     DW_AT_type        : <a53>
     DW_AT_location    : 2 byte block: 91 5c    (DW_OP_fbreg: -36)
 <2><a46>: Abbrev Number: 4 (DW_TAG_variable)
     DW_AT_name        : b
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 13
     DW_AT_type        : <a53>
     DW_AT_location    : 2 byte block: 91 8     (DW_OP_fbreg: 8)

what seems to happen is that, to implement the watchpoint, we singlestep
through the code and evaluate 'b' at every insn. If we do this in the
prologue, we fail. The dwarf location expression handler tries to get
the frame base by using DW_AT_frame_base, which points to register 3,
but register 3 is not yet initialized in the prologue, so when we read
it, we get garbage. argh...

I don't know enough about dwarf to know how this is supposed to be
evaluated. Can someone please shed some light on this?

thanks
randolph
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2004-11-11 21:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-10 23:57 dwarf2 and frame bases Randolph Chung
2004-11-10 23:58 ` Daniel Jacobowitz
2004-11-11  3:09   ` Randolph Chung
2004-11-11  9:57     ` Daniel Jacobowitz
2004-11-11 17:12       ` Randolph Chung
2004-11-11 19:42         ` Daniel Jacobowitz
2004-11-11 22:58           ` Randolph Chung
2004-11-11 19:47         ` Mark Kettenis
2004-11-11 21:18           ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox