http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49202
Summary: MMIX: Wrong debugging information generated (UNKNOWN:
length 2)
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: [email protected]
ReportedBy: [email protected]
Host: Ubuntu on x86_64
Target: MMIX
Build: gcc-4.6.0 with binutils-2.21
Created attachment 24381
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24381
Generated object file
Some C constructs seem to cause wrong debugging information. That is especially
a problem, because gdb ignores all the following information, so that debugging
is impossible (line by line in C source).
For example, the following C source causes the problem:
----
static int strncmpx(const char *str1,const char *str2,int count) {
int rem = count;
while(*str1 && *str2 && rem-- > 0) {
if(*str1++ != *str2++)
return str1[-1] < str2[-1] ? -1 : 1;
}
if(rem <= 0)
return 0;
if(*str1 && !*str2)
return 1;
return -1;
}
int main(void) {
strncmpx("foo","bar",3);
return 0;
}
----
Compiling this file and reading the line number information results in:
$ mmix-elf-escape-gcc -o t.o -c t.c -g
$ mmix-elf-escape-readelf --debug-dump=decodedline t.o
readelf: Warning: unable to apply unsupported reloc type 5 to section
debug_line
Decoded dump of debug contents of section .debug_line:
CU: t.c:
File name Line number Starting address
t.c 1 0
t.c 2 0x28
t.c 3 0x38
t.c 4 0x3c
t.c 5 0xa8
UNKNOWN: length 2
t.c 5 0xe0
UNKNOWN: length 2
t.c 5 0xe8
UNKNOWN: length 2
t.c 5 0xec
UNKNOWN: length 2
t.c 3 0xf0
UNKNOWN: length 2
t.c 3 0x10c
UNKNOWN: length 2
t.c 3 0x128
t.c 7 0x16c
t.c 8 0x184
t.c 9 0x18c
UNKNOWN: length 2
t.c 9 0x1a8
t.c 10 0x1c4
t.c 11 0x1cc
t.c 12 0x1d0
t.c 14 0x1dc
t.c 15 0x1ec
t.c 16 0x218
t.c 17 0x21c
I've attached the object file t.o.