9
votes

I installed gcc 4.8.1 on Ubuntu 12.04 (I had to add ppa to do that) now gdb displays the following message:

Unable to find dynamic linker breakpoint function. GDB will be unable to debug shared library initializers and track explicitly loaded dynamic code.Could not load shared library symbols for 5 libraries, e.g. /usr/lib/x86_64-linux-gnu/libstdc++.so.6. Use the "info sharedlibrary" command to see the complete listing. Do you need "set solib-search-path" or "set sysroot"?

I did google and I found this article to best answer my question: http://www.fayewilliams.com/2013/01/31/gdb-unable-to-find-dynamic-linker-breakpoint-function/

however I still do not understand what to do exactly. Could someone help. THX!

2
Alternatively you could pass -gdwarf-2 to the compiler to generate debug symbols compatible with GDB 7.4.legends2k

2 Answers

13
votes

I also had the same problem and was able to solve it.

I installed the last "stable" version of GCC (4.8.1) from this PPA (https://launchpad.net/~ubuntu-toolchain-r/+archive/test), and everything was perfect until I had to deal with the debugging issue. You can notice that in this PPA the toolchain does not provide an updated version of GDB for dealing with the compiler upgrade. In fact, I didn't found any PPA providing a newer version of GDB.

In my case I solved this situation downloading and installing the latest stable version of GDB (7.6) from its website (http://www.sourceware.org/gdb/). This version of GDB is able to resolve the symbols and give me all the necessary information of binaries generated with Gcc 4.8.1, even if I'm using the new c++11 standard (code compiled with the -std=c++11 flag).

Take into account that installing this new version of GDB manually will install, by default, the binary in /usr/local/bin/gdb.

2
votes

Gdb is usually shipped with the toolchain.

You're probably using gdb shipped with the previous toolchain. Use

  which gdb

to discover which gdb you're using.

To debug a program compiled with the new compiler, you have to use the new gdb, weherever it is.