* Manually checking build id in elf files
@ 2009-09-03 13:03 Alex Bennee
2009-09-03 13:11 ` Jan Kratochvil
0 siblings, 1 reply; 5+ messages in thread
From: Alex Bennee @ 2009-09-03 13:03 UTC (permalink / raw)
To: gdb
Hi,
I'm trying to track down a weird failure in oprofile due to bad CRC's
in debug files [1]. As has
been noted in the bug report gdb should complain. However I'm able to
load the symbol-file
with nary a harsh word from gdb. The manual says gdb uses one of two
methods to verify
a symbol file is the correct one. The second method mentions "Build
Id" and the ld man page
seems to imply I should see a "note" section in the library to
indicate the build id.
I'd like to manually check it but readelf doesn't show any such notes:
vnms@vnms:~$ readelf -n /usr/lib/libcairo.so.2.17.3
vnms@vnms:~$ readelf -n /usr/lib/debug/usr/lib/libcairo.so.2.17.3
vnms@vnms:~$
Am I missing something? Is there a way to use readelf to read this information?
[1] https://bugs.launchpad.net/ubuntu/+source/cairo/+bug/415424
--
Alex, homepage: http://www.bennee.com/~alex/
http://www.half-llama.co.uk
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Manually checking build id in elf files
2009-09-03 13:03 Manually checking build id in elf files Alex Bennee
@ 2009-09-03 13:11 ` Jan Kratochvil
2009-09-03 13:45 ` Alex Bennee
0 siblings, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2009-09-03 13:11 UTC (permalink / raw)
To: Alex Bennee; +Cc: gdb
On Thu, 03 Sep 2009 15:03:05 +0200, Alex Bennee wrote:
> I'd like to manually check it but readelf doesn't show any such notes:
>
> vnms@vnms:~$ readelf -n /usr/lib/libcairo.so.2.17.3
> vnms@vnms:~$ readelf -n /usr/lib/debug/usr/lib/libcairo.so.2.17.3
Try elfutils:
# eu-readelf -n /lib64/libc.so.6
Note section [ 1] '.note.gnu.build-id' of 36 bytes at offset 0x270:
Owner Data size Type
GNU 20 GNU_BUILD_ID
Build ID: ec8dd400904ddfcac8b1c343263a790f977159dc
[...]
# eu-unstrip -n -e /lib64/libc.so.6
0x3979600000+0x36d868 ec8dd400904ddfcac8b1c343263a790f977159dc@0x3979600280 /lib64/libc.so.6 /usr/lib/debug/lib64/libc-2.10.1.so.debug
> Am I missing something? Is there a way to use readelf to read this information?
From binutils you can use objdump:
# objdump -s -j .note.gnu.build-id /lib64/libc.so.6
[...]
Contents of section .note.gnu.build-id:
3979600270 04000000 14000000 03000000 474e5500 ............GNU.
----------->
3979600280 ec8dd400 904ddfca c8b1c343 263a790f .....M.....C&:y.
3979600290 977159dc .qY.
Regards,
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Manually checking build id in elf files
2009-09-03 13:11 ` Jan Kratochvil
@ 2009-09-03 13:45 ` Alex Bennee
2009-09-03 14:24 ` Jan Kratochvil
2009-09-03 14:47 ` Andreas Schwab
0 siblings, 2 replies; 5+ messages in thread
From: Alex Bennee @ 2009-09-03 13:45 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb
2009/9/3 Jan Kratochvil <jan.kratochvil@redhat.com>:
> On Thu, 03 Sep 2009 15:03:05 +0200, Alex Bennee wrote:
>> I'd like to manually check it but readelf doesn't show any such notes:
>>
>> vnms@vnms:~$ readelf -n /usr/lib/libcairo.so.2.17.3
>> vnms@vnms:~$ readelf -n /usr/lib/debug/usr/lib/libcairo.so.2.17.3
>
> Try elfutils:
heh, there was me assuming readelf was part of elfutils :-)
>
> # eu-readelf -n /lib64/libc.so.6
> Note section [ 1] '.note.gnu.build-id' of 36 bytes at offset 0x270:
> Owner Data size Type
> GNU 20 GNU_BUILD_ID
> Build ID: ec8dd400904ddfcac8b1c343263a790f977159dc
> [...]
>
> # eu-unstrip -n -e /lib64/libc.so.6
> 0x3979600000+0x36d868 ec8dd400904ddfcac8b1c343263a790f977159dc@0x3979600280 /lib64/libc.so.6 /usr/lib/debug/lib64/libc-2.10.1.so.debug
I do seem to be seeing different output:
vnms@vnms:~$ eu-unstrip -n -e /lib/libc-2.7.so
0+0x361278 - /lib/libc-2.7.so /usr/lib/debug/lib/libc-2.7.so
vnms@vnms:~$ eu-readelf -n /lib/libc-2.7.so
Note section [ 1] '.note.ABI-tag' of 32 bytes at offset 0x270:
Owner Data size Type
GNU 16 VERSION
OS: Linux, ABI: 2.6.8
vnms@vnms:~$ objdump -s -j .note.gnu.build-id /lib/libc.so.6
/lib/libc.so.6: file format elf64-x86-64
vnms@vnms:~$ eu-unstrip -n -e /lib/libc-2.7.so
0+0x361278 - /lib/libc-2.7.so /usr/lib/debug/lib/libc-2.7.so
vnms@vnms:~$ eu-readelf -n /usr/lib/libcairo.so.2.17.3
vnms@vnms:~$ objdump -s -j .note.gnu.build-id /usr/lib/libcairo.so.2.17.3
/usr/lib/libcairo.so.2.17.3: file format elf64-x86-64
My version is:
$ eu-readelf --version
readelf (Red Hat elfutils) 0.131
Which makes me wonder why gdb is allowing the load of the symbol file given:
1. There seems to be no build ID
2. The CRC in the library doesn't match the CRC of the library.debug
The rabbit hole gets deeper :-/
--
Alex, homepage: http://www.bennee.com/~alex/
http://www.half-llama.co.uk
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Manually checking build id in elf files
2009-09-03 13:45 ` Alex Bennee
@ 2009-09-03 14:24 ` Jan Kratochvil
2009-09-03 14:47 ` Andreas Schwab
1 sibling, 0 replies; 5+ messages in thread
From: Jan Kratochvil @ 2009-09-03 14:24 UTC (permalink / raw)
To: Alex Bennee; +Cc: gdb
On Thu, 03 Sep 2009 15:45:32 +0200, Alex Bennee wrote:
> My version is:
> $ eu-readelf --version
> readelf (Red Hat elfutils) 0.131
This version should already have the build-id support.
> Which makes me wonder why gdb is allowing the load of the symbol file given:
Explicit `symbol-file' command will load it as it can load arbitrary file for
the symbols. Automatic finding of the associated separate debug info files
(find_separate_debug_file) ignores any files with non-matching build-id or
CRC32.
> 1. There seems to be no build ID
Yes, I think your mail has nothing to do with build-id.
> 2. The CRC in the library doesn't match the CRC of the library.debug
In the Bug it is shown libc has correct CRC32 but libcairo does not.
Regards,
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Manually checking build id in elf files
2009-09-03 13:45 ` Alex Bennee
2009-09-03 14:24 ` Jan Kratochvil
@ 2009-09-03 14:47 ` Andreas Schwab
1 sibling, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2009-09-03 14:47 UTC (permalink / raw)
To: Alex Bennee; +Cc: Jan Kratochvil, gdb
Alex Bennee <kernel-hacker@bennee.com> writes:
> Which makes me wonder why gdb is allowing the load of the symbol file given:
>
> 1. There seems to be no build ID
> 2. The CRC in the library doesn't match the CRC of the library.debug
The CRC is stored in the .gnu_debuglink section.
Andreas.
--
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E
"And now for something completely different."
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-09-03 14:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-03 13:03 Manually checking build id in elf files Alex Bennee
2009-09-03 13:11 ` Jan Kratochvil
2009-09-03 13:45 ` Alex Bennee
2009-09-03 14:24 ` Jan Kratochvil
2009-09-03 14:47 ` Andreas Schwab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox