[PATCH] D118521: [GSYM] Add Split Dwarf Support to DwarfTransformer
Alexander Yermolovich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 28 17:34:49 PST 2022
ayermolo created this revision.
Herald added subscribers: hoy, modimo, wenlei, hiraditya.
ayermolo requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
The convert only worked on CUs in main binary.
If it's a skeleton CU it will now use the DWO CU
when invoking handleDie.
Test Plan:
llvm-lit
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D118521
Files:
llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
Index: llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
===================================================================
--- llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
+++ llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
@@ -427,11 +427,28 @@
Error DwarfTransformer::convert(uint32_t NumThreads) {
size_t NumBefore = Gsym.getNumFunctionInfos();
+ auto getDie = [&](DWARFUnit &DwarfUnit) -> DWARFDie {
+ DWARFDie ReturnDie = DwarfUnit.getUnitDIE(false);
+ if (llvm::Optional<uint64_t> DWOId = DwarfUnit.getDWOId()) {
+ DWARFUnit *DWOCU = DwarfUnit.getNonSkeletonUnitDIE(false).getDwarfUnit();
+ if (!DWOCU->isDWOUnit()) {
+ std::string DWOName = dwarf::toString(
+ DwarfUnit.getUnitDIE().find(
+ {dwarf::DW_AT_dwo_name, dwarf::DW_AT_GNU_dwo_name}),
+ "");
+ Log << "warning: Unable to retrieve DWO .debug_info section for "
+ << DWOName << "\n";
+ } else {
+ ReturnDie = DWOCU->getUnitDIE(false);
+ }
+ }
+ return ReturnDie;
+ };
if (NumThreads == 1) {
// Parse all DWARF data from this thread, use the same string/file table
// for everything
for (const auto &CU : DICtx.compile_units()) {
- DWARFDie Die = CU->getUnitDIE(false);
+ DWARFDie Die = getDie(*CU.get());
CUInfo CUI(DICtx, dyn_cast<DWARFCompileUnit>(CU.get()));
handleDie(Log, CUI, Die);
}
@@ -456,7 +473,7 @@
// Now convert all DWARF to GSYM in a thread pool.
std::mutex LogMutex;
for (const auto &CU : DICtx.compile_units()) {
- DWARFDie Die = CU->getUnitDIE(false /*CUDieOnly*/);
+ DWARFDie Die = getDie(*CU.get());
if (Die) {
CUInfo CUI(DICtx, dyn_cast<DWARFCompileUnit>(CU.get()));
pool.async([this, CUI, &LogMutex, Die]() mutable {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118521.404203.patch
Type: text/x-patch
Size: 1804 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220129/cd76c17b/attachment.bin>
More information about the llvm-commits
mailing list