diff --git a/llvm/test/tools/llvm-symbolizer/output-style-empty-line.test b/llvm/test/tools/llvm-symbolizer/output-style-empty-line.test --- a/llvm/test/tools/llvm-symbolizer/output-style-empty-line.test +++ b/llvm/test/tools/llvm-symbolizer/output-style-empty-line.test @@ -1,6 +1,6 @@ -This test checks that with --output-style=GNU the tool does not print an empty -line after the report for an address. The current behavior is preserved for ---output-style=LLVM or if the option is omitted. +# This test checks that with --output-style=GNU the tool does not print an empty +# line after the report for an address. The current behavior is preserved for +# --output-style=LLVM or if the option is omitted. RUN: llvm-symbolizer -e %p/Inputs/addr.exe < %p/Inputs/addr.inp \ RUN: | FileCheck %s --check-prefix=LLVM @@ -8,6 +8,13 @@ RUN: llvm-symbolizer --output-style=LLVM -e %p/Inputs/addr.exe < %p/Inputs/addr.inp \ RUN: | FileCheck %s --check-prefix=LLVM +RUN: llvm-addr2line --output-style=LLVM -i -e %p/Inputs/addr.exe < %p/Inputs/addr.inp \ +RUN: | FileCheck %s --check-prefix=LLVM + +LLVM: x.c:14:0 +LLVM-EMPTY: +LLVM-NEXT: some text2 + RUN: llvm-symbolizer --output-style=GNU -e %p/Inputs/addr.exe < %p/Inputs/addr.inp \ RUN: | FileCheck %s --check-prefix=GNU @@ -17,12 +24,5 @@ RUN: llvm-addr2line --output-style=GNU -i -e %p/Inputs/addr.exe < %p/Inputs/addr.inp \ RUN: | FileCheck %s --check-prefix=GNU -RUN: llvm-addr2line --output-style=LLVM -i -e %p/Inputs/addr.exe < %p/Inputs/addr.inp \ -RUN: | FileCheck %s --check-prefix=LLVM - -LLVM: x.c:14:0 -LLVM-EMPTY: -LLVM-NEXT: some text2 - GNU: x.c:14 GNU-NEXT: some text2 diff --git a/llvm/test/tools/llvm-symbolizer/sym-verbose.test b/llvm/test/tools/llvm-symbolizer/sym-verbose.test --- a/llvm/test/tools/llvm-symbolizer/sym-verbose.test +++ b/llvm/test/tools/llvm-symbolizer/sym-verbose.test @@ -1,121 +1,121 @@ -#static volatile int do_mul; -#static volatile int x, v; +# static volatile int do_mul; +# static volatile int x, v; # -#int foo () { -# if (do_mul) x *= v; else x /= v; -# return x; -#} +# int foo () { +# if (do_mul) x *= v; else x /= v; +# return x; +# } # -#int main() { -# return foo() + foo(); -#} -#Build as : clang -gmlt -fdebug-info-for-profiling -O2 discrim.c -o discrim +# int main() { +# return foo() + foo(); +# } +# Build as : clang -gmlt -fdebug-info-for-profiling -O2 discrim.c -o discrim RUN: llvm-symbolizer --verbose --print-address --obj=%p/Inputs/discrim < %p/Inputs/discrim.inp | FileCheck %s -#CHECK: some text +CHECK: some text -#CHECK: 0x400590 -#CHECK-NEXT: foo -#CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start line: 4 -#CHECK-NEXT: Function start address: 0x400590 -#CHECK-NEXT: Line: 5 -#CHECK-NEXT: Column: 7 -#CHECK-NEXT: main -#CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start line: 9 -#CHECK-NEXT: Function start address: 0x400590 -#CHECK-NEXT: Line: 10 -#CHECK-NEXT: Column: 0 +CHECK: 0x400590 +CHECK-NEXT: foo +CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start line: 4 +CHECK-NEXT: Function start address: 0x400590 +CHECK-NEXT: Line: 5 +CHECK-NEXT: Column: 7 +CHECK-NEXT: main +CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start line: 9 +CHECK-NEXT: Function start address: 0x400590 +CHECK-NEXT: Line: 10 +CHECK-NEXT: Column: 0 -#CHECK: 0x4005a5 -#CHECK-NEXT: foo -#CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start line: 4 -#CHECK-NEXT: Function start address: 0x400590 -#CHECK-NEXT: Line: 5 -#CHECK-NEXT: Column: 17 -#CHECK-NEXT: Discriminator: 2 -#CHECK-NEXT: main -#CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start line: 9 -#CHECK-NEXT: Function start address: 0x400590 -#CHECK-NEXT: Line: 10 -#CHECK-NEXT: Column: 0 +CHECK: 0x4005a5 +CHECK-NEXT: foo +CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start line: 4 +CHECK-NEXT: Function start address: 0x400590 +CHECK-NEXT: Line: 5 +CHECK-NEXT: Column: 17 +CHECK-NEXT: Discriminator: 2 +CHECK-NEXT: main +CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start line: 9 +CHECK-NEXT: Function start address: 0x400590 +CHECK-NEXT: Line: 10 +CHECK-NEXT: Column: 0 -#CHECK: 0x4005ad -#CHECK-NEXT: foo -#CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start line: 4 -#CHECK-NEXT: Function start address: 0x400590 -#CHECK-NEXT: Line: 0 -#CHECK-NEXT: Column: 30 -#CHECK-NEXT: Discriminator: 4 -#CHECK-NEXT: main -#CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start line: 9 -#CHECK-NEXT: Function start address: 0x400590 -#CHECK-NEXT: Line: 10 -#CHECK-NEXT: Column: 0 +CHECK: 0x4005ad +CHECK-NEXT: foo +CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start line: 4 +CHECK-NEXT: Function start address: 0x400590 +CHECK-NEXT: Line: 0 +CHECK-NEXT: Column: 30 +CHECK-NEXT: Discriminator: 4 +CHECK-NEXT: main +CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start line: 9 +CHECK-NEXT: Function start address: 0x400590 +CHECK-NEXT: Line: 10 +CHECK-NEXT: Column: 0 -#CHECK: 0x4005b9 -#CHECK-NEXT: foo -#CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start line: 4 -#CHECK-NEXT: Function start address: 0x4005b9 -#CHECK-NEXT: Line: 5 -#CHECK-NEXT: Column: 7 -#CHECK-NEXT: main -#CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start line: 9 -#CHECK-NEXT: Function start address: 0x400590 -#CHECK-NEXT: Line: 10 -#CHECK-NEXT: Column: 0 -#CHECK-NEXT: Discriminator: 2 +CHECK: 0x4005b9 +CHECK-NEXT: foo +CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start line: 4 +CHECK-NEXT: Function start address: 0x4005b9 +CHECK-NEXT: Line: 5 +CHECK-NEXT: Column: 7 +CHECK-NEXT: main +CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start line: 9 +CHECK-NEXT: Function start address: 0x400590 +CHECK-NEXT: Line: 10 +CHECK-NEXT: Column: 0 +CHECK-NEXT: Discriminator: 2 -#CHECK: 0x4005ce -#CHECK-NEXT: foo -#CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start line: 4 -#CHECK-NEXT: Function start address: 0x4005b9 -#CHECK-NEXT: Line: 5 -#CHECK-NEXT: Column: 17 -#CHECK-NEXT: Discriminator: 2 -#CHECK-NEXT: main -#CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start line: 9 -#CHECK-NEXT: Function start address: 0x400590 -#CHECK-NEXT: Line: 10 -#CHECK-NEXT: Column: 0 -#CHECK-NEXT: Discriminator: 2 +CHECK: 0x4005ce +CHECK-NEXT: foo +CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start line: 4 +CHECK-NEXT: Function start address: 0x4005b9 +CHECK-NEXT: Line: 5 +CHECK-NEXT: Column: 17 +CHECK-NEXT: Discriminator: 2 +CHECK-NEXT: main +CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start line: 9 +CHECK-NEXT: Function start address: 0x400590 +CHECK-NEXT: Line: 10 +CHECK-NEXT: Column: 0 +CHECK-NEXT: Discriminator: 2 -#CHECK: 0x4005d4 -#CHECK-NEXT: foo -#CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start line: 4 -#CHECK-NEXT: Function start address: 0x4005b9 -#CHECK-NEXT: Line: 5 -#CHECK-NEXT: Column: 30 -#CHECK-NEXT: Discriminator: 4 -#CHECK-NEXT: main -#CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c -#CHECK-NEXT: Function start line: 9 -#CHECK-NEXT: Function start address: 0x400590 -#CHECK-NEXT: Line: 10 -#CHECK-NEXT: Column: 0 -#CHECK-NEXT: Discriminator: 2 +CHECK: 0x4005d4 +CHECK-NEXT: foo +CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start line: 4 +CHECK-NEXT: Function start address: 0x4005b9 +CHECK-NEXT: Line: 5 +CHECK-NEXT: Column: 30 +CHECK-NEXT: Discriminator: 4 +CHECK-NEXT: main +CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start filename: /tmp{{[\\/]}}discrim.c +CHECK-NEXT: Function start line: 9 +CHECK-NEXT: Function start address: 0x400590 +CHECK-NEXT: Line: 10 +CHECK-NEXT: Column: 0 +CHECK-NEXT: Discriminator: 2 -#CHECK: some more text +CHECK: some more text 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 @@ -1,35 +1,54 @@ -#Source: -##include -#static inline int inctwo (int *a) { -# printf ("%d\n",(*a)++); -# return (*a)++; -#} -#static inline int inc (int *a) { -# printf ("%d\n",inctwo(a)); -# return (*a)++; -#} +# Source: +# #include +# static inline int inctwo (int *a) { +# printf ("%d\n",(*a)++); +# return (*a)++; +# } +# static inline int inc (int *a) { +# printf ("%d\n",inctwo(a)); +# return (*a)++; +# } # # -#int main () { -# int x = 1; -# return inc(&x); -#} +# int main () { +# int x = 1; +# return inc(&x); +# } # -#Build as : clang -g -O2 addr.c +# Build as : clang -g -O2 addr.c RUN: llvm-symbolizer --print-address --obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck %s RUN: llvm-symbolizer --addresses --obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck %s RUN: llvm-symbolizer -a --obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck %s + +CHECK: some text +CHECK-NEXT: 0x40054d +CHECK-NEXT: inctwo +CHECK-NEXT: {{[/\]+}}tmp{{[/\]+}}x.c:3:3 +CHECK-NEXT: inc +CHECK-NEXT: {{[/\]+}}tmp{{[/\]+}}x.c:7:0 +CHECK-NEXT: main +CHECK-NEXT: {{[/\]+}}tmp{{[/\]+}}x.c:14:0 +CHECK-EMPTY: +CHECK-NEXT: some text2 + RUN: llvm-symbolizer --inlining --print-address --pretty-print --obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck -check-prefix="PRETTY" %s RUN: llvm-symbolizer --inlining --print-address -p --obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck -check-prefix="PRETTY" %s RUN: llvm-symbolizer --inlines --print-address --pretty-print --obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck -check-prefix="PRETTY" %s RUN: llvm-symbolizer --inlines --print-address -p --obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck -check-prefix="PRETTY" %s RUN: llvm-symbolizer -i --print-address --pretty-print --obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck -check-prefix="PRETTY" %s RUN: llvm-symbolizer -i --print-address -p --obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck -check-prefix="PRETTY" %s -## Before 2020-08-04, asan_symbolize.py passed --inlining=true. -## Support this compatibility alias for a while. + +# Before 2020-08-04, asan_symbolize.py passed --inlining=true. +# 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 +PRETTY: some text +PRETTY: {{[0x]+}}40054d: inctwo at {{[/\]+}}tmp{{[/\]+}}x.c:3:3 +PRETTY: (inlined by) inc at {{[/\]+}}tmp{{[/\]+}}x.c:7:0 +PRETTY: (inlined by) main at {{[/\]+}}tmp{{[/\]+}}x.c:14:0 +PRETTY: some text2 + 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 @@ -43,39 +62,22 @@ RUN: llvm-addr2line -pfi --obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck -check-prefixes=A2LP,A2LP_F,A2LP_FI %s RUN: llvm-addr2line -pafi --obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck -check-prefixes=A2LP,A2LP_AF,A2LP_FI %s -# CHECK: some text -# CHECK-NEXT: 0x40054d -# CHECK-NEXT: inctwo -# CHECK-NEXT: {{[/\]+}}tmp{{[/\]+}}x.c:3:3 -# CHECK-NEXT: inc -# CHECK-NEXT: {{[/\]+}}tmp{{[/\]+}}x.c:7:0 -# CHECK-NEXT: main -# CHECK-NEXT: {{[/\]+}}tmp{{[/\]+}}x.c:14:0 -# CHECK-EMPTY: -# CHECK-NEXT: some text2 -# -#PRETTY: some text -#PRETTY: {{[0x]+}}40054d: inctwo at {{[/\]+}}tmp{{[/\]+}}x.c:3:3 -#PRETTY: (inlined by) inc at {{[/\]+}}tmp{{[/\]+}}x.c:7:0 -#PRETTY: (inlined by) main at {{[/\]+}}tmp{{[/\]+}}x.c:14:0 -#PRETTY: some text2 -# -#A2L: some text -#A2L_A-NEXT: 0x40054d -#A2L_F-NEXT: inctwo -#A2L-NEXT: {{[/\]+}}tmp{{[/\]+}}x.c:3{{$}} -#A2L_FI-NEXT: inc{{$}} -#A2L_I-NEXT: {{[/\]+}}tmp{{[/\]+}}x.c:7{{$}} -#A2L_FI-NEXT: main -#A2L_I-NEXT: {{[/\]+}}tmp{{[/\]+}}x.c:14{{$}} -#A2L-NEXT: some text2 +A2L: some text +A2L_A-NEXT: 0x40054d +A2L_F-NEXT: inctwo +A2L-NEXT: {{[/\]+}}tmp{{[/\]+}}x.c:3{{$}} +A2L_FI-NEXT: inc{{$}} +A2L_I-NEXT: {{[/\]+}}tmp{{[/\]+}}x.c:7{{$}} +A2L_FI-NEXT: main +A2L_I-NEXT: {{[/\]+}}tmp{{[/\]+}}x.c:14{{$}} +A2L-NEXT: some text2 -#A2LP: some text -#A2LP_A-NEXT: 0x40054d: {{[/\]+}}tmp{{[/\]+}}x.c:3{{$}} -#A2LP_F-NEXT: inctwo at {{[/\]+}}tmp{{[/\]+}}x.c:3{{$}} -#A2LP_AF-NEXT: 0x40054d: inctwo at {{[/\]+}}tmp{{[/\]+}}x.c:3{{$}} -#A2LP_I-NEXT: {{[/\]+}}tmp{{[/\]+}}x.c:7{{$}} -#A2LP_I-NEXT: {{[/\]+}}tmp{{[/\]+}}x.c:14{{$}} -#A2LP_FI-NEXT: (inlined by) inc at {{[/\]+}}tmp{{[/\]+}}x.c:7{{$}} -#A2LP_FI-NEXT: (inlined by) main at {{[/\]+}}tmp{{[/\]+}}x.c:14{{$}} -#A2LP-NEXT: some text2 +A2LP: some text +A2LP_A-NEXT: 0x40054d: {{[/\]+}}tmp{{[/\]+}}x.c:3{{$}} +A2LP_F-NEXT: inctwo at {{[/\]+}}tmp{{[/\]+}}x.c:3{{$}} +A2LP_AF-NEXT: 0x40054d: inctwo at {{[/\]+}}tmp{{[/\]+}}x.c:3{{$}} +A2LP_I-NEXT: {{[/\]+}}tmp{{[/\]+}}x.c:7{{$}} +A2LP_I-NEXT: {{[/\]+}}tmp{{[/\]+}}x.c:14{{$}} +A2LP_FI-NEXT: (inlined by) inc at {{[/\]+}}tmp{{[/\]+}}x.c:7{{$}} +A2LP_FI-NEXT: (inlined by) main at {{[/\]+}}tmp{{[/\]+}}x.c:14{{$}} +A2LP-NEXT: some text2