Output source notes in extended DWARF DIEs
ClosedPublic

Authored by bgamari on Sep 26 2015, 11:14 AM.

Details

Summary

There is a great deal of debugging information that GHC produces yet DWARF
does not have entities to capture. These include source notes, and perhaps
eventually Core notes. To their credit, the authors of the DWARF specification
anticipated this and reserved vast swaths of the tag and attribute space for
vendor extensions.

Here we claim a few regions of this space for our own use and emit source notes
and address information for C-- blocks.

This is an alternative approach to the problem initially tackled by D1214.

Test Plan

Test with to-be-released tools

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bgamari updated this revision to Diff 4322.Sep 26 2015, 11:14 AM
bgamari retitled this revision from to [RFC] Output source notes in extended DWARF DIEs.
bgamari updated this object.
bgamari edited the test plan for this revision. (Show Details)
bgamari added a reviewer: scpmw.
bgamari updated the Trac tickets for this revision.
scpmw edited edge metadata.EditedSep 28 2015, 7:34 AM

Yes, good direction to take this. (Just realised I didn't answer your comment in D1213 - sorry about that.)

Only tricky question here is preserving tick scopes properly, as debugSplitProcs messes them up slightly when it splits the debug information by CmmProc. Background is that obviously one Core definition might become more than one CmmProc, but we have to generate separate DWARF trees per procedure - so we have to "split" the big tree into several subtrees, losing a few parent relationships in the process. It is very likely that this will lead to a few cases where CmmProcs arising from deeply inlined code end up with no source notes at all.

Solving this properly would either mean copying ticks or having a DW_AT_ghc_scope_parent attribute, referencing the DIE corresponding to the tick scope parent where it is not the same as the DIE parent.

bgamari updated this revision to Diff 4616.Oct 23 2015, 4:08 AM
bgamari edited edge metadata.

Rebased

bgamari retitled this revision from [RFC] Output source notes in extended DWARF DIEs to Output source notes in extended DWARF DIEs.Oct 23 2015, 4:33 AM
bgamari edited edge metadata.
In D1279#36415, @scpmw wrote:

Yes, good direction to take this. (Just realised I didn't answer your comment in D1213 - sorry about that.)

Only tricky question here is preserving tick scopes properly, as debugSplitProcs messes them up slightly when it splits the debug information by CmmProc. Background is that obviously one Core definition might become more than one CmmProc, but we have to generate separate DWARF trees per procedure - so we have to "split" the big tree into several subtrees, losing a few parent relationships in the process. It is very likely that this will lead to a few cases where CmmProcs arising from deeply inlined code end up with no source notes at all.

Right, I believe I have observed this during testing.

Solving this properly would either mean copying ticks or having a DW_AT_ghc_scope_parent attribute, referencing the DIE corresponding to the tick scope parent where it is not the same as the DIE parent.

Yeah, I've been turning these two options over in my head. I'm still a bit undecided as to which would be better although I'm leaning towards copying for the sake of simplicity of both reading and writing.

bgamari updated this revision to Diff 4865.Nov 1 2015, 11:09 AM
bgamari edited edge metadata.

Don't include patches in D1387

This revision was automatically updated to reflect the committed changes.