develooper Front page | perl.perl5.porters | Postings from March 2008

a small interesting task - separate debug info

Thread Next
Jim Cromie
March 24, 2008 15:49
a small interesting task - separate debug info
Message ID:

I recall seeing this somewhere (maybe perltodo..)

while doing a bit of surface-scratching, I pasted these notes together,
I think theyre enough to get the curious going, maybe further.

In my mind, the biggest questions are around how to integrate it
into Configure, hints, etc, and how general to try to make it.
Presumably, gcc & gdb are nearly ubuiquitous on *nix platforms,

I run fedora 8, and they have reduces this stuff to practice,
so Ive ccd Tom "spot" Callaway. and invite others to offer comments.

anyway heres the notes:

`show debug-file-directory'
     Show the directory GDB searches for separate debugging information

(gdb) show debug-file-directory
The directory where separate debug symbols are searched for is 
(gdb) q

on my fedora box, the system perl includes these pertinent items,
but there is no /usr/lib/debug directory,

readelf -a /usr/bin/perl (trimmed)

  [ 3] NOTE            08048168 000168 000024 00   A  
0   0  4
  [28] .gnu_debuglink    PROGBITS        00000000 002f84 000014 00      
0   0  4

readelf -x3 -x28 /usr/bin/perl
Hex dump of section '':
  0x08048168 04000000 14000000 03000000 474e5500 ............GNU.
  0x08048178 f058de72 15e0fddd 5485c538 75bc54c9 .X.r....T..8u.T.
  0x08048188 42f72597                            B.%.

Hex dump of section '.gnu_debuglink':
  0x00000000 7065726c 352e382e 382e6465 62756700 perl5.8.8.debug.
  0x00000010 a74a6798                            .Jg.

  GNU binary utilities (Binutils) package includes the `objcopy'
utility that can produce the separated executable / debugging
information file pairs using the following commands:

     objcopy --only-keep-debug perl.gcov gcov.debug
     strip -g foo

add info to stripped perl
     objcopy --add-gnu-debuglink=gcov.debug perl.gcov

I believe the above changed the gdb 'run' response to *stop* showing
5-6 lines of "no symbols found" (

parts of a try script, to feed to gdb

[jimc@harpo gcov]$ gdb -q --args perl.stripped -e 1
Using host libthread_db library "/lib/".
(gdb) r
Starting program: /home/jimc/perl/core/dev/gcov.old/perl.stripped -e 1
[Thread debugging using libthread_db enabled]

Program exited normally.
Missing separate debuginfos, use: debuginfo-install glibc.i686

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About