[PATCH] D51365: [llvm-objdump] Keep the memory buffer from the dSYM alive when using -g -dsym
Francis Visoiu Mistrih via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 30 11:24:14 PDT 2018
thegameg updated this revision to Diff 163381.
thegameg added a comment.
Added a test. Let me know if that's what you had in mind.
https://reviews.llvm.org/D51365
Files:
test/tools/llvm-objdump/X86/macho-disassembly-g-dsym.test
tools/llvm-objdump/MachODump.cpp
Index: tools/llvm-objdump/MachODump.cpp
===================================================================
--- tools/llvm-objdump/MachODump.cpp
+++ tools/llvm-objdump/MachODump.cpp
@@ -6947,6 +6947,7 @@
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 @@
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
Index: test/tools/llvm-objdump/X86/macho-disassembly-g-dsym.test
===================================================================
--- /dev/null
+++ test/tools/llvm-objdump/X86/macho-disassembly-g-dsym.test
@@ -0,0 +1,4 @@
+// RUN: dsymutil -f -oso-prepend-path=%p/../../dsymutil/ %p/../../dsymutil/Inputs/basic.macho.x86_64 -o %t1
+// RUN: llvm-objdump -d -g -dsym=%t1 %p/../../dsymutil/Inputs/basic.macho.x86_64 | FileCheck %s
+
+CHECK: Disassembly of section __TEXT,__text:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51365.163381.patch
Type: text/x-patch
Size: 1293 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180830/24d0cc4e/attachment.bin>
More information about the llvm-commits
mailing list