[Dwarf-Discuss] Problems understanding attribute DW_AT_location of global variables (Form DW_FORM_BLOCK)

happyfrank3d@web.de happyfrank3d at web.de
Mon Apr 4 00:08:12 PDT 2011


Hi, 

I have some problems understanding the attribute DW_AT_location of global variables. 
My small C++ application has the following DWARF output: (version 2) 

[…] 

<1><11f>: Abbrev Number: 12 (DW_TAG_variable) 
    <120>   DW_AT_name        : (indirect string, offset: 0x15a): global01      
    <124>   DW_AT_decl_file   : 1       
    <125>   DW_AT_decl_line   : 5       
    <126>   DW_AT_type        : <0x4f>  
    <12a>   DW_AT_external    : 1       
    <12b>   DW_AT_location    : 5 byte block: 3 0 0 0 0         (DW_OP_addr: 0) 
 <1><131>: Abbrev Number: 12 (DW_TAG_variable) 
    <132>   DW_AT_name        : (indirect string, offset: 0x163): global02      
    <136>   DW_AT_decl_file   : 1       
    <137>   DW_AT_decl_line   : 6       
    <138>   DW_AT_type        : <0x4f>  
    <13c>   DW_AT_external    : 1       
    <13d>   DW_AT_location    : 5 byte block: 3 4 0 0 0         (DW_OP_addr: 4) 
 <1><143>: Abbrev Number: 12 (DW_TAG_variable) 
    <144>   DW_AT_name        : (indirect string, offset: 0x16c): global03      
    <148>   DW_AT_decl_file   : 1       
    <149>   DW_AT_decl_line   : 7       
    <14a>   DW_AT_type        : <0x4f>  
    <14e>   DW_AT_external    : 1       
    <14f>   DW_AT_location    : 5 byte block: 3 8 0 0 0         (DW_OP_addr: 8) 

[…] 

 <1><275>: Abbrev Number: 12 (DW_TAG_variable) 
    <276>   DW_AT_name        : (indirect string, offset: 0x96): global20       
    <27a>   DW_AT_decl_file   : 1       
    <27b>   DW_AT_decl_line   : 24      
    <27c>   DW_AT_type        : <0x4f>  
    <280>   DW_AT_external    : 1       
    <281>   DW_AT_location    : 5 byte block: 3 4c 0 0 0        (DW_OP_addr: 4c) 

All variables are of type int(4 byte). 

1. What does the value "5 byte block: 3 0 0 0 0" in this special case mean? 
2. What does the value "3" stand for? 
3. Is the virtual address of variable "global01" 0x0000? 
4. What does the offset in the section .debug_pubtypes of the global variables mean? 

Thank you for your help. 

Best regards, 
Frank

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/attachments/20110404/b83fcaa3/attachment-0001.htm>


More information about the Dwarf-Discuss mailing list