[Dwarf-Discuss] dwarf and local variables's offset
ranjith kumar
ranjithproxy@gmail.com
Mon May 4 09:04:52 GMT 2009
Hi,
In the contes of the .debug_loc section:
_____________________________________________
Offset Begin End Expression
00000000 080483c4 080483ec (DW_OP_breg5: 8)
00000000 <End of list>
___________________________________________
1) What does "DW_OP_breg5: 8" mean???
ie) Why it is 8 only???
If I compile my program again, it can be some other value???
Or that value is constant for the given machine? If so it represents
what information about the machine?
2) Why DW_OP_breg5 and (%ebp ) are not same????
I could not figure it out it in dwarf3.pdf.
Thanks in advace.
On Thu, Apr 30, 2009 at 1:14 PM, Jan Kratochvil
<jan.kratochvil at redhat.com> wrote:
> 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