Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

cmake

dsym

dwarf

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)?

like image 265
Eric Niebler Avatar asked Jul 31 '18 20:07

Eric Niebler


People also ask

What is dSYM file in IOS?

A dSYM file is an ELF file that contains DWARF (debugging with attributed record formats) debug information for your application. DWARF is a debugging file format that supports source-level debugging.

How do I open a dSYM file on a Mac?

You can open a DSYM file with Xcode by right-clicking the file and selecting "Show Package Contents". Another type of DSYM file contains geometric data written in Geometric Description Language to define a 2D or 3D model in ArchiCAD computer-aided design software.

What are dSYM files used for?

Debug builds of an app place the debug symbols inside the compiled binary file by default, while release builds of an app place the debug symbols in a companion Debug Symbol file ( dSYM ) to reduce the size of the distributed app.

Where is dSYM?

dSYM file automatically for you when you use the Archive option. The created archive contains your app and its dSYM and is stored in ~/Library/Developer/xcode/Archives .


1 Answers

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:

  • llvm-dwarfdump
  • BINUTILS objdump (if that’s been built for the appropriate darwin target).
like image 147
iains Avatar answered Sep 29 '22 07:09

iains