From e5adb68e044da6733e9ebba7aea913c1ca9618dd Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Sun, 30 Jul 2017 01:34:08 +0000 Subject: DebugInfo: Provide option for explicitly specifying the name of the DWP file If you've archived the DWP file somewhere it's probably useful to be able to just tell llvm-symbolizer where it is when you're symbolizing stack traces from the binary. This only provides a mechanism for specifying a single DWP file, good if you're symbolizing a program with a single DWP file, but it's likely if the program is dynamically linked that you might have a DWP for each dynamic library - in which case this feature won't help (at least as it's surfaced in llvm-symbolizer for now) - in theory it could be extended to specify a collection of DWP files that could all be consulted for split CU hash resolution. llvm-svn: 309498 --- llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'llvm/lib/DebugInfo/DWARF/DWARFContext.cpp') 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(std::move(S), Ctxt); } - SmallString<128> DWPName; Expected> 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::create(const object::ObjectFile &Obj, const LoadedObjectInfo *L, - function_ref HandleError) { + function_ref HandleError, + std::string DWPName) { auto DObj = llvm::make_unique(Obj, L, HandleError); - return llvm::make_unique(std::move(DObj)); + return llvm::make_unique(std::move(DObj), std::move(DWPName)); } std::unique_ptr @@ -1262,5 +1265,5 @@ DWARFContext::create(const StringMap> &Sections, uint8_t AddrSize, bool isLittleEndian) { auto DObj = llvm::make_unique(Sections, AddrSize, isLittleEndian); - return llvm::make_unique(std::move(DObj)); + return llvm::make_unique(std::move(DObj), ""); } -- cgit v1.2.3