[Dwarf-discuss] Difference in DWARF Info generated by GCC 3.4.6 and GCC 4.1.1

Michael Eager eager@eagercon.com
Mon Apr 16 15:15:43 GMT 2007


Hi Rohit --

Your questions are about how GCC implements DWARF, so it's good
that you also sent it to the GCC mailing list.  That's a better
venue for the discussion that the DWARF mailing list.

You might update your question to tell what target you generating
code for.  Different back-ends generate different DWARF in GCC.

Rohit Arul Raj wrote:
> Hello all,
> 
> I ran a sample program with gcc 3.4.6 and gcc 4.1.1 compiler. I need
> some clarifications regarding the DWARFinfo generated by these 2
> compilers.
> 
> Sample Program:
> 
> #include <stdio.h>
> 
> int fun(const char*, ...);
> 
> /* Variadic function */
> int fun(const char *raj,...)
> {
>   return 9;
> }
> 
> int main()
> {
>   fun("Hello world",3,2);
>   return 0;
> 
> }
> 
> ################# Readelf O/P for 3.4.6 ##############
> 
> <1><e3>: Abbrev Number: 6 (DW_TAG_subprogram)
>      DW_AT_sibling     : <10e>	
>      DW_AT_external    : 1	
>      DW_AT_name        : fun	
>      DW_AT_decl_file   : 7	
>      DW_AT_decl_line   : 7	
>      DW_AT_prototyped  : 1	
>      DW_AT_type        : <4c>	
>      DW_AT_low_pc      : 0	
>      DW_AT_high_pc     : 0x14	
>      DW_AT_frame_base  : 1 byte block: 5e 	(DW_OP_reg14)
> 
>  <2><fe>: Abbrev Number: 7 (DW_TAG_formal_parameter)
>      DW_AT_name        : raj	
>      DW_AT_decl_file   : 7	
>      DW_AT_decl_line   : 6	
>      DW_AT_type        : <a8>	
>      DW_AT_location    : 2 byte block: 91 4 	(DW_OP_fbreg: 4)
> 
> ################# Readelf O/P for 4.1.1 ##############
> 
> 1><103>: Abbrev Number: 6 (DW_TAG_subprogram)
>      DW_AT_sibling     : <12e>	
>      DW_AT_external    : 1	
>      DW_AT_name        : fun	
>      DW_AT_decl_file   : 10	
>      DW_AT_decl_line   : 7	
>      DW_AT_prototyped  : 1	
>      DW_AT_type        : <53>	
>      DW_AT_low_pc      : 0	
>      DW_AT_high_pc     : 0x14	
>      DW_AT_frame_base  : 1 byte block: 5f 	(DW_OP_reg15)
> 
>  <2><11e>: Abbrev Number: 7 (DW_TAG_formal_parameter)
>      DW_AT_name        : raj	
>      DW_AT_decl_file   : 10	
>      DW_AT_decl_line   : 6	
>      DW_AT_type        : <b9>	
>      DW_AT_location    : 2 byte block: 91 0 	(DW_OP_fbreg: 0)
> 
> ###########################################################
> 
> 1. In DIE for fun, with 3.4.6, the frame base is taken in terms of
> Frame Pointer (DW_OP_reg14), where is in 4.1.1, it is taken in terms
> of Stack Pointer (DW_OP_reg15).
> 
> (For my backend, reg-no 14 is Frame Pointer and reg-no 15 is Stack Pointer)
> 
> Is this the expected behavior?
> 
> 2. For the variable, const char *raj, the DIE for 3.4.6 has the
> location mentioned as (fbreg  + 4 [offset] ) whereas for 4.1.1,
> location is mentioned as (fbreg + 0).
> 
> Any specific reason for this behavior in GCC 4.1.1
> 
> Regards,
> Rohit



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




More information about the Dwarf-discuss mailing list