[Dwarf-Discuss] Does DW_TAG_inlined_subroutine trump DW_INL_declared_not_inlined in the abstract instance?

John DelSignore jdelsign@totalviewtech.com
Mon Mar 24 15:10:25 GMT 2008


Hi,

I'm seeing GCC 4.1.1 output some DWARF for inlined functions that I haven't seen before, and I'm not sure what it means, if it's legal DWARF, or how to reproduce it in a small test program.

In an environment for the Cell SPU processor, there's an inline function in a header file defined like this (I changed the identifier names to since I have the code under NDA):

__attribute__((always_inline))
static inline uint32_t
A(uint32_t T)
{
	B(tagmask);
	return C();
}

A() is then used like this:

int M()
{
	A(1<<S);
	...
}

The resulting DWARF is:

 <1><25a>: Abbrev Number: 14 (DW_TAG_subprogram)
     DW_AT_sibling     : <291>	
     DW_AT_name        : A	
     DW_AT_decl_file   : 2	
     DW_AT_decl_line   : 401	
     DW_AT_prototyped  : 1	
     DW_AT_type        : <d4>	
     DW_AT_inline      : 2	(declared as inline but ignored)
...
 <1><291>: Abbrev Number: 15 (DW_TAG_subprogram)
     DW_AT_sibling     : <3a7>	
     DW_AT_external    : 1	
     DW_AT_name        : M	
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 21	
     DW_AT_prototyped  : 1	
     DW_AT_type        : <cd>	
     DW_AT_low_pc      : 0x3168	
     DW_AT_high_pc     : 0x3450	
     DW_AT_frame_base  : 0	(location list)
...
 <2><343>: Abbrev Number: 19 (DW_TAG_inlined_subroutine)
     DW_AT_abstract_origin: <25a>	
     DW_AT_low_pc      : 0x3294	
     DW_AT_high_pc     : 0x32a8	
     DW_AT_call_file   : 1	
     DW_AT_call_line   : 26	

The thing that seems wrong here is that the compiler created abstract instance root DIE <25a> with DW_AT_inline == DW_INL_declared_not_inlined, but it is the abstract origin of the concrete inlined instance entry DIE <343>. According to the DWARF 3 standard, DW_INL_declared_not_inlined means "Declared as inline but not inlined by the compiler", but in this case "A" was clearly inlined.

Does DW_TAG_inlined_subroutine trump DW_INL_declared_not_inlined in the abstract instance? Is this legal DWARF?

Cheers, John D.





More information about the Dwarf-discuss mailing list