Skip to content
Advertisement

gdb core dump can not see any symbols after “sudo apt-get install libc6-dbg”

I am trying to debug a program in Ubuntu 12.04(x86_64) LTS with core dump file. At the beginning, the “bt” command is ok, just like below

(gdb) bt
#0  0x00007f3b38e3f425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007f3b38e42b8b in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007f3b38e7d39e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3  0x00007f3b38e87b96 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x00007f3b3947dff6 in std::string::assign(std::string const&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x000000000041cf5a in operator= (__str=..., this=<optimized out>) at /usr/include/c++/4.6/bits/basic_string.h:542

I want to see the symbol in libc.so.6 , so I install libc6-dbg using

sudo apt-get install libc6-dbg

but after install

libc6-dbg

I get all the thing wrong , showing in the below:

(gdb) bt
#0  0x00007f3b38e3f425 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007f3b38e42b8b in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x0000000000000003 in ?? ()
#3  0x00007fffca496804 in ?? ()
#4  0x000000000000000c in ?? ()
#5  0x00007f3b38f84eab in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x0000000000000002 in ?? ()
#7  0x0000000000000020 in ?? ()
#8  0x0000000000000000 in ?? ()

I try to remvoe lib6c-dbg with

sudo apt-get remove libc6-dbg

but it cant make any effect.

Advertisement

Answer

I get all the thing wrong , showing in the below:

What probably happened is that apt-get install libc6-dbg also updated already installed libc6, and the currently installed libc.so.6 no longer matches the one that was used when the core file was generated.

For GDB analysis, you need an exact matching copy as what was used at runtime.

So you’ll need to re-install the old version of libc6 (look in /var/log/apt/history.log to find out what it was), and a matching version of libc6-dbg.

Update:

It seems that the command apt-get install libc6-dbg get the libraries with version 2.15-0ubuntu10.12

Just as I guessed could be the case.

How can I recover it to the version in 2.15-0ubuntu10.4

This is really a sysadmin question, but here is an answer I found on Google 😉

sudo apt-get install libc6=2.15-0ubuntu10.4 libc6-dbg=2.15-0ubuntu10.4

should do the trick.

Advertisement