objdump -S omits source when input uses .gnu_debuglink

Andi Kleen andi@firstfloor.org
Sun Jun 10 13:21:00 GMT 2007


Noah Misch <noah@cs.caltech.edu> writes:

> When an object's debugging information resides in a separate file, linked via a
> .gnu_debuglink section, `objdump -S' does not show source code; the output is
> rigorously identical to that of `objdump -d'.  The following command sequence
> illustrates the problem:
> 
>   echo 'int main() { return 0; }' >foo.c
>   gcc -g foo.c -o foo
>   objcopy --strip-debug --add-gnu-debuglink=foo foo foo-link
>   objdump -S foo	| sed -n '/<main>/,/^$/p'
>   objdump -S foo-link	| sed -n '/<main>/,/^$/p'
> 
> The gdb `list' command reads source from both objects without trouble.
> 
> CVS exhibits the problem, as do older versions.

It's just that nobody implemented parsing that header as far as I can see. 
It's not really a bug, just a missing feature. Probably would not
very hard to add.

Currently it is one of -S's smallest issues -- it is generally totally
unusable with current gcc and optimization
[see the patch I posted a few days ago]

-Andi



More information about the Binutils mailing list