diff options
author | David Blaikie <dblaikie@gmail.com> | 2017-07-30 01:34:08 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2017-07-30 01:34:08 +0000 |
commit | e5adb68e044da6733e9ebba7aea913c1ca9618dd (patch) | |
tree | 6adf83bda66ffc3c19525d26104077ef61275d65 /llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | |
parent | 67b0e589d02e4e17815ab6f2e0f72b4b8190b41b (diff) | |
download | bcm5719-llvm-e5adb68e044da6733e9ebba7aea913c1ca9618dd.tar.gz bcm5719-llvm-e5adb68e044da6733e9ebba7aea913c1ca9618dd.zip |
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
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFContext.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | 15 |
1 files changed, 9 insertions, 6 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), ""); } |