[llvm] r285252 - llvm-objdump: Make some error messages more consistent

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 26 15:37:53 PDT 2016


Author: bogner
Date: Wed Oct 26 17:37:52 2016
New Revision: 285252

URL: http://llvm.org/viewvc/llvm-project?rev=285252&view=rev
Log:
llvm-objdump: Make some error messages more consistent

Most of the version of report_error were quoting the filename and
printing a colon between the file name and the error message, but this
one wasn't doing either of those. Fix the output to be more
consistent.

Modified:
    llvm/trunk/test/Object/macho-invalid.test
    llvm/trunk/test/tools/llvm-objdump/malformed-archives.test
    llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp

Modified: llvm/trunk/test/Object/macho-invalid.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/macho-invalid.test?rev=285252&r1=285251&r2=285252&view=diff
==============================================================================
--- llvm/trunk/test/Object/macho-invalid.test (original)
+++ llvm/trunk/test/Object/macho-invalid.test Wed Oct 26 17:37:52 2016
@@ -61,14 +61,14 @@ NAME-PAST-EOF-nm-pax: 0000000000000000 6
 
 RUN: not llvm-objdump -t %p/Inputs/macho-bad-archive1.a 2>&1 \
 RUN:      | FileCheck -check-prefix NAME-PAST-EOF-ARCHIVE %s
-NAME-PAST-EOF-ARCHIVE: macho-bad-archive1.a(macho-invalid-symbol-name-past-eof) truncated or malformed object (bad string index: 4261412866 for symbol at index 0)
+NAME-PAST-EOF-ARCHIVE: macho-bad-archive1.a(macho-invalid-symbol-name-past-eof): truncated or malformed object (bad string index: 4261412866 for symbol at index 0)
 
 RUN: not llvm-objdump -macho -arch all -t %p/Inputs/macho-universal-bad1.x86_64.i386 2>&1 \
 RUN:      | FileCheck -check-prefix NAME-PAST-EOF-FAT %s
-NAME-PAST-EOF-FAT: macho-universal-bad1.x86_64.i386 (for architecture x86_64)  truncated or malformed object (bad string index: 4261412866 for symbol at index 0)
+NAME-PAST-EOF-FAT: macho-universal-bad1.x86_64.i386' (for architecture x86_64): truncated or malformed object (bad string index: 4261412866 for symbol at index 0)
 RUN: not llvm-objdump -macho -arch all -t %p/Inputs/macho-universal-archive-bad1.x86_64.i386 2>&1 \
 RUN:      | FileCheck -check-prefix NAME-PAST-EOF-FAT-ARCHIVE %s
-NAME-PAST-EOF-FAT-ARCHIVE: macho-universal-archive-bad1.x86_64.i386(macho-invalid-symbol-name-past-eof) (for architecture x86_64)  truncated or malformed object (bad string index: 4261412866 for symbol at index 0)
+NAME-PAST-EOF-FAT-ARCHIVE: macho-universal-archive-bad1.x86_64.i386(macho-invalid-symbol-name-past-eof) (for architecture x86_64): truncated or malformed object (bad string index: 4261412866 for symbol at index 0)
 
 RUN: llvm-nm %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \
 RUN:      | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC %s
@@ -90,13 +90,13 @@ RUN: not llvm-objdump -macho -private-he
 INCOMPLETE-SEGMENT-LOADC: truncated or malformed object (load commands extend past the end of the file)
 
 RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-bad-archive2.a 2>&1 | FileCheck -check-prefix INCOMPLETE-SEGMENT-LOADC-ARCHIVE %s
-INCOMPLETE-SEGMENT-LOADC-ARCHIVE: macho-bad-archive2.a(macho64-invalid-incomplete-segment-load-command) truncated or malformed object (load commands extend past the end of the file)
+INCOMPLETE-SEGMENT-LOADC-ARCHIVE: macho-bad-archive2.a(macho64-invalid-incomplete-segment-load-command): truncated or malformed object (load commands extend past the end of the file)
 
 RUN: not llvm-objdump -macho -private-headers -arch all %p/Inputs/macho-universal-bad2.x86_64.i386 2>&1 | FileCheck -check-prefix INCOMPLETE-SEGMENT-LOADC-FAT %s
-INCOMPLETE-SEGMENT-LOADC-FAT: macho-universal-bad2.x86_64.i386 (for architecture x86_64) truncated or malformed object (load commands extend past the end of the file)
+INCOMPLETE-SEGMENT-LOADC-FAT: macho-universal-bad2.x86_64.i386' (for architecture x86_64): truncated or malformed object (load commands extend past the end of the file)
 
 RUN: not llvm-objdump -macho -private-headers -arch all %p/Inputs/macho-universal-archive-bad2.x86_64.i386 2>&1 | FileCheck -check-prefix INCOMPLETE-SEGMENT-LOADC-FAT-ARCHIVE %s
-INCOMPLETE-SEGMENT-LOADC-FAT-ARCHIVE: macho-universal-archive-bad2.x86_64.i386(macho64-invalid-incomplete-segment-load-command) (for architecture x86_64) truncated or malformed object (load commands extend past the end of the file)
+INCOMPLETE-SEGMENT-LOADC-FAT-ARCHIVE: macho-universal-archive-bad2.x86_64.i386(macho64-invalid-incomplete-segment-load-command) (for architecture x86_64): truncated or malformed object (load commands extend past the end of the file)
 
 RUN: not llvm-objdump -macho -universal-headers %p/Inputs/macho-invalid-fat 2>&1 | FileCheck -check-prefix INVALID-FAT %s
 INVALID-FAT: truncated or malformed fat file (fat_arch_64 structs would extend past the end of the file)
@@ -408,4 +408,4 @@ RUN: not llvm-objdump -macho -private-he
 INVALID-TWOLEVELHINTS-OFFSET-HNINTS: macho-invalid-twolevelhints-offset-nhints': truncated or malformed object (offset field plus nhints times sizeof(struct twolevel_hint) field of LC_TWOLEVEL_HINTS command 0 extends past the end of the file)
 
 RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-fat_cputype 2>&1 | FileCheck -check-prefix INVALID-FAT-CPUTYPE %s
-INVALID-FAT-CPUTYPE: macho-invalid-fat_cputype truncated or malformed object (universal header architecture: 0's cputype does not match object file's mach header)
+INVALID-FAT-CPUTYPE: macho-invalid-fat_cputype': truncated or malformed object (universal header architecture: 0's cputype does not match object file's mach header)

Modified: llvm/trunk/test/tools/llvm-objdump/malformed-archives.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/malformed-archives.test?rev=285252&r1=285251&r2=285252&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objdump/malformed-archives.test (original)
+++ llvm/trunk/test/tools/llvm-objdump/malformed-archives.test Wed Oct 26 17:37:52 2016
@@ -47,35 +47,35 @@
 # RUN:   %p/Inputs/libbogus8.a \
 # RUN:   2>&1 | FileCheck -check-prefix=bogus8 %s 
 
-# bogus8: libbogus8.a(???) truncated or malformed archive (long name length: 1234 extends past the end of the member or archive for archive member header at offset 86)
+# bogus8: libbogus8.a(???): truncated or malformed archive (long name length: 1234 extends past the end of the member or archive for archive member header at offset 86)
 
 # RUN: not llvm-objdump -s %p/Inputs/libbogus9.a \
 # RUN:   2>&1 | FileCheck -check-prefix=bogus9 %s 
 
-# bogus9: libbogus9.a(???) truncated or malformed archive (long name offset characters after the '/' are not all decimal numbers: '&a25*' for archive member header at offset 94)
+# bogus9: libbogus9.a(???): truncated or malformed archive (long name offset characters after the '/' are not all decimal numbers: '&a25*' for archive member header at offset 94)
 
 # RUN: not llvm-objdump -s %p/Inputs/libbogus10.a \
 # RUN:   2>&1 | FileCheck -check-prefix=bogus10 %s 
 
-# bogus10: libbogus10.a(???) truncated or malformed archive (long name offset 507 past the end of the string table for archive member header at offset 94)
+# bogus10: libbogus10.a(???): truncated or malformed archive (long name offset 507 past the end of the string table for archive member header at offset 94)
 
 # RUN: not llvm-objdump -macho -archive-headers \
 # RUN:   %p/Inputs/libbogus11.a \
 # RUN:   2>&1 | FileCheck -check-prefix=bogus11 %s 
 
-# bogus11: libbogus11.a(hello.c) truncated or malformed archive (characters in UID field in archive header are not all decimal numbers: '~97&' for the archive member header at offset 8)
+# bogus11: libbogus11.a(hello.c): truncated or malformed archive (characters in UID field in archive header are not all decimal numbers: '~97&' for the archive member header at offset 8)
 
 # RUN: not llvm-objdump -macho -archive-headers \
 # RUN:   %p/Inputs/libbogus12.a \
 # RUN:   2>&1 | FileCheck -check-prefix=bogus12 %s 
 
-# bogus12: libbogus12.a(hello.c) truncated or malformed archive (characters in GID field in archive header are not all decimal numbers: '#55!' for the archive member header at offset 8)
+# bogus12: libbogus12.a(hello.c): truncated or malformed archive (characters in GID field in archive header are not all decimal numbers: '#55!' for the archive member header at offset 8)
 
 # RUN: not llvm-objdump -macho -archive-headers \
 # RUN:   %p/Inputs/libbogus13.a \
 # RUN:   2>&1 | FileCheck -check-prefix=bogus13 %s 
 
-# bogus13: libbogus13.a(hello.c) truncated or malformed archive (characters in AccessMode field in archive header are not all decimal numbers: 'Feed' for the archive member header at offset 8)
+# bogus13: libbogus13.a(hello.c): truncated or malformed archive (characters in AccessMode field in archive header are not all decimal numbers: 'Feed' for the archive member header at offset 8)
 
 # RUN: llvm-objdump -macho -archive-headers %p/Inputs/libbogus14.a \
 # RUN:   2>&1 | FileCheck -check-prefix=bogus14 %s 

Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=285252&r1=285251&r2=285252&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Wed Oct 26 17:37:52 2016
@@ -319,14 +319,14 @@ LLVM_ATTRIBUTE_NORETURN void llvm::repor
   if (ArchiveName != "")
     errs() << ArchiveName << "(" << FileName << ")";
   else
-    errs() << FileName;
+    errs() << "'" << FileName << "'";
   if (!ArchitectureName.empty())
     errs() << " (for architecture " << ArchitectureName << ")";
   std::string Buf;
   raw_string_ostream OS(Buf);
   logAllUnhandledErrors(std::move(E), OS, "");
   OS.flush();
-  errs() << " " << Buf;
+  errs() << ": " << Buf;
   exit(1);
 }
 




More information about the llvm-commits mailing list