diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | 15 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/Symbolize/Symbolize.cpp | 17 |
2 files changed, 19 insertions, 13 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp index 67f39ec1b1a..aeb1dea2bca 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -792,11 +792,13 @@ DWARFContext::getDWOContext(StringRef AbsolutePath) { return std::shared_ptr<DWARFContext>(std::move(S), Ctxt); } - SmallString<128> DWPName; Expected<OwningBinary<ObjectFile>> Obj = [&] { if (!CheckedForDWP) { - (DObj->getFileName() + ".dwp").toVector(DWPName); - auto Obj = object::ObjectFile::createObjectFile(DWPName); + SmallString<128> DWPName; + auto Obj = object::ObjectFile::createObjectFile( + this->DWPName.empty() + ? (DObj->getFileName() + ".dwp").toStringRef(DWPName) + : StringRef(this->DWPName)); if (Obj) { Entry = &DWP; return Obj; @@ -1252,9 +1254,10 @@ public: std::unique_ptr<DWARFContext> DWARFContext::create(const object::ObjectFile &Obj, const LoadedObjectInfo *L, - function_ref<ErrorPolicy(Error)> HandleError) { + function_ref<ErrorPolicy(Error)> HandleError, + std::string DWPName) { auto DObj = llvm::make_unique<DWARFObjInMemory>(Obj, L, HandleError); - return llvm::make_unique<DWARFContext>(std::move(DObj)); + return llvm::make_unique<DWARFContext>(std::move(DObj), std::move(DWPName)); } std::unique_ptr<DWARFContext> @@ -1262,5 +1265,5 @@ DWARFContext::create(const StringMap<std::unique_ptr<MemoryBuffer>> &Sections, uint8_t AddrSize, bool isLittleEndian) { auto DObj = llvm::make_unique<DWARFObjInMemory>(Sections, AddrSize, isLittleEndian); - return llvm::make_unique<DWARFContext>(std::move(DObj)); + return llvm::make_unique<DWARFContext>(std::move(DObj), ""); } diff --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp index 1d8b4321647..7aa55e755d2 100644 --- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp +++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp @@ -53,10 +53,11 @@ namespace llvm { namespace symbolize { -Expected<DILineInfo> LLVMSymbolizer::symbolizeCode(const std::string &ModuleName, - uint64_t ModuleOffset) { +Expected<DILineInfo> +LLVMSymbolizer::symbolizeCode(const std::string &ModuleName, + uint64_t ModuleOffset, StringRef DWPName) { SymbolizableModule *Info; - if (auto InfoOrErr = getOrCreateModuleInfo(ModuleName)) + if (auto InfoOrErr = getOrCreateModuleInfo(ModuleName, DWPName)) Info = InfoOrErr.get(); else return InfoOrErr.takeError(); @@ -80,9 +81,9 @@ Expected<DILineInfo> LLVMSymbolizer::symbolizeCode(const std::string &ModuleName Expected<DIInliningInfo> LLVMSymbolizer::symbolizeInlinedCode(const std::string &ModuleName, - uint64_t ModuleOffset) { + uint64_t ModuleOffset, StringRef DWPName) { SymbolizableModule *Info; - if (auto InfoOrErr = getOrCreateModuleInfo(ModuleName)) + if (auto InfoOrErr = getOrCreateModuleInfo(ModuleName, DWPName)) Info = InfoOrErr.get(); else return InfoOrErr.takeError(); @@ -364,7 +365,8 @@ LLVMSymbolizer::getOrCreateObject(const std::string &Path, } Expected<SymbolizableModule *> -LLVMSymbolizer::getOrCreateModuleInfo(const std::string &ModuleName) { +LLVMSymbolizer::getOrCreateModuleInfo(const std::string &ModuleName, + StringRef DWPName) { const auto &I = Modules.find(ModuleName); if (I != Modules.end()) { return I->second.get(); @@ -409,7 +411,8 @@ LLVMSymbolizer::getOrCreateModuleInfo(const std::string &ModuleName) { } } if (!Context) - Context = DWARFContext::create(*Objects.second); + Context = DWARFContext::create(*Objects.second, nullptr, + DWARFContext::defaultErrorHandler, DWPName); assert(Context); auto InfoOrErr = SymbolizableObjectFile::create(Objects.first, std::move(Context)); |