This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Debug info generation (target: Fr30) - GCC 4.1.1
- From: "Rohit Arul Raj" <rohitarulraj at gmail dot com>
- To: gcc <gcc at gcc dot gnu dot org>
- Cc: dwarf-discuss at lists dot dwarfstd dot org dot
- Date: Thu, 31 May 2007 19:37:33 +0530
- Subject: Debug info generation (target: Fr30) - GCC 4.1.1
Hi all,
I need some clarification regarding the debug info generated for
var_arg function.
Target: fr30
Compiler version : v4.1.1
binutils : v2.16
newlib : v1.14.0
<<<<<<<<<< SAMPLE TEST PROGRAM >>>>>>>>>>>>
#include <stdio.h>
int fun(const char *name,...)
{
return 9;
}
int main()
{
fun("Rohit",4,5,6,7);
return 0;
}
<<<<<<<<<<<< OBJDUMP >>>>>>>>>>>>>>>
00010110 <fun>:
#include <stdio.h>
/* Variadic function */
int fun(const char *name,...)
{
10110: 17 07 st r7,@-r15 // value 6
10112: 17 06 st r6,@-r15 // value 5
10114: 17 05 st r5,@-r15 // value 4
10116: 17 04 st r4,@-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
00010124 <main>:
int main()
{
10124: 17 81 st rp,@-r15
10126: 0f 02 enter 0x8
fun("Rohit",4,5,6,7);
10128: c0 71 ldi:8 0x7,r1
1012a: 14 f1 st r1,@r15
1012c: 9f 84 00 01 ldi:32 0x10f60,r4
10130: 0f 60
10132: c0 45 ldi:8 0x4,r5
10134: c0 56 ldi:8 0x5,r6
10136: c0 67 ldi:8 0x6,r7
10138: 9f 81 00 01 ldi:32 0x10110,r1
1013c: 01 10
1013e: 97 11 call @r1
return 0;
10140: c0 01 ldi:8 0x0,r1
}
10142: 8b 14 mov r1,r4
10144: 9f 90 leave
10146: 07 81 ld @r15+,rp
10148: 97 20 ret
...
<<<<<<<<<<<<<< READELF DUMP >>>>>>>>>>>>>>>
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)
From the readelf output, the location information for variable "name"
is generated by location lists.
For address range 0x00010110 - 0x00010112, the expression for variable
"name" is in terms of stack pointer.But at that instant, the stack
pointer contains the value 7.
For address range 0x00010118 - 0x0001011a, the expression is set as SP
+ 16, when it should have been SP + 0.
1. Have i overseen any details while interpreting the debug info?
2. Is the compiler generating proper debug info?
Regards,
Rohit