diff --git a/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h b/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h --- a/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h +++ b/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h @@ -42,6 +42,7 @@ std::string DefaultArch; std::vector DsymHints; std::string FallbackDebugPath; + std::string DWPName; }; LLVMSymbolizer() = default; @@ -52,12 +53,10 @@ } Expected symbolizeCode(const std::string &ModuleName, - object::SectionedAddress ModuleOffset, - StringRef DWPName = ""); + object::SectionedAddress ModuleOffset); Expected symbolizeInlinedCode(const std::string &ModuleName, - object::SectionedAddress ModuleOffset, - StringRef DWPName = ""); + object::SectionedAddress ModuleOffset); Expected symbolizeData(const std::string &ModuleName, object::SectionedAddress ModuleOffset); void flush(); @@ -76,7 +75,7 @@ /// only reported once. Subsequent calls to get module info for a module that /// failed to load will return nullptr. Expected - getOrCreateModuleInfo(const std::string &ModuleName, StringRef DWPName = ""); + getOrCreateModuleInfo(const std::string &ModuleName); ObjectFile *lookUpDsymFile(const std::string &Path, const MachOObjectFile *ExeObj, diff --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp --- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp +++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp @@ -53,10 +53,9 @@ Expected LLVMSymbolizer::symbolizeCode(const std::string &ModuleName, - object::SectionedAddress ModuleOffset, - StringRef DWPName) { + object::SectionedAddress ModuleOffset) { SymbolizableModule *Info; - if (auto InfoOrErr = getOrCreateModuleInfo(ModuleName, DWPName)) + if (auto InfoOrErr = getOrCreateModuleInfo(ModuleName)) Info = InfoOrErr.get(); else return InfoOrErr.takeError(); @@ -80,10 +79,9 @@ Expected LLVMSymbolizer::symbolizeInlinedCode(const std::string &ModuleName, - object::SectionedAddress ModuleOffset, - StringRef DWPName) { + object::SectionedAddress ModuleOffset) { SymbolizableModule *Info; - if (auto InfoOrErr = getOrCreateModuleInfo(ModuleName, DWPName)) + if (auto InfoOrErr = getOrCreateModuleInfo(ModuleName)) Info = InfoOrErr.get(); else return InfoOrErr.takeError(); @@ -378,8 +376,7 @@ } Expected -LLVMSymbolizer::getOrCreateModuleInfo(const std::string &ModuleName, - StringRef DWPName) { +LLVMSymbolizer::getOrCreateModuleInfo(const std::string &ModuleName) { const auto &I = Modules.find(ModuleName); if (I != Modules.end()) { return I->second.get(); @@ -425,8 +422,9 @@ } } if (!Context) - Context = DWARFContext::create(*Objects.second, nullptr, - DWARFContext::defaultErrorHandler, DWPName); + Context = + DWARFContext::create(*Objects.second, nullptr, + DWARFContext::defaultErrorHandler, Opts.DWPName); assert(Context); auto InfoOrErr = SymbolizableObjectFile::create(Objects.first, std::move(Context)); diff --git a/llvm/test/tools/llvm-symbolizer/split-dwarf-dwp.test b/llvm/test/tools/llvm-symbolizer/split-dwarf-dwp.test --- a/llvm/test/tools/llvm-symbolizer/split-dwarf-dwp.test +++ b/llvm/test/tools/llvm-symbolizer/split-dwarf-dwp.test @@ -3,8 +3,9 @@ RUN: cp %p/Inputs/split-dwarf-dwp.o %t/split-dwarf-dwp-different-name.o -RUN: llvm-symbolizer --dwp=%p/Inputs/split-dwarf-dwp.o.dwp \ -RUN: --obj=%t/split-dwarf-dwp-different-name.o 0x54 | FileCheck %s +RUN: echo -e 'DATA 0\n0x54' | \ +RUN: llvm-symbolizer --dwp=%p/Inputs/split-dwarf-dwp.o.dwp \ +RUN: --obj=%t/split-dwarf-dwp-different-name.o | FileCheck %s CHECK: f2 CHECK-NEXT: split-dwarf-dwp.cpp:3:3 diff --git a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp --- a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp +++ b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp @@ -224,8 +224,7 @@ Printer << (error(ResOrErr) ? DIGlobal() : ResOrErr.get()); } else if (ClPrintInlining) { auto ResOrErr = Symbolizer.symbolizeInlinedCode( - ModuleName, {Offset, object::SectionedAddress::UndefSection}, - ClDwpName); + ModuleName, {Offset, object::SectionedAddress::UndefSection}); Printer << (error(ResOrErr) ? DIInliningInfo() : ResOrErr.get()); } else if (ClOutputStyle == DIPrinter::OutputStyle::GNU) { // With ClPrintFunctions == FunctionNameKind::LinkageName (default) @@ -235,13 +234,11 @@ // behavior of addr2line. Symbolizer.symbolizeInlinedCode() overrides only // the topmost function, which suits our needs better. auto ResOrErr = Symbolizer.symbolizeInlinedCode( - ModuleName, {Offset, object::SectionedAddress::UndefSection}, - ClDwpName); + ModuleName, {Offset, object::SectionedAddress::UndefSection}); Printer << (error(ResOrErr) ? DILineInfo() : ResOrErr.get().getFrame(0)); } else { auto ResOrErr = Symbolizer.symbolizeCode( - ModuleName, {Offset, object::SectionedAddress::UndefSection}, - ClDwpName); + ModuleName, {Offset, object::SectionedAddress::UndefSection}); Printer << (error(ResOrErr) ? DILineInfo() : ResOrErr.get()); } if (ClOutputStyle == DIPrinter::OutputStyle::LLVM) @@ -275,6 +272,7 @@ Opts.RelativeAddresses = ClUseRelativeAddress; Opts.DefaultArch = ClDefaultArch; Opts.FallbackDebugPath = ClFallbackDebugPath; + Opts.DWPName = ClDwpName; for (const auto &hint : ClDsymHint) { if (sys::path::extension(hint) == ".dSYM") {