|
1 |
| -## Test --skip-line-zero option. |
| 1 | +## Test the "--skip-line-zero" option. |
2 | 2 | ##
|
3 | 3 | ## This test uses handcrafted assembly to produce the following line table:
|
4 | 4 | ## Address Line Column File ISA Discriminator OpIndex Flags
|
5 | 5 | ## ------------------ ------ ------ ------ --- ------------- ------- -------------
|
6 | 6 | ## 0x0000000000001710 1 0 1 0 0 0
|
7 | 7 | ## 0x0000000000001714 0 0 1 0 0 0
|
8 |
| -## 0x0000000000001719 1 0 1 0 0 0 |
9 |
| -## 0x000000000000171b 1 0 1 0 0 0 end_sequence |
| 8 | +## 0x0000000000001719 1 2 1 0 0 0 |
| 9 | +## 0x000000000000171b 1 2 1 0 0 0 end_sequence |
10 | 10 | ## 0x00000000000016c0 0 0 1 0 0 0
|
11 | 11 | ## 0x00000000000016cf 2 0 1 0 0 0
|
12 | 12 | ## 0x00000000000016d4 0 0 1 0 0 0
|
13 |
| -## 0x00000000000016da 0 0 1 0 0 0 end_sequence |
| 13 | +## 0x00000000000016d9 0 0 1 0 0 0 |
| 14 | +## 0x00000000000016df 0 0 1 0 0 0 end_sequence |
14 | 15 |
|
15 | 16 | # REQUIRES: x86-registered-target
|
16 | 17 |
|
17 |
| -# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux --fdebug-prefix-map=%t="" %s -o %t.o |
| 18 | +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o |
18 | 19 |
|
19 |
| -## Check that without '--skip-line-zero', line number zero is displayed for the line-table entry which has no source correspondence. |
20 |
| -# RUN: llvm-symbolizer --obj=%t.o 0x16d4 | FileCheck --strict-whitespace --match-full-lines --check-prefix=APPROX-DISABLE %s |
| 20 | +## Check that without '--skip-line-zero', line zero is displayed for a line-table entry which has no source correspondence. |
| 21 | +# RUN: llvm-symbolizer --obj=%t.o 0x16d4 | FileCheck --strict-whitespace --match-full-lines --check-prefix=DISABLE %s |
21 | 22 |
|
22 |
| -# APPROX-DISABLE:main |
23 |
| -# APPROX-DISABLE-NEXT:main.c:0:0 |
| 23 | +# DISABLE:main |
| 24 | +# DISABLE-NEXT:main.c:0:0 |
24 | 25 |
|
25 |
| -## Check that with '--skip-line-zero', the last non-zero line in the current sequence is displayed. |
26 |
| -## If it fails to find in the current sequence then return the orignal computed line-zero for the queried address. |
27 |
| -# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero 0x16c0 | FileCheck --strict-whitespace --match-full-lines --check-prefix=APPROX-FAIL-ACROSS-SEQ %s |
| 26 | +## Check that the '--skip-line-zero' does not cross sequence boundaries. |
| 27 | +## If it fails to find in the current sequence then line zero is returned for the queried address. |
| 28 | +# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero 0x16c0 | FileCheck --strict-whitespace --match-full-lines --check-prefix=FAIL-ACROSS-SEQ %s |
28 | 29 |
|
29 |
| -# APPROX-FAIL-ACROSS-SEQ:main |
30 |
| -# APPROX-FAIL-ACROSS-SEQ-NEXT:main.c:0:0 |
| 30 | +# FAIL-ACROSS-SEQ:main |
| 31 | +# FAIL-ACROSS-SEQ-NEXT:main.c:0:0 |
31 | 32 |
|
32 | 33 | ## Check that with '--skip-line-zero', the last non-zero line in the current sequence is displayed.
|
33 |
| -# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero 0x1717 | FileCheck --strict-whitespace --match-full-lines --check-prefix=APPROX-WITHIN-SEQ %s |
| 34 | +# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero 0x1717 | FileCheck --strict-whitespace --match-full-lines --check-prefix=WITHIN-SEQ %s |
| 35 | + |
| 36 | +# WITHIN-SEQ:foo |
| 37 | +# WITHIN-SEQ-NEXT:main.c:1:0 (approximate) |
34 | 38 |
|
35 |
| -# APPROX-WITHIN-SEQ:foo |
36 |
| -# APPROX-WITHIN-SEQ-NEXT:main.c:1:0 (approximate) |
| 39 | +## Check that with '--skip-line-zero', multiple line zero rows are skipped within the current sequence. |
| 40 | +# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero 0x16d9 | FileCheck --strict-whitespace --match-full-lines --check-prefix=MULTIPLE-ROWS %s |
37 | 41 |
|
38 |
| -## Check to ensure that '--skip-line-zero' only affects addresses having line-zero when more than one address is specified. |
39 |
| -# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero 0x16d4 0x1719 | FileCheck --strict-whitespace --match-full-lines --check-prefixes=APPROX-ENABLE,NO-APPROX %s |
| 42 | +# MULTIPLE-ROWS:main |
| 43 | +# MULTIPLE-ROWS-NEXT:main.c:2:0 (approximate) |
40 | 44 |
|
41 |
| -# APPROX-ENABLE:main |
42 |
| -# APPROX-ENABLE-NEXT:main.c:2:0 (approximate) |
| 45 | +## Check that '--skip-line-zero' only affects the line zero addresses when more than one address is specified. |
| 46 | +# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero 0x16d4 0x1719 | FileCheck --strict-whitespace --match-full-lines --check-prefixes=ENABLE,NO-APPROX %s |
| 47 | + |
| 48 | +# ENABLE:main |
| 49 | +# ENABLE-NEXT:main.c:2:0 (approximate) |
43 | 50 | # NO-APPROX:foo
|
44 |
| -# NO-APPROX-NEXT:main.c:1:0 |
| 51 | +# NO-APPROX-NEXT:main.c:1:2 |
45 | 52 |
|
46 |
| -## Check to ensure that '--skip-line-zero' with '--verbose' enabled displays correct approximate flag in verbose ouptut. |
47 |
| -# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero --verbose 0x1717 | FileCheck --strict-whitespace --match-full-lines --check-prefix=APPROX-VERBOSE %s |
| 53 | +## Check to ensure that '--skip-line-zero' with '--verbose' enabled displays approximate flag in verbose ouptut. |
| 54 | +# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero --verbose 0x1717 | FileCheck --strict-whitespace --match-full-lines --check-prefix=VERBOSE %s |
48 | 55 |
|
49 |
| -# APPROX-VERBOSE:foo |
50 |
| -# APPROX-VERBOSE-NEXT: Filename: main.c |
51 |
| -# APPROX-VERBOSE-NEXT: Function start filename: main.c |
52 |
| -# APPROX-VERBOSE-NEXT: Function start line: 1 |
53 |
| -# APPROX-VERBOSE-NEXT: Function start address: 0x1710 |
54 |
| -# APPROX-VERBOSE-NEXT: Line: 1 |
55 |
| -# APPROX-VERBOSE-NEXT: Column: 0 |
56 |
| -# APPROX-VERBOSE-NEXT: Approximate: true |
| 56 | +# VERBOSE:foo |
| 57 | +# VERBOSE-NEXT: Filename: main.c |
| 58 | +# VERBOSE-NEXT: Function start filename: main.c |
| 59 | +# VERBOSE-NEXT: Function start line: 1 |
| 60 | +# VERBOSE-NEXT: Function start address: 0x1710 |
| 61 | +# VERBOSE-NEXT: Line: 1 |
| 62 | +# VERBOSE-NEXT: Column: 0 |
| 63 | +# VERBOSE-NEXT: Approximate: true |
57 | 64 |
|
58 |
| -## Check to ensure that '--skip-line-zero' with '--output-style=JSON' displays correct approximate flag in JSON output. |
59 |
| -# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero --output-style=JSON 0x1717 | FileCheck --strict-whitespace --match-full-lines --check-prefix=APPROX-JSON %s |
| 65 | +## Check to ensure that '--skip-line-zero' with '--output-style=JSON' displays approximate flag in JSON output. |
| 66 | +# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero --output-style=JSON 0x1717 | FileCheck --strict-whitespace --match-full-lines --check-prefix=JSON %s |
60 | 67 |
|
61 |
| -# APPROX-JSON:[{"Address":"0x1717","ModuleName":"{{.*}}{{[/|\]+}}test{{[/|\]+}}tools{{[/|\]+}}llvm-symbolizer{{[/|\]+}}Output{{[/|\]+}}skip-line-zero.s.tmp.o","Symbol":[{"Approximate":true,"Column":0,"Discriminator":0,"FileName":"main.c","FunctionName":"foo","Line":1,"StartAddress":"0x1710","StartFileName":"main.c","StartLine":1}]}] |
| 68 | +# JSON:[{"Address":"0x1717","ModuleName":"{{.*}}{{[/|\]+}}test{{[/|\]+}}tools{{[/|\]+}}llvm-symbolizer{{[/|\]+}}Output{{[/|\]+}}skip-line-zero.s.tmp.o","Symbol":[{"Approximate":true,"Column":0,"Discriminator":0,"FileName":"main.c","FunctionName":"foo","Line":1,"StartAddress":"0x1710","StartFileName":"main.c","StartLine":1}]}] |
62 | 69 |
|
63 | 70 | ## main.c
|
64 | 71 | ## __attribute__((section("def"))) int foo() { return 1234; }
|
65 |
| -## int main(void) { return foo(); } |
| 72 | +## int main(void) { return foo()+5678; } |
66 | 73 | ##
|
67 | 74 | ## Generated using
|
68 | 75 | ## clang -S -gdwarf-4 --target=x86_64-pc-linux -fdebug-prefix-map=/tmp="" main.c -o main.s
|
|
73 | 80 | .byte 1 # Abbreviation Code
|
74 | 81 | .byte 17 # DW_TAG_compile_unit
|
75 | 82 | .byte 1 # DW_CHILDREN_yes
|
76 |
| - .byte 37 # DW_AT_producer |
77 |
| - .byte 14 # DW_FORM_strp |
78 |
| - .byte 19 # DW_AT_language |
79 |
| - .byte 5 # DW_FORM_data2 |
80 |
| - .byte 3 # DW_AT_name |
81 |
| - .byte 14 # DW_FORM_strp |
82 | 83 | .byte 16 # DW_AT_stmt_list
|
83 | 84 | .byte 23 # DW_FORM_sec_offset
|
84 | 85 | .byte 17 # DW_AT_low_pc
|
|
151 | 152 | .long .debug_abbrev # Offset Into Abbrev. Section
|
152 | 153 | .byte 8 # Address Size (in bytes)
|
153 | 154 | .byte 1 # Abbrev [1] 0xb:0x55 DW_TAG_compile_unit
|
154 |
| - .long .Linfo_string0 # DW_AT_producer |
155 |
| - .short 29 # DW_AT_language |
156 |
| - .long .Linfo_string1 # DW_AT_name |
157 | 155 | .long .Lline_table_start0 # DW_AT_stmt_list
|
158 | 156 | .quad 0 # DW_AT_low_pc
|
159 | 157 | .long .Ldebug_ranges0 # DW_AT_ranges
|
160 | 158 | .byte 2 # Abbrev [2] 0x26:0x19 DW_TAG_subprogram
|
161 | 159 | .quad 0x1710 # DW_AT_low_pc (.Lfunc_begin0)
|
162 |
| - .long 0x171b-0x1710 # DW_AT_high_pc (.Lfunc_end0-.Lfunc_begin0) |
| 160 | + .long 0x171b-0x1710 # DW_AT_high_pc(.Lfunc_end0-.Lfunc_begin0) |
163 | 161 | .byte 1 # DW_AT_frame_base
|
164 | 162 | .byte 86
|
165 | 163 | .long .Linfo_string2 # DW_AT_name
|
|
169 | 167 | # DW_AT_external
|
170 | 168 | .byte 3 # Abbrev [3] 0x3f:0x19 DW_TAG_subprogram
|
171 | 169 | .quad 0x16c0 # DW_AT_low_pc (.Lfunc_begin1)
|
172 |
| - .long 0x16da-0x16c0 # DW_AT_high_pc (.Lfunc_end1-.Lfunc_begin1) |
| 170 | + .long 0x16df-0x16c0 # DW_AT_high_pc (.Lfunc_end1-.Lfunc_begin1) |
173 | 171 | .byte 1 # DW_AT_frame_base
|
174 | 172 | .byte 86
|
175 | 173 | .long .Linfo_string4 # DW_AT_name
|
|
189 | 187 | .quad 0x1710 #.Lfunc_begin0
|
190 | 188 | .quad 0x171b #.Lfunc_end0
|
191 | 189 | .quad 0x16c0 #.Lfunc_begin1
|
192 |
| - .quad 0x16da #.Lfunc_end1 |
| 190 | + .quad 0x16df #.Lfunc_end1 |
193 | 191 | .quad 0
|
194 | 192 | .quad 0
|
195 | 193 | .section .debug_str,"MS",@progbits,1
|
196 |
| -.Linfo_string0: |
197 |
| - .asciz "clang version 19.0.0git ([email protected]:ampandey-1995/llvm-project.git 90cd5ed938a244de794a5ce45a44845d20cf91f4)" # string offset=0 |
198 |
| -.Linfo_string1: |
199 |
| - .asciz "main.c" # string offset=113 |
200 | 194 | .Linfo_string2:
|
201 | 195 | .asciz "foo" # string offset=120
|
202 | 196 | .Linfo_string3:
|
203 | 197 | .asciz "int" # string offset=124
|
204 | 198 | .Linfo_string4:
|
205 | 199 | .asciz "main" # string offset=128
|
206 |
| - .ident "clang version 19.0.0git ([email protected]:ampandey-1995/llvm-project.git 90cd5ed938a244de794a5ce45a44845d20cf91f4)" |
207 |
| - .section ".note.GNU-stack","",@progbits |
208 |
| - .addrsig |
209 |
| - .addrsig_sym foo |
210 | 200 | .section .debug_line,"",@progbits
|
211 | 201 | .Lline_table_start0:
|
212 |
| - .long .Lunit_end - .Lunit_start # unit length |
| 202 | + .long .Lunit_end - .Lunit_start # unit length |
213 | 203 | .Lunit_start:
|
214 |
| - .short 4 # version |
215 |
| - .long .Lprologue_end - .Lprologue_start # header length |
| 204 | + .short 4 # version |
| 205 | + .long .Lprologue_end - .Lprologue_start # header length |
216 | 206 | .Lprologue_start:
|
217 |
| - .byte 1 # minimum_instruction_length |
218 |
| - .byte 1 # maximum_operations_per_instruction |
219 |
| - .byte 0 # default_is_stmt |
220 |
| - .byte -5 # line_base |
221 |
| - .byte 14 # line_range |
222 |
| - .byte 13 # opcode_base |
223 |
| - .byte 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 # arguments in standard opcodes |
224 |
| - .byte 0 # end of include directories |
225 |
| - .asciz "main.c" # filename |
226 |
| - .byte 0 # directory index |
227 |
| - .byte 0 # modification time |
228 |
| - .byte 0 # length of file (unavailable) |
229 |
| - .byte 0 # end of filenames |
| 207 | + .byte 1 # minimum_instruction_length |
| 208 | + .byte 1 # maximum_operations_per_instruction |
| 209 | + .byte 0 # default_is_stmt |
| 210 | + .byte -5 # line_base |
| 211 | + .byte 14 # line_range |
| 212 | + .byte 13 # opcode_base |
| 213 | + .byte 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 # arguments in standard opcodes |
| 214 | + .byte 0 # end of include directories |
| 215 | + .asciz "main.c" # filename |
| 216 | + .byte 0 # directory index |
| 217 | + .byte 0 # modification time |
| 218 | + .byte 0 # length of file (unavailable) |
| 219 | + .byte 0 # end of filenames |
230 | 220 | .Lprologue_end:
|
231 |
| - .byte 0x00, 9, 2 # DW_LNE_set_address |
232 |
| - .quad 0x1710 # Address Value |
233 |
| - .byte 0x01 # DW_LNS_copy |
234 |
| - .byte 0x49 # (address += 4, line += -1, op-index += 0) |
235 |
| - .byte 0x59 # (address += 5, line += 1, op-index += 0) |
236 |
| - .byte 0x02 # DW_LNS_advance_pc |
237 |
| - .uleb128 0x02 # (addr += 2, op-index += 0) |
238 |
| - .byte 0x00, 1, 1 # DW_LNE_end_sequence |
239 |
| - .byte 0x00, 9, 2 # DW_LNE_set_address |
240 |
| - .quad 0x16c0 # Address Value |
241 |
| - .byte 0x11 # (address += 0, line += -1, op-index += 0) |
242 |
| - .byte 0xe6 # (address += 15, line += 0, op-index += 0) |
243 |
| - .byte 0x56 # (address += 5, line += -2, op-index += 0) |
244 |
| - .byte 0x02 # DW_LNS_advance_pc |
245 |
| - .uleb128 0x06 # (addr += 6, op-index += 0) |
246 |
| - .byte 0x00, 1, 1 # DW_LNE_end_sequence |
| 221 | + .byte 0x00, 9, 2 # DW_LNE_set_address |
| 222 | + .quad 0x1710 # Address Value |
| 223 | + .byte 0x01 # DW_LNS_copy |
| 224 | + .byte 0x49 # (address += 4, line += -1, op-index += 0) |
| 225 | + .byte 0x05, 2 # DW_LNS_set_column (2) |
| 226 | + .byte 0x59 # (address += 5, line += 1, op-index += 0) |
| 227 | + .byte 0x02 # DW_LNS_advance_pc |
| 228 | + .uleb128 0x02 # (addr += 2, op-index += 0) |
| 229 | + .byte 0x00, 1, 1 # DW_LNE_end_sequence |
| 230 | + .byte 0x00, 9, 2 # DW_LNE_set_address |
| 231 | + .quad 0x16c0 # Address Value |
| 232 | + .byte 0x11 # (address += 0, line += -1, op-index += 0) |
| 233 | + .byte 0xe6 # (address += 15, line += 2, op-index += 0) |
| 234 | + .byte 0x56 # (address += 5, line += -2, op-index += 0) |
| 235 | + .byte 0x58 # (address += 5, line += 0, op-index += 0) |
| 236 | + .byte 0x02 # DW_LNS_advance_pc |
| 237 | + .uleb128 0x06 # (addr += 6, op-index += 0) |
| 238 | + .byte 0x00, 1, 1 # DW_LNE_end_sequence |
247 | 239 | .Lunit_end:
|
| 240 | + |
0 commit comments