[Dwarf-Discuss] meaning's dwarf expression for DW_AT_frame_base in loclist

Marion Guthmuller marion.guthmuller at loria.fr
Thu Sep 13 05:29:04 PDT 2012

Le 13/09/2012 14:09, Michael Eager a écrit :
> On 09/13/2012 02:37 AM, Marion Guthmuller wrote:
>> Hi,
>> What does this expression mean ? DW_OP_breg7+8
>> This expression is associated to DW_AT_frame base in a loclist. 
>> DW_OP_breg7 is the contents of r7
>> but I don't understand the "+8". I thought that this expression mean 
>> to add 8 to the value in
>> register 7 but in this case, the expression should be DW_OP_breg7 8 
>> (without "+") according to
>> examples of location description in user guide.
> Where do you see DW_OP_breg7+8?
> What user guide are you referring to?  The DWARF Standard?
> DWARF expressions are sequences of binary values.  Different
> programs may print them with different formats.  My guess
> is that the dump program you are using is trying to indicate
> that the expression is (r7+8).
I want to retrieve local variables and their values of an executable. 
For that, I used dwarfdump and I focused on .debug_info section.

My executable contains 3 functions. For each, I found in .debug_info a 
node DW_TAG_subprogram with an attribute DW_AT_frame_base.

For example, I have a function "client" with these information :

< 1><0x000009a0>    DW_TAG_subprogram
                       DW_AT_external              yes(1)
                       DW_AT_name                  "client"
                       DW_AT_decl_file             0x00000001 ./bugged1.c
                       DW_AT_decl_line             0x0000003a
                       DW_AT_prototyped            yes(1)
                       DW_AT_type <0x00000090>
                       DW_AT_low_pc                0x00401570
                       DW_AT_high_pc               0x0040198c
                       DW_AT_frame_base <loclist with 6 entries follows>
             [ 0]<lowpc=0x00401570><highpc=0x00401572>DW_OP_breg7+8
             [ 1]<lowpc=0x00401572><highpc=0x00401574>DW_OP_breg7+16
             [ 2]<lowpc=0x00401574><highpc=0x00401578>DW_OP_breg7+24
             [ 3]<lowpc=0x00401578><highpc=0x0040157e>DW_OP_breg7+32
             [ 4]<lowpc=0x0040157e><highpc=0x00401582>DW_OP_breg7+40
             [ 5]<lowpc=0x00401582><highpc=0x0040198c>DW_OP_breg7+160
                       DW_AT_GNU_all_call_sites    yes(1)
                       DW_AT_sibling <0x00000f34>

After other research, it seems that my first evaluation and yours are 
the good one : we simply add 8 to the value in register 7.

Marion G.<http://www.loria.fr/%7Eguthmull>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/attachments/20120913/76dc5db8/attachment-0002.htm>

More information about the Dwarf-Discuss mailing list