[Dwarf-Discuss] dwarf and local variables's offset
Jan Kratochvil
jan.kratochvil@redhat.com
Thu Apr 30 07:44:42 GMT 2009
On Thu, 30 Apr 2009 08:18:12 +0200, ranjith kumar wrote:
> --------------------------------------------------------------------------------------------------------
> <2><8d>: Abbrev Number: 6 (DW_TAG_variable)
[...]
> <98> DW_AT_location : 2 byte block: 91 70 (DW_OP_fbreg: -16)
> ---------------------------------------------------------------------------------------------------------------------
> What I think is that the address of localvariable = (contents of ebp)-16
> since DW_OP_fbreg: -16 and ebp is the Base Pointer.
DW_OP_fbreg is not relative to %ebp.
> But when I debug, the address of localvariable=0xbfa3ac10 and ebp=0xbfa3ac18
DWARF3:
# The DW_OP_fbreg operation provides a signed LEB128 offset from the address
# specified by the location description in the DW_AT_frame_base attribute of
# the current function.
<1><75>: Abbrev Number: 5 (DW_TAG_subprogram)
<77> DW_AT_name : (indirect string, offset: 0x68): main
[...]
<89> DW_AT_frame_base : 0x0 (location list)
->
Contents of the .debug_loc section:
Offset Begin End Expression
00000000 080483c4 080483ec (DW_OP_breg5: 8)
00000000 <End of list>
GDB i386_register_names[] says register #5 (=breg5) is "ebp".
variable = fbreg - 16
variable = (breg5 + 8) - 16
variable = (%ebp + 8) - 16
variable = %ebp - 8
> So the differnce between ebp and address of localvariable is -8 not -16.
Regards,
Jan
More information about the Dwarf-discuss
mailing list