简体   繁体   English

g ++没有编译调试信息

[英]g++ not compiling in debug information

I have a small .cpp program that compiles and runs and I want to add debugging information to it, so I compile like this: 我有一个编译和运行的小.cpp程序,我想向它添加调试信息,所以我这样编译:

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. 根据我的经验, objdump -g不是检查gcc调试输出的最可靠方法。 Try objdump -W . 试试objdump -W

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM