[Dwarf-Discuss] Is this legal DWARF, and if so, what does it mean?

Michael Eager eager@eagercon.com
Mon Sep 15 17:56:09 GMT 2014


On 09/15/14 10:32, John DelSignore wrote:
> Hi,
>
> TotalView has a customer that has C++ code that produces the following DWARF with the Intel 12.1
> compiler:

ICC generates a lot of idiosyncratic DWARF.

>
>   <0><1192a2>: Abbrev Number: 1 (DW_TAG_compile_unit)
>       DW_AT_comp_dir    : ...SNIPPED...
>       DW_AT_language    : 4    (C++)
>       DW_AT_name        : ...SNIPPED...
>       DW_AT_producer    : Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R)
> 64, Version 12.1 Build 20110811
>   Fixes SameLinkageName MemberPointers
>
>       DW_AT_stmt_list   : 0x5d20
>   <1><119376>: Abbrev Number: 2 (DW_TAG_namespace)
>       DW_AT_name        : std
> ...SNIPPED...
>   <2><268209>: Abbrev Number: 37 (DW_TAG_lexical_block)
>       DW_AT_decl_line   : 1301
>       DW_AT_decl_column : 79
>       DW_AT_decl_file   : 1
>       DW_AT_low_pc      : 0xb02a1
>       DW_AT_high_pc     : 0xb02d4
>   <3><26821e>: Abbrev Number: 38 (DW_TAG_lexical_block)
>       DW_AT_decl_line   : 1351
>       DW_AT_decl_column : 31
>       DW_AT_decl_file   : 1
>       DW_AT_low_pc      : 0xb03a7
>       DW_AT_high_pc     : 0xb03f7
> <2><268234>: Abbrev Number: 16 (DW_TAG_inlined_subroutine)
> ...SNIPPED...
>
> Notice:
>
>  1. The lexical block at <268209> is at "std" namespace scope. What does it mean to have a lexical
>     block at namespace scope? Note that that lexical block contains /only/ another lexical block at
>     <26821e>; no subroutines or variables.

Looks unnecessary to me.  Do you have the source for this file?

I guess this might be generated if you had something like

   namespace std
   {
     {
       {
         /* whatever */
       }
     }
   }

But my guess is that the original source did not look like this.

>  2. The lexical block at <26821e> has an address range that is not nested inside its containing
>     lexical block's address range. Is that legal, and if so, what does that mean? Note that that
>     lexical block contains nothing else; no subroutines, blocks, or variables.

Maybe legal.  The DWARF tree indicates the static nesting.  If a compiler generated
code/data for a nested scope at a different location from the containing scope, then
maybe it might describe the lexical block with a different address range.

Since the lexical block is empty, I'm not sure that this really has any meaning.

ICC does a significant amount of code movement during optimization.  I think
that it doesn't clean up all of the DWARF when it moves code and is accidentally
leaving a now-empty lexical block behind.

-- 
Michael Eager	 eager at eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077



More information about the Dwarf-discuss mailing list