[Dwarf-discuss] Debug info generation (target: Fr30) - GCC 4.1.1

David Anderson davea42@earthlink.net
Thu May 31 15:48:14 GMT 2007


Rohit Arul Raj wrote:
> Hi all,
>
> I need some clarification regarding the debug info generated for
> var_arg function.
>   

[ ]
> t r7, at -r15               // value 6
>    10112:	17 06       	st r6, at -r15               // value 5
>    10114:	17 05       	st r5, at -r15               // value 4
>    10116:	17 04       	st r4, at -r15               // contents of name
>    10118:	0f 01       	enter 0x4
>   return 9;
>    1011a:	c0 91       	ldi:8 0x9,r1
> }
>    1011c:	8b 14       	mov r1,r4
>    1011e:	07 0e       	ld @r15+,r14
>    10120:	a3 04       	addsp 16
>    10122:	97 20       	ret
>
>   

[]
> 1><fb>: Abbrev Number: 6 (DW_TAG_subprogram)
>   <fc>     DW_AT_sibling     : <129>	
>   <100>     DW_AT_external    : 1	
>   <101>     DW_AT_name        : fun	
>   <105>     DW_AT_decl_file   : 10	
>   <106>     DW_AT_decl_line   : 5	
>   <107>     DW_AT_prototyped  : 1	
>   <108>     DW_AT_type        : <4b>	
>   <10c>     DW_AT_low_pc      : 0x10110	
>   <110>     DW_AT_high_pc     : 0x10124	
>   <114>     DW_AT_frame_base  : 0	(location list)
>
>  <2><118>: Abbrev Number: 7 (DW_TAG_formal_parameter)
>   <119>     DW_AT_name        : name	
>   <11e>     DW_AT_decl_file   : 10	
>   <11f>     DW_AT_decl_line   : 4	
>   <120>     DW_AT_type        : <b1>	
>   <124>     DW_AT_location    : 2 byte block: 91 0 	(DW_OP_fbreg: 0)
>
> <debug_loc section>
> Offset   Begin    End      Expression
>     00000000 00010110 00010112 (DW_OP_reg15)
>     00000000 00010112 00010114 (DW_OP_breg15: 4)
>     00000000 00010114 00010116 (DW_OP_breg15: 8)
>     00000000 00010116 00010118 (DW_OP_breg15: 12)
>     00000000 00010118 0001011a (DW_OP_breg15: 16)
>     00000000 0001011a 00010124 (DW_OP_breg14: 20)
>
>   
[ ]
> 1. Have i overseen any details while interpreting the debug info?
> 2. Is the compiler generating proper debug info?
>   
You seem to assume the compiler is actually trying to describe the
location of 'name' at all locations. It is not. It is describing the
value  of the 'frame base' at all relevant locations.

Once arguments copied to the stack then it claims 'name' is at frame-base
plus 0.  Before the arguments
copied to the stack the 'address' of name is just wrong.
 (<124> would have to be a location list to describe the location
of name everywhere, but it's not a location list).
This is not particularly unusual usage. It's a QualityOfImplementation
issue and many (most? all?) compilers make no attempt to describe the 
location
of a variable before the function prologue is complete.  One could
call this the 'standard approach' (in the sense of not describing 'name's
location till the prologue is complete).

Not knowing the instruction set I find it hard to tell if the DWARF
is accurate for 0x1011a thru 0x1011c.

David Anderson







More information about the Dwarf-discuss mailing list