[PATCH] D96826: [DWARF][WIP] Add Skeleton CU to DWO CU during creation.

Alexander Yermolovich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 15:21:38 PST 2021


ayermolo added inline comments.


================
Comment at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:420-421
 
+  /// Add Skeleton CU for DWO CU.
+  Error addSkeletonCU(DWARFUnit *Unit);
+
----------------
dblaikie wrote:
> 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? 
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.








Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96826/new/

https://reviews.llvm.org/D96826



More information about the llvm-commits mailing list