This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: debug_macinfo buglet


The last byte of the debug_macinfo is at offset 0x2313 (readelf
--hex-dump=34)
Since the first byte is at offset 0 and the size of the section is
0x2314 (readelf -S). However deviation of from the specs is still there. 
The "zero" byte is missing.

rgds.
Nitin.
>  -----Original Message-----
> From: 	Nitin  Gupta, Noida  
> Sent:	Friday, May 17, 2002 6:27 PM
> To:	'gcc-bugs@gcc.gnu.org'
> Subject:	debug_macinfo buglet
> 
> Hi,
> 	During analysis of contents of .debug_macinfo 
> 	I discovered that the contents are not as per DWARF2 specifications.
> 	The DWARF2  spec says [section 6.3]
> 
> 		Each macinfo entry consists of a "type code" and
> 		up to two additional operands. The series of entries for a
> given compilation unit ends with an
> 		entry containing a type code of 0.
> 	
> 	The DWARF3 specs also retains this.
> 
> 	However the last byte of the .debug_macinfo section, of the elf
> binary generated by gcc3.1, 
> 	does not seems to be a zero. 
> 	
> 	I'm using
> 	$ gcc3.1 -v
> 	Reading specs from
> /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs
> 	Configured with: ../3.1/gcc/configure --prefix=/usr/local
> 	Thread model: single
> 	gcc version 3.1
> 
> 	$ gcc3.1 -O3 -g3 mac_bug.c
> 	$ readelf -S a.out    
> 	....
> 	
> 	  [31] .debug_line       PROGBITS        00000000 003e10 000275 00
> 0   0  1
> 	  [32] .debug_frame      PROGBITS        00000000 004088 000034 00
> 0   0  4
> 	  [33] .debug_str        PROGBITS        00000000 0040bc 00002f 00
> 0   0  1
> 	  [34] .debug_macinfo    PROGBITS        00000000 0040eb 002314 00
> 0   0  1
> 	  [35] .note             NOTE            00000000 0063ff 00003c 00
> 0   0  1
> 	  [36] .shstrtab         STRTAB          00000000 00643b 00015a 00
> 0   0  1
> 	  [37] .symtab           SYMTAB          00000000 006bb0 000530 10
> 38  3e  4
> 	  [38] .strtab           STRTAB          00000000 0070e0 00022c 00
> 0   0  1
> 	.....
> 	.....
> 	$ readelf --hex-dump=34 a.out    
> 	....(showing last 2 lines)
> 	  0x00002300 226e5c64 6c726f57 206f6c6c 65482228 ("Hello World\n"
> 	  0x00002310                           		    04040029 )...
> 	                                                                 ^
> 	The last byte of macinfo should be at 0x2314 and it is 04
> (MACINFO_END_FILE).
> 	The mac_bug.c is a simple hello world programme. The program and
> readelf outputs 
> 	are attached of your reference.
> 	
> 	However rest of the information in the section seems to be correct.
> 
> Thanks and Regards
> Nitin.
> 
> .... << File: mac_bug.h >>  << File: mac_bug.c >>  << File:
> readelf_hex_dump >>  << File: readelf_S >> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]