diff --git a/llvm/test/DebugInfo/Symbolize/ELF/symtab-file2.yaml b/llvm/test/DebugInfo/Symbolize/ELF/symtab-file2.yaml --- a/llvm/test/DebugInfo/Symbolize/ELF/symtab-file2.yaml +++ b/llvm/test/DebugInfo/Symbolize/ELF/symtab-file2.yaml @@ -47,14 +47,9 @@ ## If st_name of the STT_FILE symbols is invalid, the symbol name is lost as well. ## TODO Keep the symbol name. # RUN: yaml2obj --docnum=2 %s -o %t2 -# RUN: llvm-symbolizer --obj=%t2 0 0 2>&1 | FileCheck %s --check-prefix=CHECK2 +# RUN: not llvm-symbolizer --obj=%t2 0 0 2>&1 | FileCheck %s --check-prefix=CHECK2 # CHECK2: llvm-symbolizer{{.*}}: error: '{{.*}}symtab-file2.yaml.tmp2': st_name (0xffff) is past the end of the string table of size -# CHECK2-NEXT: ?? -# CHECK2-NEXT: ??:0:0 -# CHECK2-EMPTY: -# CHECK2-NEXT: ?? -# CHECK2-NEXT: ??:0:0 --- !ELF FileHeader: diff --git a/llvm/test/DebugInfo/symbolize-macho-universal-unknown-arch.test b/llvm/test/DebugInfo/symbolize-macho-universal-unknown-arch.test --- a/llvm/test/DebugInfo/symbolize-macho-universal-unknown-arch.test +++ b/llvm/test/DebugInfo/symbolize-macho-universal-unknown-arch.test @@ -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 %s CHECK-NOT: main -CHECK: ?? +CHECK: {{.*}}llvm-symbolizer{{.*}}: error: '{{.*}}macho-universal': Unknown architecture CHECK-NOT: main diff --git a/llvm/test/DebugInfo/symbolize-missing-file.test b/llvm/test/DebugInfo/symbolize-missing-file.test deleted file mode 100644 --- a/llvm/test/DebugInfo/symbolize-missing-file.test +++ /dev/null @@ -1,3 +0,0 @@ -RUN: llvm-symbolizer --obj=unexisting-file 0x1234 2>&1 | FileCheck -DMSG=%errc_ENOENT %s - -CHECK: llvm-symbolizer{{.*}}: error: 'unexisting-file': [[MSG]] diff --git a/llvm/test/tools/llvm-symbolizer/input-base.test b/llvm/test/tools/llvm-symbolizer/input-base.test --- a/llvm/test/tools/llvm-symbolizer/input-base.test +++ b/llvm/test/tools/llvm-symbolizer/input-base.test @@ -1,14 +1,14 @@ # 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-symbolizer -e %p/Inputs/addr.exe -a 0x1234 | FileCheck %s +RUN: llvm-symbolizer -e %p/Inputs/addr.exe -a 0X1234 | FileCheck %s +RUN: llvm-symbolizer -e %p/Inputs/addr.exe -a 4660 | FileCheck %s +RUN: llvm-symbolizer -e %p/Inputs/addr.exe -a 011064 | FileCheck %s +RUN: llvm-symbolizer -e %p/Inputs/addr.exe -a 0b1001000110100 | FileCheck %s +RUN: llvm-symbolizer -e %p/Inputs/addr.exe -a 0B1001000110100 | FileCheck %s +RUN: llvm-symbolizer -e %p/Inputs/addr.exe -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 +RUN: llvm-symbolizer -e %p/Inputs/addr.exe -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 %p/Inputs/addr.exe -a 0x1234 | FileCheck %s diff --git a/llvm/test/tools/llvm-symbolizer/input-file-err.test b/llvm/test/tools/llvm-symbolizer/input-file-err.test --- a/llvm/test/tools/llvm-symbolizer/input-file-err.test +++ b/llvm/test/tools/llvm-symbolizer/input-file-err.test @@ -2,9 +2,14 @@ RUN: not llvm-addr2line -e %p/Inputs/nonexistent 2>&1 | FileCheck %s --check-prefix=CHECK-NONEXISTENT-A2L -DMSG=%errc_ENOENT CHECK-NONEXISTENT-A2L: llvm-addr2line{{.*}}: error: '{{.*}}Inputs/nonexistent': [[MSG]] +RUN: not llvm-symbolizer -e %p/Inputs/nonexistent 0x12 2>&1 | FileCheck %s --check-prefix=CHECK-NONEXISTENT -DMSG=%errc_ENOENT +RUN: not llvm-symbolizer -e %p/Inputs/nonexistent 2>&1 | FileCheck %s --check-prefix=CHECK-NONEXISTENT -DMSG=%errc_ENOENT +CHECK-NONEXISTENT: llvm-symbolizer{{.*}}: error: '{{.*}}Inputs/nonexistent': [[MSG]] + RUN: not llvm-addr2line -e %p/Inputs 0x12 2>&1 | FileCheck %s --check-prefix=CHECK-DIRECTORY-A2L -DMSG=%errc_EISDIR RUN: not llvm-addr2line -e %p/Inputs 2>&1 | FileCheck %s --check-prefix=CHECK-DIRECTORY-A2L -DMSG=%errc_EISDIR CHECK-DIRECTORY-A2L: llvm-addr2line{{.*}}: error: '{{.*}}Inputs': [[MSG]] -not llvm-addr2line --output-style=JSON -e %p/Inputs/nonexistent 2>&1 | FileCheck %s --check-prefix=NONEXIST-JSON -DMSG=%errc_ENOENT -NONEXIST-JSON: {"Address":"0x0","Error":{"Message":"[[MSG]]"},"ModuleName":"{{.*}}nonexistent"} +RUN: not llvm-symbolizer -e %p/Inputs 0x12 2>&1 | FileCheck %s --check-prefix=CHECK-DIRECTORY -DMSG=%errc_EISDIR +RUN: not llvm-symbolizer -e %p/Inputs 2>&1 | FileCheck %s --check-prefix=CHECK-DIRECTORY -DMSG=%errc_EISDIR +CHECK-DIRECTORY: llvm-symbolizer{{.*}}: error: '{{.*}}Inputs': [[MSG]] diff --git a/llvm/test/tools/llvm-symbolizer/invalid-input-address.test b/llvm/test/tools/llvm-symbolizer/invalid-input-address.test --- a/llvm/test/tools/llvm-symbolizer/invalid-input-address.test +++ b/llvm/test/tools/llvm-symbolizer/invalid-input-address.test @@ -1,6 +1,6 @@ # Use address that can't fit in a 64-bit number. Show that llvm-symbolizer # simply echoes it as per other malformed input addresses. -RUN: llvm-symbolizer --obj=addr.exe 0x10000000000000000 | FileCheck --check-prefix=LARGE-ADDR %s +RUN: llvm-symbolizer --obj=%p/Inputs/addr.exe 0x10000000000000000 | FileCheck --check-prefix=LARGE-ADDR %s LARGE-ADDR-NOT: {{.}} LARGE-ADDR: 0x10000000000000000 diff --git a/llvm/test/tools/llvm-symbolizer/output-style-inlined.test b/llvm/test/tools/llvm-symbolizer/output-style-inlined.test --- a/llvm/test/tools/llvm-symbolizer/output-style-inlined.test +++ b/llvm/test/tools/llvm-symbolizer/output-style-inlined.test @@ -32,20 +32,11 @@ ## Check that we are able to produce an output properly when the --no-inlines option ## is specified, but a file doesn't exist. Check we report an error. -RUN: llvm-symbolizer --output-style=GNU --obj=%p/Inputs/not.exist 0x1 0x2 --no-inlines 2>&1 \ +RUN: not llvm-symbolizer --output-style=GNU --obj=%p/Inputs/not.exist 0x1 0x2 --no-inlines 2>&1 \ RUN: | FileCheck %s --check-prefix=NOT-EXIST-GNU -DMSG=%errc_ENOENT -RUN: llvm-symbolizer --output-style=LLVM --obj=%p/Inputs/not.exist 0x1 0x2 --no-inlines 2>&1 \ +RUN: not llvm-symbolizer --output-style=LLVM --obj=%p/Inputs/not.exist 0x1 0x2 --no-inlines 2>&1 \ RUN: | FileCheck %s --check-prefix=NOT-EXIST-LLVM -DMSG=%errc_ENOENT # NOT-EXIST-GNU: llvm-symbolizer{{.*}}: error: '{{.*}}Inputs/not.exist': [[MSG]] -# NOT-EXIST-GNU-NEXT: ?? -# NOT-EXIST-GNU-NEXT: ??:0 -# NOT-EXIST-GNU-NEXT: ?? -# NOT-EXIST-GNU-NEXT: ??:0 # NOT-EXIST-LLVM: llvm-symbolizer{{.*}}: error: '{{.*}}Inputs/not.exist': [[MSG]] -# NOT-EXIST-LLVM-NEXT: ?? -# NOT-EXIST-LLVM-NEXT: ??:0:0 -# NOT-EXIST-LLVM-EMPTY: -# NOT-EXIST-LLVM-NEXT: ?? -# NOT-EXIST-LLVM-NEXT: ??:0:0 diff --git a/llvm/test/tools/llvm-symbolizer/output-style-json-code.test b/llvm/test/tools/llvm-symbolizer/output-style-json-code.test --- a/llvm/test/tools/llvm-symbolizer/output-style-json-code.test +++ b/llvm/test/tools/llvm-symbolizer/output-style-json-code.test @@ -4,9 +4,9 @@ ## contain an array of the results for all of the given addresses. ## Show how library errors are reported in the output. -# RUN: llvm-symbolizer --output-style=JSON -e %p/no-file.exe 0 | \ +# RUN: not llvm-symbolizer --output-style=JSON -e %p/no-file.exe 0 | \ # RUN: FileCheck %s -DMSG=%errc_ENOENT --check-prefix=NO-FILE --strict-whitespace --match-full-lines --implicit-check-not={{.}} -# NO-FILE:[{"Address":"0x0","Error":{"Message":"[[MSG]]"},"ModuleName":"{{.*}}/no-file.exe"}] +# NO-FILE:{"Address":"0x0","Error":{"Message":"[[MSG]]"},"ModuleName":"{{.*}}/no-file.exe"} ## Resolve out of range address. ## Expected a list with one empty object with default values. diff --git a/llvm/test/tools/llvm-symbolizer/sym.test b/llvm/test/tools/llvm-symbolizer/sym.test --- a/llvm/test/tools/llvm-symbolizer/sym.test +++ b/llvm/test/tools/llvm-symbolizer/sym.test @@ -30,9 +30,6 @@ ## Support this compatibility alias for a while. RUN: llvm-symbolizer --inlining=true --print-address -p --obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck -check-prefix="PRETTY" %s -RUN: echo "0x1" > %t.input -RUN: llvm-symbolizer --obj=%p/Inputs/zero < %t.input | FileCheck -check-prefix="ZERO" %s - RUN: llvm-addr2line --obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck -check-prefix=A2L %s RUN: llvm-addr2line -a --obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck -check-prefixes=A2L,A2L_A %s RUN: llvm-addr2line -f --obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck -check-prefixes=A2L,A2L_F %s @@ -63,9 +60,6 @@ #PRETTY: (inlined by) main at {{[/\]+}}tmp{{[/\]+}}x.c:14:0 #PRETTY: some text2 # -#ZERO: ?? -#ZERO: ??:0:0 -# #A2L: some text #A2L_A-NEXT: 0x40054d #A2L_F-NEXT: inctwo diff --git a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp --- a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp +++ b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp @@ -481,7 +481,7 @@ // When an input file is specified, exit immediately if the file cannot be // read. If getOrCreateModuleInfo succeeds, symbolizeInput will reuse the // cached file handle. - if (auto *Arg = Args.getLastArg(OPT_obj_EQ); Arg && IsAddr2Line) { + if (auto *Arg = Args.getLastArg(OPT_obj_EQ); Arg) { auto Status = Symbolizer.getOrCreateModuleInfo(Arg->getValue()); if (!Status) { Request SymRequest = {Arg->getValue(), 0};