[llvm] r294236 - Fix a bug in llvm-obdump(1) with the -macho and -info-plist options
Kevin Enderby via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 6 13:01:08 PST 2017
Author: enderby
Date: Mon Feb 6 15:01:08 2017
New Revision: 294236
URL: http://llvm.org/viewvc/llvm-project?rev=294236&view=rev
Log:
Fix a bug in llvm-obdump(1) with the -macho and -info-plist options
which caused it to print more than the (__TEXT,__info_plist) if that
section did not end with a null.
rdar://27378808
Added:
llvm/trunk/test/tools/llvm-objdump/X86/macho-info-plist-nofollow.test
Modified:
llvm/trunk/tools/llvm-objdump/MachODump.cpp
Added: llvm/trunk/test/tools/llvm-objdump/X86/macho-info-plist-nofollow.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/X86/macho-info-plist-nofollow.test?rev=294236&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-objdump/X86/macho-info-plist-nofollow.test (added)
+++ llvm/trunk/test/tools/llvm-objdump/X86/macho-info-plist-nofollow.test Mon Feb 6 15:01:08 2017
@@ -0,0 +1,10 @@
+# RUN: llvm-mc < %s -triple x86_64-apple-darwin -filetype=obj | llvm-objdump -m -info-plist - | FileCheck %s
+
+.section __TEXT, __info_plist
+.ascii "This is the (__TEXT,__info_plist) section\n"
+.section __TEXT, __follow
+.asciz "This is the (__TEXT,__follow) section\n"
+
+# CHECK: Contents of (__TEXT,__info_plist) section
+# CHECK: This is the (__TEXT,__info_plist) section
+# CHECK-NOT: This is the (__TEXT,__follow) section
Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=294236&r1=294235&r2=294236&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Mon Feb 6 15:01:08 2017
@@ -1142,7 +1142,7 @@ static void DumpInfoPlistSectionContents
StringRef BytesStr;
Section.getContents(BytesStr);
const char *sect = reinterpret_cast<const char *>(BytesStr.data());
- outs() << sect;
+ outs() << format("%.*s", BytesStr.size(), sect) << "\n";
return;
}
}
More information about the llvm-commits
mailing list