简体   繁体   English

如何在 automake c 项目中获取调试符号?

[英]how to get debug symbols in automake c project?

I tried to degub c automake project with Cygwin in Windows.我尝试在 Windows 中使用 Cygwin 调试 c automake 项目。 I ran the following:我运行了以下内容:

./configure CFLAGS="-g -o0"  
make

after that, I loaded在那之后,我加载了

gdb file src/slim.exe

and it says它说

no debugging symbols found

file out says: file out 说:

 file src/slim.exe
 src/slim.exe: PE32+ executable (console) x86-64 (stripped to external PDB), for MS  Windows

when I check with "./configure -help", it shows that --enable-debug no at default.当我检查“./configure -help”时,它显示 --enable-debug 默认没有。

How can I fix it?我该如何解决?

What you have to do is search for *.sym (Symbol files) in obj directory您需要做的是在 obj 目录中搜索 *.sym(符号文件)

Then然后

gdb 

gdb>attach <process -id>

gdb> symbol-file <path of symbol file>

Just had a similar issue when building with the makepkg from Arch Linux, it turns out that you can disable strip from the makepkg.conf configuration, just add a !在 Arch Linux 中使用makepkg构建时遇到了类似的问题,事实证明您可以从makepkg.conf配置中禁用strip ,只需添加一个! before the strip option in the OPTION property, for example:OPTION属性中的strip选项之前,例如:

OPTIONS=(!strip docs !libtool !staticlibs emptydirs zipman purge !upx !debug) OPTIONS=(!strip docs !libtool !staticlibs emptydirs zipman purge !upx !debug)

Edit: I realize this likely will not solve the OP problem, but I got her searching for something like it, and thus thought that the information may be useful for others searching for the same keywords.编辑:我意识到这可能不会解决 OP 问题,但我让她搜索类似的东西,因此认为这些信息可能对其他人搜索相同的关键字有用。

I also had this issue and found this entry.我也有这个问题并找到了这个条目。 I finally figured it out and wanted to add the information here for others as a possible cause:我终于想通了,并希望在此处为其他人添加信息作为可能的原因:

The use of libtool will not give you an exe file you can debug.使用 libtool 不会给你一个可以调试的 exe 文件。 You instead use:你改为使用:

libtool --mode=execute gdb --args filename

I found this when I was looking in the FreeBSD environment and eventually discovered that my program was actually a shell script.我在查看 FreeBSD 环境时发现了这一点,并最终发现我的程序实际上是一个 shell 脚本。

For cygwin you get an exe which is described in the question and cannot tell what the issue might be.对于 cygwin,您会得到一个在问题中描述的 exe,但无法判断可能是什么问题。 The file command gives the same as above for example.例如,file 命令给出与上面相同的命令。

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

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