From d2136b34aab25247172a4ed5d9b87b6846ac0fb3 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Tue, 22 Sep 2015 22:20:50 +0000 Subject: [PATCH] dsymutil: Follow references to clang modules and recursively clone the debug info. This does not yet resolve external type references. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248331 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/tools/dsymutil/Inputs/modules/1.o | Bin 0 -> 2392 bytes test/tools/dsymutil/Inputs/modules/Bar.pcm | Bin 0 -> 25520 bytes test/tools/dsymutil/Inputs/modules/Foo.pcm | Bin 0 -> 25448 bytes test/tools/dsymutil/X86/lit.local.cfg | 2 +- test/tools/dsymutil/X86/modules.m | 62 +++++++++ tools/dsymutil/DwarfLinker.cpp | 142 ++++++++++++++++++++- 6 files changed, 198 insertions(+), 8 deletions(-) create mode 100644 test/tools/dsymutil/Inputs/modules/1.o create mode 100644 test/tools/dsymutil/Inputs/modules/Bar.pcm create mode 100644 test/tools/dsymutil/Inputs/modules/Foo.pcm create mode 100644 test/tools/dsymutil/X86/modules.m diff --git a/test/tools/dsymutil/Inputs/modules/1.o b/test/tools/dsymutil/Inputs/modules/1.o new file mode 100644 index 0000000000000000000000000000000000000000..6e0775f57559480117c66144b224ce27e5d01689 GIT binary patch literal 2392 zcmb7GOKcNY6umS4XJF!BlqRYKvvB$JGmZc$hD3lPK8eyr1Q7&P)nn|K#MB;JV6@4TM2M6CL4bqcXDkdbXcWA_{w9=?W3Qz4eP9yvRyj|IT7Iq80uf^V_`-b4_pKe$ zV7!iHgS77Fuoj}6y_ge)lC_jC*cZw|9LvmSS{Xi0REG3WYfM`4_J|OR`RvM)sMZ`e z47{_MQzx1!yQEc@dbk%)Z6?F;@rvb~8}7#Yp*wH_Occic38a_Ix8oBsaR@ejUqR%2#{wzUas%n&sx`q>cP;$3^6`YKkg8}CsU-cNnv)h<;w-0vR}@2aft>Hp$+{d~c} z0dBD0Wq$CWF;CF~9twxXaKG}(yY9ooD;8{q>p8#gCEh)WcU?Zb^d@+G&fWtYbZ78l zBjBSle-4@HT|YvRYd#*oP@aC(30qDP^W$ zn3Y_KrYwid6r}5wtb$DiyGE9?lw+|Gk)8+z^!NuK>Mt7Fkg^SLPu-ye z^!2*_OpTG)%UE*Zr?0HBveG@XQ-d-!TdllRDzJrXYx0l!0 zJD7%~DEDP37<&K}d&mL)ZiE$;m-5#hU=Ump#9fnrq3cmz%=G%!k(@=C0+?&Y| zm%*Ib`1-e7P;>@7eL6GE2jTM;9sqg1_x-%sxL^MivGX!M3(eF%m;LU!|AO8phhHP} zb_N5ntxy;`gnhePCdTC2?mxe#jjdnTa>m{I=kNvC0rNh2oKJTc4B{i^5MK?yU=SZN zhaQ4u2$s7rFA&5lR@UNMBGFr%)hvi@CjWQ(9Bh>iK`P2yeJiBG`C!GQ=EFjyR9;*u z=Bs82cALY=L6u_7whN3a1JUhQ)DWQfPmD@v>t1m0AI_$O#0LWG@J^`>sb{3-bq87a JB;2=6{{b2w1hfDE literal 0 HcmV?d00001 diff --git a/test/tools/dsymutil/Inputs/modules/Bar.pcm b/test/tools/dsymutil/Inputs/modules/Bar.pcm new file mode 100644 index 0000000000000000000000000000000000000000..8b628e3cf016adab6fd1aa4509b85efb8cf281ea GIT binary patch literal 25520 zcmd^oeRPx8ndd9nGLD2DK_o$HlFEdp@+Y!v%cei-mh|4Md!NtW^YLDhAN~HrKdh1@O^$>=c;@0cPk*d<;_)D! zz4Up7$9Hz~fn|A)_>46rdKSpv3k1f7j*Q74@Dd34n|l4J&*|^PdW!4giud^bo=|ZA z6Tw6Bnt?z=ySrnnateDty^CL>^@zun9)ZAtfhYF_M)n1t7#i8X_dp=f==Qr)v&B03 z@}&#G)R_FvsJs#g3=Rz(ej;#a>>#_0^?KaC=H!$anXWGRN<4EtZE`Z+i1k7T_OQ$8 z>#g~`ayE21p#F?cS=S2=3>+MKiq==tC)N`Zz1Q_fcC>T)dc87zZ8BLc_ekGCD0%2m z=6Wxu@%#K;*9(r0hK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fg b/test/tools/dsymutil/X86/lit.local.cfg index ed9eba0b0d9..05f8b38b334 100644 --- a/test/tools/dsymutil/X86/lit.local.cfg +++ b/test/tools/dsymutil/X86/lit.local.cfg @@ -1,4 +1,4 @@ if not 'X86' in config.root.targets: config.unsupported = True -config.suffixes = ['.test', '.cpp', '.s'] +config.suffixes = ['.test', '.cpp', '.m', '.s'] diff --git a/test/tools/dsymutil/X86/modules.m b/test/tools/dsymutil/X86/modules.m new file mode 100644 index 00000000000..6a93f28587a --- /dev/null +++ b/test/tools/dsymutil/X86/modules.m @@ -0,0 +1,62 @@ +/* Compile with: + cat >modules.modulemap < Streamer; uint64_t OutputDebugInfoSize; + unsigned UnitID; ///< A unique ID that identifies each compile unit. /// The units of the current debug map object. std::vector Units; @@ -1416,6 +1447,9 @@ private: /// Offset of the last CIE that has been emitted in the output /// debug_frame section. uint32_t LastCIEOffset; + + /// FIXME: We may need to use something more resilient than the PCM filename. + StringSet<> ClangModules; }; /// Similar to DWARFUnitSection::getUnitForOffset(), but returning our @@ -2588,7 +2622,13 @@ DIE *DwarfLinker::DIECloner::cloneDIE( // Extract and clone every attribute. DataExtractor Data = U.getDebugInfoExtractor(); - uint32_t NextOffset = U.getDIEAtIndex(Idx + 1)->getOffset(); + // Point to the next DIE (generally there is always at least a NULL + // entry after the current one). If this is a lone + // DW_TAG_compile_unit without any children, point to the next unit. + uint32_t NextOffset = + (Idx + 1 < U.getNumDIEs()) + ? U.getDIEAtIndex(Idx + 1)->getOffset() + : U.getNextUnitOffset(); AttributesInfo AttrInfo; // We could copy the data only if we need to aply a relocation to @@ -3051,6 +3091,38 @@ void DwarfLinker::DIECloner::copyAbbrev( Linker.AssignAbbrev(Copy); } +bool DwarfLinker::registerModuleReference( + const DWARFDebugInfoEntryMinimal &CUDie, const DWARFUnit &Unit, + DebugMap &ModuleMap, unsigned Indent) { + std::string PCMfile = + CUDie.getAttributeValueAsString(&Unit, dwarf::DW_AT_GNU_dwo_name, ""); + if (PCMfile.empty()) + return false; + + // Clang module DWARF skeleton CUs abuse this for the path to the module. + std::string PCMpath = + CUDie.getAttributeValueAsString(&Unit, dwarf::DW_AT_comp_dir, ""); + + if (Options.Verbose) { + outs().indent(Indent); + outs() << "Found clang module reference " << PCMfile; + } + + if (ClangModules.count(PCMfile)) { + if (Options.Verbose) + outs() << " [cached].\n"; + return true; + } + if (Options.Verbose) + outs() << " ...\n"; + + // Cyclic dependencies are disallowed by Clang, but we still + // shouldn't run into an infinite loop, so mark it as processed now. + ClangModules.insert(PCMfile); + loadClangModule(PCMfile, PCMpath, ModuleMap, Indent + 2); + return true; +} + ErrorOr DwarfLinker::loadObject(BinaryHolder &BinaryHolder, DebugMapObject &Obj, const DebugMap &Map) { @@ -3066,6 +3138,58 @@ DwarfLinker::loadObject(BinaryHolder &BinaryHolder, DebugMapObject &Obj, return ErrOrObj; } +void DwarfLinker::loadClangModule(StringRef Filename, StringRef ModulePath, + DebugMap &ModuleMap, unsigned Indent) { + SmallString<80> Path(Options.PrependPath); + if (sys::path::is_relative(Filename)) + sys::path::append(Path, ModulePath, Filename); + else + sys::path::append(Path, Filename); + BinaryHolder ObjHolder(Options.Verbose); + auto &Obj = + ModuleMap.addDebugMapObject(Path, sys::TimeValue::PosixZeroTime()); + auto ErrOrObj = loadObject(ObjHolder, Obj, ModuleMap); + if (!ErrOrObj) { + ClangModules.erase(ClangModules.find(Filename)); + return; + } + + // FIXME: At this point dsymutil should verify the DW_AT_gnu_dwo_id + // against the module hash of the clang module. + + CompileUnit *Unit = nullptr; + + // Setup access to the debug info. + DWARFContextInMemory DwarfContext(*ErrOrObj); + RelocationManager RelocMgr(*this); + for (const auto &CU : DwarfContext.compile_units()) { + auto *CUDie = CU->getUnitDIE(false); + // Recursively get all modules imported by this one. + if (!registerModuleReference(*CUDie, *CU, ModuleMap, Indent)) { + // Add this module. + if (Unit) { + errs() << Filename << ": Clang modules are expected to have exactly" + << " 1 compile unit.\n"; + exitDsymutil(1); + } + Unit = new CompileUnit(*CU, UnitID++, !Options.NoODR); + Unit->setHasInterestingContent(); + gatherDIEParents(CUDie, 0, *Unit, &ODRContexts.getRoot(), StringPool, + ODRContexts); + // Keep everything. + Unit->markEverythingAsKept(); + } + } + if (Options.Verbose) { + outs().indent(Indent); + outs() << "cloning .debug_info from " << Filename << "\n"; + } + + DIECloner(*this, RelocMgr, DIEAlloc, MutableArrayRef(*Unit), + Options) + .cloneAllCompileUnits(DwarfContext); +} + void DwarfLinker::DIECloner::cloneAllCompileUnits( DWARFContextInMemory &DwarfContext) { if (!Linker.Streamer) @@ -3113,7 +3237,9 @@ bool DwarfLinker::link(const DebugMap &Map) { // Size of the DIEs (and headers) generated for the linked output. OutputDebugInfoSize = 0; // A unique ID that identifies each compile unit. - unsigned UnitID = 0; + UnitID = 0; + DebugMap ModuleMap(Map.getTriple(), Map.getBinaryPath()); + for (const auto &Obj : Map.objects()) { CurrentDebugObject = Obj.get(); @@ -3143,9 +3269,11 @@ bool DwarfLinker::link(const DebugMap &Map) { outs() << "Input compilation unit:"; CUDie->dump(outs(), CU.get(), 0); } - Units.emplace_back(*CU, UnitID++, !Options.NoODR); - gatherDIEParents(CUDie, 0, Units.back(), &ODRContexts.getRoot(), - StringPool, ODRContexts); + if (!registerModuleReference(*CUDie, *CU, ModuleMap)) { + Units.emplace_back(*CU, UnitID++, !Options.NoODR); + gatherDIEParents(CUDie, 0, Units.back(), &ODRContexts.getRoot(), + StringPool, ODRContexts); + } } // Then mark all the DIEs that need to be present in the linked -- 2.34.1