How to debug shared libraries compiled with debug information

Viewed 2717

I'm compiling a program with debug simbols that links to a shared library (liballegro) also compiled with debug symbols. When I try to step into a function of this shared library I can't see any code.

file myBin 
mybin: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=d4133ef127e81ffb007c4c17e10f4ddaefac6a0f, with debug_info, not stripped

file lib/liballegro-debug.so
liballegro-debug.so.5.2.2: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=dd75ca87e0ed86832ed02a1c40548a055ad4f551, with debug_info, not stripped

GDB shows how this lib is loaded with debug information:

(gdb) info shared
From                To                  Syms Read   Shared Object Library
0x00007ffff7dd9b40  0x00007ffff7df5110  Yes (*)     /lib64/ld-linux-x86-64.so.2
0x00007ffff7a5a0d0  0x00007ffff7b84591  Yes         correct/path/to/liballegro-debug.so
0x00007ffff76ffd60  0x00007ffff7778eef  Yes (*)     /usr/lib/libm.so.6
0x00007ffff74e1640  0x00007ffff74eefb1  Yes (*)     /usr/lib/libpthread.so.0
[...]

So I put a breakpoint in a function call who lives in the shared library (al_load_bitmap):

90      level->tileset.parent = al_load_bitmap(filename);

The source code of al_load_bitmap is in the file path/to/src/bitmap_io.c which is listed in the output of gdb info sources

And step into it:

(gdb) si
0x0000555555555f00 in al_load_bitmap@plt ()

At this point I can't figure how to see the source code of this function, as list comand show nothing.

How can I debug what happens inside this function?

PD: I tried also with lldb and is the same result, so I'm missing something.

Thank you.

1 Answers
Related