cmakedwarfdsym

What is in the <target>.dSYM directories created by cmake with the makefile generator on macos?


I'm using CMake on MacOS to generate Makefiles for my C++ project. When I build a target (say, test/AsyncTest), I get that target, plus a test/AsyncTest.dSYM/ directory that contains the following:

test/AsyncTest.dSYM/Contents/Resources/DWARF/AsyncTest
test/AsyncTest.dSYM/Contents/Info.plist

I'm guessing this is debug information (based on the ".dSYM" and the "DWARF" clues), but I haven't found a tool that lets me inspect the AsyncTest file. dwarfdump doesn't recognize it.

So, what exactly is this file? Is there a tool I can use to dump the symbolic information (assuming that's what it is)? Why is CMake generating it when I didn't ask it to? And can I not generate it (since the resulting file is huuuuge)?


Solution

  • macOS / OS X / Darwin / Mach-O objects has a "separated debug" scheme by default.

    when an exe is linked, the static linker (ld64) does not include the debug data in the exe.

    However, the static linker records (in the exe symbol table) the names of the object files that it linked

    A second tool (debug linker, named dsymutil) consumes the exe file table and the original objects and links the debug - producing a standard mach-o package structure containing the linked debug. [by default name.dSYM] where "name" is the name of the exe.

    LLDB and some versions of GDB can consume this package to provide the debug data they need.

    to look at the content :

    The Xcode “dwarfdump” utility can understand the package (dwarfdump name.dSYM).

    The actual content: name.dSYM/Contents/Resources/DWARF/name should also be dumpable by: