Page MenuHomePhabricator

[DWARF][WIP] Add Skeleton CU to DWO CU during creation.
Needs ReviewPublic

Authored by ayermolo on Feb 16 2021, 6:14 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Context: https://lists.llvm.org/pipermail/llvm-dev/2021-February/148521.html

Work in progress diff, to start a conversation how to fix address/location apis for debug fission.

Diff Detail

Event Timeline

ayermolo created this revision.Feb 16 2021, 6:14 PM
ayermolo requested review of this revision.Feb 16 2021, 6:14 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2021, 6:14 PM
ayermolo retitled this revision from [WIP] Add Skeleton CU to DWO CU during creation. to [DWARF][WIP] Add Skeleton CU to DWO CU during creation..Feb 16 2021, 6:23 PM
dblaikie added inline comments.
llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
420–421

It's not clear to me how/what this API does - "Unit" is a DWO CU and "this" is the DWARFContext for the executable file (as opposed to for the DWO or DWP file)? Or the other way around?

ayermolo added inline comments.Feb 18 2021, 3:21 PM
llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
420–421

The "this" DWARFContext is tied to DWO CU. The Unit is for the CU from the binary, the Skeleton CU.

So for example in this user code:
The DwCtx is Context for the binary.

for (const auto &CU : DwCtx->compile_units()) {

auto *const DwarfUnit = CU.get();
 if (llvm::Optional<uint64_t> DWOId = DwarfUnit->getDWOId()) {
   auto *CUDWO = static_cast<DWARFCompileUnit*>(DwarfUnit->getNonSkeletonUnitDIE(false).getDwarfUnit());
   ...
 }

}

When getNonSkeletonUnitDIE is invoked, it invokes:
DWARFUnit::parseDWO
It creates the DWOContext for the dwo CU in the .o/.dwo file.

We then call:
DWOContext->addSkeletonCU(this)

So in this case "this" is the DwarfUnit from earlier in user code.
After everything is done.
In the CU from binary the DWO field will point to the DWO CU.
In the DWO CU NormalUnits vector will have one entry that is CU from the binary.