I am trying to install debug symbols for gcc. Searching around I have:

gcc-4.7-dbgsym/xenial,now 4.7.4-3ubuntu12 amd64 [installed]
debug symbols for package gcc-4.7

gcc-4.7-multilib-dbgsym/xenial,now 4.7.4-3ubuntu12 amd64 [installed]
debug symbols for package gcc-4.7-multilib

gdb does not find the debug symbols when I load gcc-4.7 into the debugger. So I checked to see which files these packages had installed:

$>  dpkg-query -L gcc-4.7-multilib-dbgsym 
$>  dpkg-query -L gcc-4.7-dbgsym 

It seems these packages are empty? Am I doing something wrong? Or how can I check if the debug symbols are actually installed.

Checking under /usr/lib/debug I didn't find anything.

  • Where did you get the package gcc-4.7-dbgsym? It doesn't seem to be in the standard Ubuntu repos – steeldriver Jul 19 '17 at 16:53
  • Hmm, I thought it came from the standard repo. I can see it listed here. Otherwise I followed this guide for getting debug symbols. – gatoWololo Jul 20 '17 at 20:50

I ended up getting the GCC source directly from apt:

apt get source gcc

This installs the gcc source into a local directory. From here, I compiled GCC with debug flags and no optimizations. The compilation takes a very long time, so you might consider loading the gcc binary through gdb and merely pointing to the source like this, basically using the dir command. This may lead to some unexpected behavior as GCC will still have optimizations on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.