Commit
The conversion to DWARF is always lossy, so we put all the extra bits of information into an extra object file section (.debug-ghc). Notes: * We use the eventlog format. This might seem like a slightly arbitrary choice, but makes it easy to copy debug data into eventlogs later in order to do profiling. In the meantime, it's well-defined and extensible, so until we run out of record IDs there's no strong reason against it either. * Core notes now cause the complete Core to be copied. We are reasonably smart about this: We never emit a piece of Core twice, and use a compact binary representation for most Core constructors. On the other hand, we just pretty-print types as well as names and emit them as strings. This can sometimes lead to packets becoming too large for the eventlog format to handle (we had types break the 20k loc mark). In order to not run into these kinds of problems, we just omit packets that are longer than a certain threshold. * The amount of data generated here is significant. We therefore use faily low-level generation code using memory buffers. Furthermore, we include the data as a string, escaped using another well-optimized low-level routine. All this might make it hard to read debug data in the assembly, but is absolutely required for debugging not to become a significant resource hog. * The eventlog IDs used here were chosen primarily to avoid collisions. If this code gets merged they should be adjusted appropriately.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,12 @@ dwarfGen df modLoc us blocks = do | |
debugFrameHeader framesU $$ | ||
debugFrames framesU procs | ||
|
||
return (infoSct $$ abbrevSct $$ lineSct $$ frameSct, us'') | ||
-- .debug_ghc section: debug data in eventlog format (GHC-specific, obviously) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Tarrasch
|
||
evData <- writeDebugToEventlog df modLoc blocks | ||
let ghcSct = dwarfGhcSection $$ | ||
pprBuffer evData | ||
|
||
return (infoSct $$ abbrevSct $$ lineSct $$ frameSct $$ ghcSct, us'') | ||
|
||
-- | Header for a compilation unit, establishing global format | ||
-- parameters | ||
|
Since this section is large and non-standard, perhaps we should add a flag so it can be emitted if users only care for the standard debug info e.g. because they want (some kind of) stack traces. I'd be worried in growing binaries a lot just to get stack traces.
Have a look at http://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html for an idea of what such flags could look like. Interesting options include
-gvms<level>
, to control the amount of information.-pg
, in case you have some data used for profiling only.