xref: /llvm-project/llvm/test/DebugInfo/symbolize-filter-markup-pc.test (revision 7b31a73ffe87e6302ab433da8128058fce8f54bd)
1REQUIRES: x86-registered-target
2RUN: split-file %s %t
3RUN: mkdir -p %t/.build-id/ab
4RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %t/asm.s \
5RUN:   -o %t/.build-id/ab/cdef.debug
6RUN: llvm-symbolizer --debug-file-directory=%t --filter-markup < %t/input \
7RUN:   > %t.output 2> %t.err
8RUN: FileCheck %s --input-file=%t.output --match-full-lines \
9RUN:   --implicit-check-not {{.}}
10RUN: FileCheck %s --check-prefix=ERR --input-file=%t.err --match-full-lines
11
12CHECK: [[BEGIN:\[{3}]]ELF module #0x0 "a.o"; BuildID=abcdef [0x0-0xff](r)[[END:\]{3}]]
13CHECK: first[/dir[[SEP:[/\\]]]tmp.c:3]
14CHECK: first[/dir[[SEP]]tmp.c:5]
15CHECK: first[/dir[[SEP]]tmp.c:4]
16CHECK: first[/dir[[SEP]]tmp.c:5]
17
18CHECK: [[BEGIN]]pc:0xff[[END]]
19CHECK: [[BEGIN]]pc:0x100[[END]]
20CHECK: first[/dir[[SEP]]tmp.c:5]
21ERR: error: no mmap covers address
22ERR: warning: expected at most 2 field(s); found 3
23
24ERR: error: expected at least 1 field(s); found 0
25ERR: error: expected PC type; found ''
26
27;--- input
28{{{module:0:a.o:elf:abcdef}}}
29{{{mmap:0:256:load:0:r:0}}}
30{{{pc:0}}}
31{{{pc:0x9}}}
32{{{pc:0x9:ra}}}
33{{{pc:0x9:pc}}}
34
35{{{pc:0xff}}}
36{{{pc:0x100}}}
37{{{pc:0x9:pc:ext}}}
38
39{{{pc}}}
40{{{pc:0x9:}}}
41;--- asm.s
42	.text
43	.file	"tmp.c"
44	.globl	first                           # -- Begin function first
45	.p2align	4, 0x90
46	.type	first,@function
47first:                                  # @first
48.Lfunc_begin0:
49	.file	1 "/dir" "tmp.c"
50	.loc	1 3 0                           # tmp.c:3:0
51	.cfi_startproc
52# %bb.0:
53	pushq	%rbp
54	.cfi_def_cfa_offset 16
55	.cfi_offset %rbp, -16
56	movq	%rsp, %rbp
57	.cfi_def_cfa_register %rbp
58.Ltmp0:
59	.loc	1 4 3 prologue_end              # tmp.c:4:3
60	callq	second
61	.loc	1 5 1                           # tmp.c:5:1
62	popq	%rbp
63	.cfi_def_cfa %rsp, 8
64	retq
65.Ltmp1:
66.Lfunc_end0:
67	.size	first, .Lfunc_end0-first
68	.cfi_endproc
69                                        # -- End function
70	.globl	second                          # -- Begin function second
71	.p2align	4, 0x90
72	.type	second,@function
73second:                                 # @second
74.Lfunc_begin1:
75	.loc	1 7 0                           # tmp.c:7:0
76	.cfi_startproc
77# %bb.0:
78	pushq	%rbp
79	.cfi_def_cfa_offset 16
80	.cfi_offset %rbp, -16
81	movq	%rsp, %rbp
82	.cfi_def_cfa_register %rbp
83.Ltmp2:
84	.loc	1 8 3 prologue_end              # tmp.c:8:3
85	callq	first
86	.loc	1 9 1                           # tmp.c:9:1
87	popq	%rbp
88	.cfi_def_cfa %rsp, 8
89	retq
90.Ltmp3:
91.Lfunc_end1:
92	.size	second, .Lfunc_end1-second
93	.cfi_endproc
94                                        # -- End function
95	.section	.debug_abbrev,"",@progbits
96	.byte	1                               # Abbreviation Code
97	.byte	17                              # DW_TAG_compile_unit
98	.byte	1                               # DW_CHILDREN_yes
99	.byte	37                              # DW_AT_producer
100	.byte	14                              # DW_FORM_strp
101	.byte	19                              # DW_AT_language
102	.byte	5                               # DW_FORM_data2
103	.byte	3                               # DW_AT_name
104	.byte	14                              # DW_FORM_strp
105	.byte	16                              # DW_AT_stmt_list
106	.byte	23                              # DW_FORM_sec_offset
107	.byte	27                              # DW_AT_comp_dir
108	.byte	14                              # DW_FORM_strp
109	.byte	17                              # DW_AT_low_pc
110	.byte	1                               # DW_FORM_addr
111	.byte	18                              # DW_AT_high_pc
112	.byte	6                               # DW_FORM_data4
113	.byte	0                               # EOM(1)
114	.byte	0                               # EOM(2)
115	.byte	2                               # Abbreviation Code
116	.byte	46                              # DW_TAG_subprogram
117	.byte	0                               # DW_CHILDREN_no
118	.byte	17                              # DW_AT_low_pc
119	.byte	1                               # DW_FORM_addr
120	.byte	18                              # DW_AT_high_pc
121	.byte	6                               # DW_FORM_data4
122	.byte	64                              # DW_AT_frame_base
123	.byte	24                              # DW_FORM_exprloc
124	.byte	3                               # DW_AT_name
125	.byte	14                              # DW_FORM_strp
126	.byte	58                              # DW_AT_decl_file
127	.byte	11                              # DW_FORM_data1
128	.byte	59                              # DW_AT_decl_line
129	.byte	11                              # DW_FORM_data1
130	.byte	39                              # DW_AT_prototyped
131	.byte	25                              # DW_FORM_flag_present
132	.byte	63                              # DW_AT_external
133	.byte	25                              # DW_FORM_flag_present
134	.byte	0                               # EOM(1)
135	.byte	0                               # EOM(2)
136	.byte	0                               # EOM(3)
137	.section	.debug_info,"",@progbits
138.Lcu_begin0:
139	.long	.Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
140.Ldebug_info_start0:
141	.short	4                               # DWARF version number
142	.long	.debug_abbrev                   # Offset Into Abbrev. Section
143	.byte	8                               # Address Size (in bytes)
144	.byte	1                               # Abbrev [1] 0xb:0x4a DW_TAG_compile_unit
145	.long	.Linfo_string0                  # DW_AT_producer
146	.short	12                              # DW_AT_language
147	.long	.Linfo_string1                  # DW_AT_name
148	.long	.Lline_table_start0             # DW_AT_stmt_list
149	.long	.Linfo_string2                  # DW_AT_comp_dir
150	.quad	.Lfunc_begin0                   # DW_AT_low_pc
151	.long	.Lfunc_end1-.Lfunc_begin0       # DW_AT_high_pc
152	.byte	2                               # Abbrev [2] 0x2a:0x15 DW_TAG_subprogram
153	.quad	.Lfunc_begin0                   # DW_AT_low_pc
154	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc
155	.byte	1                               # DW_AT_frame_base
156	.byte	86
157	.long	.Linfo_string3                  # DW_AT_name
158	.byte	1                               # DW_AT_decl_file
159	.byte	3                               # DW_AT_decl_line
160                                        # DW_AT_prototyped
161                                        # DW_AT_external
162	.byte	2                               # Abbrev [2] 0x3f:0x15 DW_TAG_subprogram
163	.quad	.Lfunc_begin1                   # DW_AT_low_pc
164	.long	.Lfunc_end1-.Lfunc_begin1       # DW_AT_high_pc
165	.byte	1                               # DW_AT_frame_base
166	.byte	86
167	.long	.Linfo_string4                  # DW_AT_name
168	.byte	1                               # DW_AT_decl_file
169	.byte	7                               # DW_AT_decl_line
170                                        # DW_AT_prototyped
171                                        # DW_AT_external
172	.byte	0                               # End Of Children Mark
173.Ldebug_info_end0:
174	.section	.debug_str,"MS",@progbits,1
175.Linfo_string0:
176	.asciz	"clang" # string offset=0
177.Linfo_string1:
178	.asciz	"tmp.c"                         # string offset=30
179.Linfo_string2:
180	.asciz	"/dir" # string offset=36
181.Linfo_string3:
182	.asciz	"first"                         # string offset=85
183.Linfo_string4:
184	.asciz	"second"                        # string offset=91
185	.ident	"clang"
186	.section	".note.GNU-stack","",@progbits
187	.addrsig
188	.addrsig_sym first
189	.addrsig_sym second
190	.section	.debug_line,"",@progbits
191.Lline_table_start0:
192