tags:

views:

229

answers:

2

Hi.

I want to compile an application with debug information using gcc and gdb. When I do the following, the debug (.dSYM) files are generated correctly:

gcc -ggdb src/test.c -o build/test

If I, however, split this into a compile step and a link step, like this:

gcc -ggdb -c src/test.c -o build/test.o
gcc -ggdb build/test.o -o dist/bin/test

… no .dSYM files are generated at all, and therefore gdb does not show me the source line of code where a crash occurs, which makes debugging a lot more difficult. Since I have quite a bit of source files, compiling and linking them all in a single gcc invocation is not possible.

How can I let gcc generate the .dSYM files when using separate compile and link steps?

+2  A: 

You can also specify -g3 in you compilation options so that gcc puts debug symbols right into the binary, not in a separate file. Not sure if that is what you need.

pau.estalella
+1  A: 

Check the second comment on the first answer in this post.

Its a quirk. Maybe you can run the "dsymutil" program manually to generate dSYM files.

frunsi