summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump
diff options
context:
space:
mode:
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>2018-08-31 13:10:54 +0000
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>2018-08-31 13:10:54 +0000
commit8e864be70aa9cb226a7f2cf1c23340fa05dc15e5 (patch)
treed3925c7c7f64bbf7596528e2e4b4d8ab4d17cdcf /llvm/tools/llvm-objdump
parentd81e3146e30b5b0bb2b5c740405305d58fd18bf3 (diff)
downloadbcm5719-llvm-8e864be70aa9cb226a7f2cf1c23340fa05dc15e5.tar.gz
bcm5719-llvm-8e864be70aa9cb226a7f2cf1c23340fa05dc15e5.zip
[llvm-objdump] Keep the memory buffer from the dSYM alive when using -g -dsym
When using -g and -dsym, llvm-objdump opens the dsym file and keeps the MachOObjectFile alive, while the memory buffer that the MachOObjectFile was based on gets destroyed. Differential Revision: https://reviews.llvm.org/D51365 llvm-svn: 341209
Diffstat (limited to 'llvm/tools/llvm-objdump')
-rw-r--r--llvm/tools/llvm-objdump/MachODump.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/tools/llvm-objdump/MachODump.cpp b/llvm/tools/llvm-objdump/MachODump.cpp
index f10f7d076c9..c8c63ceac7f 100644
--- a/llvm/tools/llvm-objdump/MachODump.cpp
+++ b/llvm/tools/llvm-objdump/MachODump.cpp
@@ -6947,6 +6947,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
std::unique_ptr<DIContext> diContext;
ObjectFile *DbgObj = MachOOF;
+ std::unique_ptr<MemoryBuffer> DSYMBuf;
// Try to find debug info and set up the DIContext for it.
if (UseDbg) {
// A separate DSym file path was specified, parse it as a macho file,
@@ -6964,6 +6965,8 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
if (DbgObjCheck.takeError())
report_error(MachOOF->getFileName(), DbgObjCheck.takeError());
DbgObj = DbgObjCheck.get().release();
+ // We need to keep the file alive, because we're replacing DbgObj with it.
+ DSYMBuf = std::move(BufOrErr.get());
}
// Setup the DIContext
OpenPOWER on IntegriCloud