Question

I have a small .cpp program that compiles and runs and I want to add debugging information to it, so I compile like this:

g++ -g a.cpp

Then if I check for debug information with the following command:

# objdump -g a.out
a.out:     file format elf64-x86-64
objdump: a.out: no recognized debugging information

What am I doing wrong? I expected debug information to be found.

Version information:

Linux xxx 2.6.18-308.el5 #1 SMP Fri Jan 27 17:17:51 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52)
GNU objdump 2.17.50.0.6-20.el5 20061020
Was it helpful?

Solution

In my experience, objdump -g is not the most reliable way to check for debug output of gcc. Try objdump -W.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top