Skip to content

Commit 9542e89

Browse files
committed
Address Comments.
1. Add test case approximate-line-handcrafted.s. 2. Add descriptive comments for RUN lines.
1 parent a8d5576 commit 9542e89

File tree

3 files changed

+516
-611
lines changed

3 files changed

+516
-611
lines changed

llvm/test/tools/llvm-symbolizer/approximate-line-generated.s

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,49 @@
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+
111
# REQUIRES: x86-registered-target
212

313
# 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.
517
# 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
1018

1119
# APPROX-DISABLE:main
1220
# 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+
1325
# APPROX-ENABLE:main
1426
# 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+
1531
# NO-APPROX:main
1632
# NO-APPROX-NEXT:main.c:8:2
1733

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+
1837
# APPROX-VERBOSE:main
1938
# APPROX-VERBOSE-NEXT: Filename: main.c
2039
# APPROX-VERBOSE-NEXT: Function start address: 0x0
2140
# APPROX-VERBOSE-NEXT: Line: 4
2241
# APPROX-VERBOSE-NEXT: Column: 5
2342
# APPROX-VERBOSE-NEXT: Approximate: true
2443

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+
2547
# 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}]}]
2648

2749
#--- main.c

0 commit comments

Comments
 (0)