The conversion to DWARF is always lossy, so we put all the extra
bits of information into an extra object file section (.debug-ghc).
- We use the eventlog format. This might seem like a slightly arbitrary choice, but makes it easy to copy debug data into the eventlog 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.
Depends on D1213.
- Compress .debug_ghc section to reduce file sizes
- Document format of produced event log records.