Loading shared libraries when cross-debugging a core file

Jan Kratochvil jan.kratochvil@redhat.com
Mon Jan 16 19:02:00 GMT 2012


On Thu, 12 Jan 2012 21:35:53 +0100, Ian Wells wrote:
> I'm trying to pin down an issue I'm having with shared libraries not
> being autoloaded, with no error message, when I cross-debug a ppc
> (Linux / ELF) core file on a cross-debugger compiled on Linux /
> x86_64.

It works for me:
$ d=~/t/core.ppc64;strace -s200 -o /tmp/xj -q ./gdb -nx -ex "set sysroot $d" -ex "set debug-file-directory $d" -ex "file $d/sleep" -ex "core-file $d/core" -ex "info shared"
GNU gdb (GDB) 7.4.50.20120116-cvs
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Reading symbols from /home/jkratoch/t/core.ppc64/sleep...Reading symbols from /home/jkratoch/t/core.ppc64/sleep.debug...done.
done.
warning: core file may not match specified executable file.
[New LWP 28796]
warning: Can't read pathname for load map: Input/output error.
Core was generated by `sleep 1h '.
Program terminated with signal 11, Segmentation fault.
#0  0x00000080f9234818 in __nanosleep_nocancel () from /home/jkratoch/t/core.ppc64/lib64/libc.so.6
>From                To                  Syms Read   Shared Object Library
0x00000080f919b860  0x00000080f92cc5b0  Yes (*)     /home/jkratoch/t/core.ppc64/lib64/libc.so.6
0x00000080f90e53c0  0x00000080f9104850  Yes (*)     /home/jkratoch/t/core.ppc64/lib64/ld64.so.1
(*): Shared library is missing debugging information.
(gdb) q
$ ls -l $d
total 4900
-rw------- 1 jkratoch jkratoch 2490368 Jan 16 19:17 core
-rwxr-xr-x 1 jkratoch jkratoch  227992 Nov  3 15:03 ld-2.12.so*
lrwxrwxrwx 1 jkratoch jkratoch      10 Jan 16 19:29 ld64.so.1 -> ld-2.12.so*
lrwxrwxrwx 1 jkratoch jkratoch       1 Jan 16 19:32 lib64 -> ./
-rwxr-xr-x 1 jkratoch jkratoch 2178192 Nov  3 15:03 libc-2.12.so*
lrwxrwxrwx 1 jkratoch jkratoch      12 Jan 16 19:29 libc.so.6 -> libc-2.12.so*
-rwxr-xr-x 1 jkratoch jkratoch   34296 Oct  5 15:29 sleep*
-r--r--r-- 1 jkratoch jkratoch   80696 Oct  5 15:29 sleep.debug


> I understand that I will need to point gdb in to the location of the
> library files - this documentation suggests this is the 'sysroot'

Yes.


> If not with a straightforward answer, can someone
> point me to the code in gdb that identifies which libraries are loaded
> so that I can work out what it's doing?

solib-svr4.c


Regards,
Jan



More information about the Gdb mailing list