Skip to content

Commit 23d83a7

Browse files
committed
Address Comments.
1. Remove check-lines 'APPROX-*'. 2. Add new check 'MULTIPLE-ROWS'.
1 parent d389513 commit 23d83a7

File tree

1 file changed

+81
-88
lines changed

1 file changed

+81
-88
lines changed
Lines changed: 81 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,75 @@
1-
## Test --skip-line-zero option.
1+
## Test the "--skip-line-zero" option.
22
##
33
## This test uses handcrafted assembly to produce the following line table:
44
## Address Line Column File ISA Discriminator OpIndex Flags
55
## ------------------ ------ ------ ------ --- ------------- ------- -------------
66
## 0x0000000000001710 1 0 1 0 0 0
77
## 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
1010
## 0x00000000000016c0 0 0 1 0 0 0
1111
## 0x00000000000016cf 2 0 1 0 0 0
1212
## 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
1415

1516
# REQUIRES: x86-registered-target
1617

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
1819

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
2122

22-
# APPROX-DISABLE:main
23-
# APPROX-DISABLE-NEXT:main.c:0:0
23+
# DISABLE:main
24+
# DISABLE-NEXT:main.c:0:0
2425

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
2829

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
3132

3233
## 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)
3438

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
3741

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)
4044

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)
4350
# NO-APPROX:foo
44-
# NO-APPROX-NEXT:main.c:1:0
51+
# NO-APPROX-NEXT:main.c:1:2
4552

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
4855

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
5764

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
6067

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}]}]
6269

6370
## main.c
6471
## __attribute__((section("def"))) int foo() { return 1234; }
65-
## int main(void) { return foo(); }
72+
## int main(void) { return foo()+5678; }
6673
##
6774
## Generated using
6875
## clang -S -gdwarf-4 --target=x86_64-pc-linux -fdebug-prefix-map=/tmp="" main.c -o main.s
@@ -73,12 +80,6 @@
7380
.byte 1 # Abbreviation Code
7481
.byte 17 # DW_TAG_compile_unit
7582
.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
8283
.byte 16 # DW_AT_stmt_list
8384
.byte 23 # DW_FORM_sec_offset
8485
.byte 17 # DW_AT_low_pc
@@ -151,15 +152,12 @@
151152
.long .debug_abbrev # Offset Into Abbrev. Section
152153
.byte 8 # Address Size (in bytes)
153154
.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
157155
.long .Lline_table_start0 # DW_AT_stmt_list
158156
.quad 0 # DW_AT_low_pc
159157
.long .Ldebug_ranges0 # DW_AT_ranges
160158
.byte 2 # Abbrev [2] 0x26:0x19 DW_TAG_subprogram
161159
.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)
163161
.byte 1 # DW_AT_frame_base
164162
.byte 86
165163
.long .Linfo_string2 # DW_AT_name
@@ -169,7 +167,7 @@
169167
# DW_AT_external
170168
.byte 3 # Abbrev [3] 0x3f:0x19 DW_TAG_subprogram
171169
.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)
173171
.byte 1 # DW_AT_frame_base
174172
.byte 86
175173
.long .Linfo_string4 # DW_AT_name
@@ -189,59 +187,54 @@
189187
.quad 0x1710 #.Lfunc_begin0
190188
.quad 0x171b #.Lfunc_end0
191189
.quad 0x16c0 #.Lfunc_begin1
192-
.quad 0x16da #.Lfunc_end1
190+
.quad 0x16df #.Lfunc_end1
193191
.quad 0
194192
.quad 0
195193
.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
200194
.Linfo_string2:
201195
.asciz "foo" # string offset=120
202196
.Linfo_string3:
203197
.asciz "int" # string offset=124
204198
.Linfo_string4:
205199
.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
210200
.section .debug_line,"",@progbits
211201
.Lline_table_start0:
212-
.long .Lunit_end - .Lunit_start # unit length
202+
.long .Lunit_end - .Lunit_start # unit length
213203
.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
216206
.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
230220
.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
247239
.Lunit_end:
240+

0 commit comments

Comments
 (0)