Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
llvm-symbolizer: Ensure non-zero exit when an error is printed
(this doesn't cover all cases - libDebugInfoDWARF has a default error handler that prints errors without any exit code handling - I'll be following up with a patch for that after this)
- Loading branch information
Showing
5 changed files
with
38 additions
and
33 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
llvm/test/DebugInfo/symbolize-macho-universal-unknown-arch.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
RUN: llvm-symbolizer --obj=%p/Inputs/macho-universal 0x1f84 | FileCheck %s | ||
RUN: not llvm-symbolizer --obj=%p/Inputs/macho-universal 0x1f84 2>&1 | FileCheck --implicit-check-not=main %s | ||
|
||
CHECK: LLVMSymbolizer: error reading file: Unknown architecture named: | ||
|
||
CHECK-NOT: main | ||
CHECK: ?? | ||
CHECK-NOT: main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
RUN: llvm-symbolizer --obj=unexisting-file 0x1234 2>&1 | FileCheck %s | ||
RUN: not llvm-symbolizer --obj=unexisting-file 0x1234 2>&1 | FileCheck %s | ||
|
||
CHECK: LLVMSymbolizer: error reading file: {{[Nn]}}o such file or directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,34 @@ | ||
# llvm-symbolizer infers the number base from the form of the address. | ||
RUN: llvm-symbolizer -e /dev/null -a 0x1234 | FileCheck %s | ||
RUN: llvm-symbolizer -e /dev/null -a 0X1234 | FileCheck %s | ||
RUN: llvm-symbolizer -e /dev/null -a 4660 | FileCheck %s | ||
RUN: llvm-symbolizer -e /dev/null -a 011064 | FileCheck %s | ||
RUN: llvm-symbolizer -e /dev/null -a 0b1001000110100 | FileCheck %s | ||
RUN: llvm-symbolizer -e /dev/null -a 0B1001000110100 | FileCheck %s | ||
RUN: llvm-symbolizer -e /dev/null -a 0o11064 | FileCheck %s | ||
# RUN: llvm-mc %s -o %t -filetype=obj | ||
## llvm-symbolizer infers the number base from the form of the address. | ||
# RUN: llvm-symbolizer -e %t -a 0x1234 | FileCheck %s | ||
# RUN: llvm-symbolizer -e %t -a 0X1234 | FileCheck %s | ||
# RUN: llvm-symbolizer -e %t -a 4660 | FileCheck %s | ||
# RUN: llvm-symbolizer -e %t -a 011064 | FileCheck %s | ||
# RUN: llvm-symbolizer -e %t -a 0b1001000110100 | FileCheck %s | ||
# RUN: llvm-symbolizer -e %t -a 0B1001000110100 | FileCheck %s | ||
# RUN: llvm-symbolizer -e %t -a 0o11064 | FileCheck %s | ||
|
||
# llvm-symbolizer / StringRef::getAsInteger only accepts the 0o prefix in lowercase. | ||
RUN: llvm-symbolizer -e /dev/null -a 0O1234 | FileCheck %s --check-prefix=INVALID-NOT-OCTAL-UPPER | ||
## llvm-symbolizer / StringRef::getAsInteger only accepts the 0o prefix in lowercase. | ||
# RUN: llvm-symbolizer -e %t -a 0O1234 | FileCheck %s --check-prefix=INVALID-NOT-OCTAL-UPPER | ||
|
||
# llvm-addr2line always requires hexadecimal, but accepts an optional 0x prefix. | ||
RUN: llvm-addr2line -e /dev/null -a 0x1234 | FileCheck %s | ||
RUN: llvm-addr2line -e /dev/null -a 0X1234 | FileCheck %s | ||
RUN: llvm-addr2line -e /dev/null -a 1234 | FileCheck %s | ||
RUN: llvm-addr2line -e /dev/null -a 01234 | FileCheck %s | ||
RUN: llvm-addr2line -e /dev/null -a 0b1010 | FileCheck %s --check-prefix=HEXADECIMAL-NOT-BINARY | ||
RUN: llvm-addr2line -e /dev/null -a 0B1010 | FileCheck %s --check-prefix=HEXADECIMAL-NOT-BINARY | ||
RUN: llvm-addr2line -e /dev/null -a 0o1234 | FileCheck %s --check-prefix=INVALID-NOT-OCTAL-LOWER | ||
RUN: llvm-addr2line -e /dev/null -a 0O1234 | FileCheck %s --check-prefix=INVALID-NOT-OCTAL-UPPER | ||
## llvm-addr2line always requires hexadecimal, but accepts an optional 0x prefix. | ||
# RUN: llvm-addr2line -e %t -a 0x1234 | FileCheck %s | ||
# RUN: llvm-addr2line -e %t -a 0X1234 | FileCheck %s | ||
# RUN: llvm-addr2line -e %t -a 1234 | FileCheck %s | ||
# RUN: llvm-addr2line -e %t -a 01234 | FileCheck %s | ||
# RUN: llvm-addr2line -e %t -a 0b1010 | FileCheck %s --check-prefix=HEXADECIMAL-NOT-BINARY | ||
# RUN: llvm-addr2line -e %t -a 0B1010 | FileCheck %s --check-prefix=HEXADECIMAL-NOT-BINARY | ||
# RUN: llvm-addr2line -e %t -a 0o1234 | FileCheck %s --check-prefix=INVALID-NOT-OCTAL-LOWER | ||
# RUN: llvm-addr2line -e %t -a 0O1234 | FileCheck %s --check-prefix=INVALID-NOT-OCTAL-UPPER | ||
|
||
CHECK: 0x1234 | ||
CHECK-NEXT: ?? | ||
# CHECK: 0x1234 | ||
# CHECK-NEXT: ?? | ||
|
||
HEXADECIMAL-NOT-BINARY: 0xb1010 | ||
HEXADECIMAL-NOT-BINARY: ?? | ||
# HEXADECIMAL-NOT-BINARY: 0xb1010 | ||
# HEXADECIMAL-NOT-BINARY: ?? | ||
|
||
INVALID-NOT-OCTAL-LOWER: 0o1234 | ||
INVALID-NOT-OCTAL-LOWER-NOT: ?? | ||
# INVALID-NOT-OCTAL-LOWER: 0o1234 | ||
# INVALID-NOT-OCTAL-LOWER-NOT: ?? | ||
|
||
INVALID-NOT-OCTAL-UPPER: 0O1234 | ||
INVALID-NOT-OCTAL-UPPER-NOT: ?? | ||
# INVALID-NOT-OCTAL-UPPER: 0O1234 | ||
# INVALID-NOT-OCTAL-UPPER-NOT: ?? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters