arslan
arslan

Reputation: 2224

how to get debug symbols in automake c project?

I tried to degub c automake project with Cygwin in Windows. 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 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.

How can I fix it?

Upvotes: 0

Views: 1536

Answers (3)

Gree
Gree

Reputation: 13

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. 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.

For cygwin you get an exe which is described in the question and cannot tell what the issue might be. The file command gives the same as above for example.

Upvotes: 1

zpon
zpon

Reputation: 1530

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 ! before the strip option in the OPTION property, for example:

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.

Upvotes: 0

Sohil Omer
Sohil Omer

Reputation: 1181

What you have to do is search for *.sym (Symbol files) in obj directory

Then

gdb 

gdb>attach <process -id>

gdb> symbol-file <path of symbol file>

Upvotes: 1

Related Questions