[llvm-exegesis] Program should succeed if benchmark returns StringError.
[llvm-core.git] / test / DebugInfo / llvm-symbolizer.test
bloba6a15491c205d00b254d2f22b6bab018edde49fe
1 RUN: rm -rf %t
2 RUN: mkdir -p %t
3 RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x400559" > %t.input
4 RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64.debuglink 0x400559" >> %t.input
5 RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x400436" >> %t.input
6 RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x400528" >> %t.input
7 RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x400586" >> %t.input
8 RUN: echo "%p/Inputs/dwarfdump-test2.elf-x86-64 0x4004e8" >> %t.input
9 RUN: echo "%p/Inputs/dwarfdump-test2.elf-x86-64 0x4004f4" >> %t.input
10 RUN: echo "%p/Inputs/dwarfdump-test4.elf-x86-64 0x62c" >> %t.input
11 RUN: echo "%p/Inputs/dwarfdump-inl-test.elf-x86-64 0x8dc" >> %t.input
12 RUN: echo "%p/Inputs/dwarfdump-inl-test.elf-x86-64 0xa05" >> %t.input
13 RUN: echo "%p/Inputs/dwarfdump-inl-test.elf-x86-64 0x987" >> %t.input
14 RUN: echo "%p/Inputs/dwarfdump-inl-test.high_pc.elf-x86-64 0x568" >> %t.input
15 RUN: cp "%p/Inputs/dwarfdump-test3.elf-x86-64-space" "%t/dwarfdump-test3.elf-x86-64 space"
16 RUN: echo "\"%t/dwarfdump-test3.elf-x86-64 space\" 0x640" >> %t.input
17 RUN: echo "\"%t/dwarfdump-test3.elf-x86-64 space\" 0x633" >> %t.input
18 RUN: echo "\"%t/dwarfdump-test3.elf-x86-64 space\" 0x62d" >> %t.input
19 RUN: echo "%p/Inputs/macho-universal 0x1f84" >> %t.input
20 RUN: echo "%p/Inputs/macho-universal:i386 0x1f67" >> %t.input
21 RUN: echo "%p/Inputs/macho-universal:x86_64 0x100000f05" >> %t.input
22 RUN: echo "%p/Inputs/llvm-symbolizer-dwo-test 0x400514" >> %t.input
23 RUN: echo "%p/Inputs/llvm-symbolizer-local-mem-func-gcc.elf-x86-64 0x61a" >> %t.input
24 RUN: echo "%p/Inputs/fission-ranges.elf-x86_64 0x720" >> %t.input
25 RUN: echo "%p/Inputs/arange-overlap.elf-x86_64 0x714" >> %t.input
26 RUN: cp %p/Inputs/split-dwarf-test.dwo %t
27 RUN: echo "%p/Inputs/split-dwarf-test 0x400504" >> %t.input
28 RUN: echo "%p/Inputs/split-dwarf-test 0x4004f4" >> %t.input
29 RUN: echo "%p/Inputs/cross-cu-inlining.x86_64-macho.o 0x17" >> %t.input
30 RUN: cp %p/Inputs/split-dwarf-multiple-cu.dwo %t
31 RUN: echo "%p/Inputs/split-dwarf-multiple-cu.o 0x4" >> %t.input
32 RUN: cp %p/Inputs/split-dwarf-addr-object-relocation.dwo %t
33 RUN: echo "%p/Inputs/split-dwarf-addr-object-relocation.o 0x14" >> %t.input
34 RUN: cp %p/Inputs/split-dwarf-dwp.o %t
35 RUN: cp %p/Inputs/split-dwarf-dwp.o.dwp %t
36 RUN: echo "%t/split-dwarf-dwp.o 0x4" >> %t.input
38 RUN: cd %t
39 RUN: llvm-symbolizer --functions=linkage --inlining --demangle=false \
40 RUN:    --default-arch=i386 < %t.input | FileCheck --check-prefix=CHECK --check-prefix=SPLIT --check-prefix=DWO %s
42 Ensure we get the same results in the absence of gmlt-like data in the executable but the presence of a .dwo file
44 RUN: echo "%p/Inputs/split-dwarf-test-nogmlt 0x400504" >> %t.input
45 RUN: echo "%p/Inputs/split-dwarf-test-nogmlt 0x4004f4" >> %t.input
46 RUN: llvm-symbolizer --functions=linkage --inlining --demangle=false \
47 RUN:    --default-arch=i386 < %t.input | FileCheck --check-prefix=SPLIT --check-prefix=DWO %s
49 Ensure we get gmlt like results in the absence of a .dwo file but the presence of gmlt-like data in the executable
51 RUN: rm %t/split-dwarf-test.dwo
52 RUN: echo "%p/Inputs/split-dwarf-test 0x400504" >> %t.input
53 RUN: echo "%p/Inputs/split-dwarf-test 0x4004f4" >> %t.input
54 RUN: llvm-symbolizer --functions=linkage --inlining --demangle=false \
55 RUN:    --default-arch=i386 < %t.input | FileCheck --check-prefix=SPLIT --check-prefix=NODWO %s
57 RUN: cp %p/Inputs/split-dwarf-dwp.o %t/split-dwarf-dwp-different-name.o
58 RUN: echo "%t/split-dwarf-dwp-different-name.o 0x54" > %t.input
59 RUN: llvm-symbolizer --functions=linkage --inlining --demangle=false \
60 RUN:    --default-arch=i386 --dwp=%p/Inputs/split-dwarf-dwp.o.dwp < %t.input | FileCheck --check-prefix=DWP %s
62 CHECK:       main
63 CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:16
65 CHECK:       main
66 CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:16
68 CHECK:      _start
70 CHECK: _Z1fii
71 CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:11
73 CHECK: DummyClass
74 CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:4
76 CHECK: a
77 CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test2-helper.cc:2
79 CHECK: main
80 CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test2-main.cc:4
82 CHECK:      _Z1cv
83 CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test4-part1.cc:2
85 CHECK:      inlined_h
86 CHECK-NEXT: dwarfdump-inl-test.h:2
87 CHECK-NEXT: inlined_g
88 CHECK-NEXT: dwarfdump-inl-test.h:7
89 CHECK-NEXT: inlined_f
90 CHECK-NEXT: dwarfdump-inl-test.cc:3
91 CHECK-NEXT: main
92 CHECK-NEXT: dwarfdump-inl-test.cc:8
94 CHECK:      inlined_g
95 CHECK-NEXT: dwarfdump-inl-test.h:7
96 CHECK-NEXT: inlined_f
97 CHECK-NEXT: dwarfdump-inl-test.cc:3
98 CHECK-NEXT: main
99 CHECK-NEXT: dwarfdump-inl-test.cc:8
101 CHECK:      inlined_f
102 CHECK-NEXT: dwarfdump-inl-test.cc:3
103 CHECK-NEXT: main
104 CHECK-NEXT: dwarfdump-inl-test.cc:8
106 CHECK:      inlined_h
107 CHECK-NEXT: dwarfdump-inl-test.h:3
108 CHECK-NEXT: inlined_g
109 CHECK-NEXT: dwarfdump-inl-test.h:7
110 CHECK-NEXT: inlined_f
111 CHECK-NEXT: dwarfdump-inl-test.cc:3
112 CHECK-NEXT: main
113 CHECK-NEXT: dwarfdump-inl-test.cc:8
115 CHECK: C
116 CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test3.cc:3
118 CHECK: _Z3do1v
119 CHECK-NEXT: /tmp/include{{[/\\]}}dwarfdump-test3-decl.h:7
121 CHECK: _Z3do2v
122 CHECK-NEXT: /tmp/dbginfo{{[/\\]}}include{{[/\\]}}dwarfdump-test3-decl2.h:1
124 CHECK:      main
125 CHECK:      _Z3inci
126 CHECK:      _Z3inci
128 CHECK: main
129 CHECK-NEXT: llvm-symbolizer-dwo-test.cc:11
131 CHECK-NOT: local_mem_func
132 CHECK: _ZZ2f1vEN3foo14local_mem_funcEv
133 CHECK-NEXT: {{.*}}local-mem-func.cpp:3:0
135 CHECK: main
136 CHECK-NEXT: {{.*}}fission-ranges.cc:6
138 CHECK: _ZN1S3bazEv
139 CHECK-NEXT: {{.*}}arange-overlap.cc:6
141 DWO: _Z2f2v
142 NODWO: {{^f2$}}
143 SPLIT-NEXT: {{.*}}split-dwarf-test.cpp
144 SPLIT-NEXT: main
145 SPLIT-NEXT: {{.*}}split-dwarf-test.cpp
147 SPLIT: _Z2f1v
148 SPLIT-NEXT: {{.*}}split-dwarf-test.cpp
150 ; func has been inlined into main by LTO. Check that the symbolizer is able
151 ; to resolve the cross-cu reference and retrieve func's name
152 CHECK: func
153 CHECK-NEXT: /tmp{{[/\\]}}cross-cu-inlining.c:16:3
154 CHECK-NEXT: main
155 CHECK-NEXT: /tmp{{[/\\]}}cross-cu-inlining.c:11:0
157 CHECK:      f2
158 CHECK-NEXT: split-dwarf-multiple-cu.cpp:3:3
159 CHECK-NEXT: f3
160 CHECK-NEXT: split-dwarf-multiple-cu.cpp:6:0
162 CHECK:      f2
163 CHECK-NEXT: split-dwarf-addr-object-relocation.cpp:3:3
164 CHECK-NEXT: f3
165 CHECK-NEXT: split-dwarf-addr-object-relocation.cpp:6:0
167 DWP:      f2
168 DWP-NEXT: split-dwarf-dwp.cpp:3:3
169 DWP-NEXT: main
170 DWP-NEXT: split-dwarf-dwp.cpp:10:0
172 RUN: echo "unexisting-file 0x1234" > %t.input2
173 RUN: llvm-symbolizer < %t.input2 2>&1 | FileCheck %s --check-prefix=MISSING-FILE
175 MISSING-FILE: LLVMSymbolizer: error reading file: {{[Nn]}}o such file or directory
177 RUN: echo "%p/Inputs/macho-universal 0x1f84" > %t.input3
178 RUN: llvm-symbolizer < %t.input3 | FileCheck %s --check-prefix=UNKNOWN-ARCH
180 UNKNOWN-ARCH-NOT: main
181 UNKNOWN-ARCH: ??
182 UNKNOWN-ARCH-NOT: main
184 RUN: echo "0x400559" > %t.input4
185 RUN: echo "0x400436" >> %t.input4
186 RUN: llvm-symbolizer --obj %p/Inputs/dwarfdump-test.elf-x86-64 < %t.input4 \
187 RUN:   | FileCheck %s --check-prefix=BINARY
189 BINARY:       main
190 BINARY-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:16
191 BINARY:      _start
193 RUN: echo "0x400720" > %t.input5
194 RUN: echo "0x4004a0" >> %t.input5
195 RUN: echo "0x4006f0" >> %t.input5
196 RUN: llvm-symbolizer --obj %p/Inputs/llvm-symbolizer-test.elf-x86-64 < %t.input5 \
197 RUN:   | FileCheck %s --check-prefix=BINARY_C
199 BINARY_C:       main
200 BINARY_C-NEXT: /tmp/dbginfo{{[/\\]}}llvm-symbolizer-test.c:10
201 BINARY_C:      _start
202 BINARY_C:      {{g$}}
204 RUN: echo "0x1f1" > %t.input6
205 RUN: llvm-symbolizer --obj %p/Inputs/shared-object-stripped.elf-i386 < %t.input6 \
206 RUN:   | FileCheck %s --check-prefix=STRIPPED
208 STRIPPED:  global_func
210 RUN: echo "%p/Inputs/dwarfdump-test4.elf-x86-64 0x62c" > %t.input7
211 RUN: llvm-symbolizer --functions=short --demangle=false < %t.input7 \
212 RUN:    | FileCheck %s --check-prefix=SHORT_FUNCTION_NAME
214 SHORT_FUNCTION_NAME-NOT: _Z1cv