|
| 1 | +## Test the --skip-line-zero option. |
| 2 | +## |
| 3 | +## This test illustrates the usage of generated assembly by clang to produce the following line table: |
| 4 | +## Address Line Column File ISA Discriminator OpIndex Flags |
| 5 | +## ------------------ ------ ------ ------ --- ------------- ------- ------------- |
| 6 | +## 0x0000000000000000 4 5 0 0 0 0 is_stmt prologue_end |
| 7 | +## 0x000000000000000a 0 5 0 0 0 0 |
| 8 | +## 0x0000000000000010 8 2 0 0 0 0 is_stmt |
| 9 | +## 0x0000000000000011 8 2 0 0 0 0 is_stmt end_sequence |
| 10 | + |
1 | 11 | # REQUIRES: x86-registered-target
|
2 | 12 |
|
3 | 13 | # RUN: rm -rf %t && split-file %s %t && cd %t
|
4 |
| -# RUN: llvm-mc -g -filetype=obj -triple=x86_64-pc-linux --fdebug-prefix-map=%t="" %s -o %t.o |
| 14 | +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux --fdebug-prefix-map=%t="" %s -o %t.o |
| 15 | + |
| 16 | +## Check that without '--skip-line-zero', line-zero is displayed for a line with no source correspondence. |
5 | 17 | # RUN: llvm-symbolizer --obj=%t.o 0xa | FileCheck --strict-whitespace --match-full-lines --check-prefix=APPROX-DISABLE %s
|
6 |
| -# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero 0xa | FileCheck --strict-whitespace --match-full-lines --check-prefix=APPROX-ENABLE %s |
7 |
| -# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero 0xa 0x10 | FileCheck --strict-whitespace --match-full-lines --check-prefixes=APPROX-ENABLE,NO-APPROX %s |
8 |
| -# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero --verbose 0xa | FileCheck --strict-whitespace --match-full-lines --check-prefix=APPROX-VERBOSE %s |
9 |
| -# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero --output-style=JSON 0xa | FileCheck --strict-whitespace --match-full-lines --check-prefix=APPROX-JSON %s |
10 | 18 |
|
11 | 19 | # APPROX-DISABLE:main
|
12 | 20 | # APPROX-DISABLE-NEXT:main.c:0:5
|
| 21 | + |
| 22 | +## Check that with '--skip-line-zero', the last non-zero line in the current sequence is displayed. |
| 23 | +# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero 0xa | FileCheck --strict-whitespace --match-full-lines --check-prefix=APPROX-ENABLE %s |
| 24 | + |
13 | 25 | # APPROX-ENABLE:main
|
14 | 26 | # APPROX-ENABLE-NEXT:main.c:4:5 (approximate)
|
| 27 | + |
| 28 | +## Check to ensure that '--skip-line-zero' only affects addresses having line-zero when more than one address is specified. |
| 29 | +# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero 0xa 0x10 | FileCheck --strict-whitespace --match-full-lines --check-prefixes=APPROX-ENABLE,NO-APPROX %s |
| 30 | + |
15 | 31 | # NO-APPROX:main
|
16 | 32 | # NO-APPROX-NEXT:main.c:8:2
|
17 | 33 |
|
| 34 | +## Check to ensure that '--skip-line-zero' with '--verbose' enabled displays correct approximate output. |
| 35 | +# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero --verbose 0xa | FileCheck --strict-whitespace --match-full-lines --check-prefix=APPROX-VERBOSE %s |
| 36 | + |
18 | 37 | # APPROX-VERBOSE:main
|
19 | 38 | # APPROX-VERBOSE-NEXT: Filename: main.c
|
20 | 39 | # APPROX-VERBOSE-NEXT: Function start address: 0x0
|
21 | 40 | # APPROX-VERBOSE-NEXT: Line: 4
|
22 | 41 | # APPROX-VERBOSE-NEXT: Column: 5
|
23 | 42 | # APPROX-VERBOSE-NEXT: Approximate: true
|
24 | 43 |
|
| 44 | +## Check to ensure that '--skip-line-zero' with '--output-style=JSON' displays correct approximate output(JSON). |
| 45 | +# RUN: llvm-symbolizer --obj=%t.o --skip-line-zero --output-style=JSON 0xa | FileCheck --strict-whitespace --match-full-lines --check-prefix=APPROX-JSON %s |
| 46 | + |
25 | 47 | # APPROX-JSON:[{"Address":"0xa","ModuleName":"{{.*}}{{[/|\]+}}test{{[/|\]+}}tools{{[/|\]+}}llvm-symbolizer{{[/|\]+}}Output{{[/|\]+}}approximate-line-generated.s.tmp.o","Symbol":[{"Approximate":true,"Column":5,"Discriminator":0,"FileName":"main.c","FunctionName":"main","Line":4,"StartAddress":"0x0","StartFileName":"","StartLine":0}]}]
|
26 | 48 |
|
27 | 49 | #--- main.c
|
|
0 commit comments