This is the mail archive of the 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]

debug_macinfo buglet

	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
	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
	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

.... <<mac_bug.h>>  <<mac_bug.c>>  <<readelf_hex_dump>>  <<readelf_S>> 

Attachment: mac_bug.h
Description: Binary data

Attachment: mac_bug.c
Description: Binary data

Attachment: readelf_hex_dump
Description: Binary data

Attachment: readelf_S
Description: Binary data

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