[Dwarf-Discuss] RFC: DWARF Extensions for Separate Debug Info Files ("Fission")

Jason Molenda jmolenda at apple.com
Thu Sep 22 18:35:44 PDT 2011


Hi Cary, just one quick clarification -

On Sep 22, 2011, at 5:21 PM, Cary Coutant wrote:

> Previous Implementations of Separate Debug Information
> ======================================================
> 
> In the Sun and HP implementations, the debug information in the
> relocatable objects still requires relocation at debug time, and
> the debugger must read the summary information from the
> executable file in order to map symbols and sections to the
> output file when processing and applying the relocations. The
> Apple implementation avoids this cost at debug time, but at the
> cost of having a separate link step for the debug information.


The Apple approach has both the features of the Sun/HP implementation as well as the ability to create a standalone debug info file. 

The compiler puts DWARF in the .o file, the linker adds some records in the executable which help us to understand where files/function/symbols landed in the final executable[1].  If the user runs our gdb or lldb on one of these binaries, the debugger will read the DWARF directly out of the .o files on the fly.  Because the linker doesn't need to copy around/update/modify the DWARF, link times are very fast.  If the developer decides to debug the program, no extra steps are required - the debugger can be started up & used with the debug info still in the .o files.

Clearly this is only viable if you have the .o files on your computer so we added a command, "dsymutil", which links the DWARF from the .o files into a single standalone ".dSYM" file.  The executable file and the dSYM file have a shared 128-bit number to ensure that the debug info and the executable match; the debugger will ignore a dSYM with a non-matching UUID for a given executable.  A developer will typically create a dSYM when they sending a copy of the binary to someone and want to provide debug information, or they are archiving a released binary, or they want to debug it on another machine (where the .o files will not be in place.)

In practice people create dSYMs rarely -- when they are doing iterative development on their computer, all of the DWARF sits in the .o files unprocessed unless they launch a debugger, link times are fast.


As a minor detail, the dSYM is just another executable binary image on our system (Mach-O file format), sans any of the text or data of the real binary file, with only the debug_info, etc. sections.  The name "dSYM" was a little joke based on the CodeWarrior "xSYM" debug info format.

J



More information about the Dwarf-Discuss mailing list