views:

1665

answers:

2

Hi,

Why compiling C++ in Mac always create *.dSYM directories? Is there a way to disable that?

A: 

I assume your using Xcode. Go to "Project"/"Edit Project Settings" menu item, click on build tab, under "GCC 4.0 - Code Generation" section, uncheck Generate Debug Symbols. You can type in "sym" in search field to help find it.

daustin777
+6  A: 

It's because your Xcode project is set up to build debug symbols with an external dSYM file. This is actually very handy for release builds, as it means that you can strip debug symbols from your app, and when a user sends a crashdump to you, you can use the original dSYM file to generate a proper stacktrace for debugging.

Anyways, you don't need to disable debug symbol generation in your project. Instead, just change the debug symbol type to DWARF (instead of "DWARF with dSYM File"). You can also use Stabs, but that's the old format.

Edit: Ah, I see you meant from the command line, not from Xcode. I'm not sitting in front of my mac atm, but I see from the gcc4 manpage than you can specify -gstabs to use the Stabs format.

Nik Reiman
hi, how do you change the debug symbol? Is there a command line for it?
neversaint
Interesting quirk: on MacOS 10.6.2, if you include a source file in the 'link' line, then the dsymutil program is run to generate the .dSYM information; if you only link object files and libraries, then the dsymutil program is not run so the .dSYM information is not generated. You can validate this with the '-v' option to GCC which shows the programs executed by 'gcc'.
Jonathan Leffler
You can also use -ggdb, which I think enables more features than stabs if you plan to debug with gdb.
Quantum7