Denis Defreyne
Denis Defreyne

Reputation: 1

gcc not generating debug files

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?

Upvotes: 2

Views: 3970

Answers (2)

Frunsi
Frunsi

Reputation: 7147

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.

Upvotes: 3

pau.estalella
pau.estalella

Reputation: 2243

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.

Upvotes: 2

Related Questions