문제

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
도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top