2

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?

Denis Defreyne
  • 2,213
  • 15
  • 18

2 Answers2

3

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.

Community
  • 1
  • 1
Frunsi
  • 7,099
  • 5
  • 36
  • 42
2

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
  • 2,197
  • 1
  • 15
  • 20
  • Question, by adding the -g3 will put all the debug symbols in the bin? That would be the same as the debug symbols from the .dSYM? –  Aug 21 '13 at 12:50