xref: /llvm-project/llvm/test/DebugInfo/symbolize-filter-markup-bt.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 [0x10-0x10f](r)[[END:\]{3}]]
13CHECK:    #0.1  0x0000000000000018 second /tmp[[SEP:[/\\]]]tmp.c:8:3 (a.o+0x8)
14CHECK:    #0    0x0000000000000018 first /tmp[[SEP]]tmp.c:4:3 (a.o+0x8)
15CHECK:    #1.1  0x0000000000000018 second /tmp[[SEP]]tmp.c:8:3 (a.o+0x8)
16CHECK:    #1    0x0000000000000018 first /tmp[[SEP]]tmp.c:4:3 (a.o+0x8)
17CHECK:    #0.1  0x0000000000000018 second /tmp[[SEP]]tmp.c:8:3 (a.o+0x8)
18CHECK:    #0    0x0000000000000018 first /tmp[[SEP]]tmp.c:4:3 (a.o+0x8)
19CHECK:    #0    0x0000000000000019 first /tmp[[SEP]]tmp.c:5:1 (a.o+0x9)
20CHECK:    #0    0x00000000000000fe (a.o+0xee)
21
22CHECK:    #0    0x00000000000000fe (a.o+0xee)
23ERR: warning: expected at most 3 field(s); found 4
24CHECK: [[BEGIN]]bt:0:0x111[[END]]
25ERR: error: no mmap covers address
26
27ERR: error: expected at least 2 field(s); found 0
28ERR: error: expected PC type; found ''
29
30;--- input
31{{{module:0:a.o:elf:abcdef}}}
32{{{mmap:0x10:256:load:0:r:0}}}
33{{{bt:0:0x19}}}
34{{{bt:1:0x19}}}
35{{{bt:0:0x19:ra}}}
36{{{bt:0:0x19:pc}}}
37{{{bt:0:0xff}}}
38
39{{{bt:0:0xff:pc:ext}}}
40{{{bt:0:0x111}}}
41
42{{{bt}}}
43{{{bt:0:0:}}}
44;--- asm.s
45# Generated by running "clang -finline -g -S tmp.c" in the following tmp.c on
46# Linux x86_64:
47#
48# static void second(void);
49# void first(void) {
50#   second();
51# }
52# void second(void) {}
53	.text
54	.file	"tmp.c"
55	.globl	first                           # -- Begin function first
56	.p2align	4, 0x90
57	.type	first,@function
58first:                                  # @first
59.Lfunc_begin0:
60	.file	1 "/tmp" "tmp.c"
61	.loc	1 3 0                           # tmp.c:3:0
62	.cfi_startproc
63# %bb.0:
64	pushq	%rbp
65	.cfi_def_cfa_offset 16
66	.cfi_offset %rbp, -16
67	movq	%rsp, %rbp
68	.cfi_def_cfa_register %rbp
69.Ltmp0:
70	.loc	1 8 3 prologue_end              # tmp.c:8:3
71	callq	first
72.Ltmp1:
73	.loc	1 5 1                           # tmp.c:5:1
74	popq	%rbp
75	.cfi_def_cfa %rsp, 8
76	retq
77.Ltmp2:
78.Lfunc_end0:
79	.size	first, .Lfunc_end0-first
80	.cfi_endproc
81                                        # -- End function
82	.section	.debug_abbrev,"",@progbits
83	.byte	1                               # Abbreviation Code
84	.byte	17                              # DW_TAG_compile_unit
85	.byte	1                               # DW_CHILDREN_yes
86	.byte	37                              # DW_AT_producer
87	.byte	14                              # DW_FORM_strp
88	.byte	19                              # DW_AT_language
89	.byte	5                               # DW_FORM_data2
90	.byte	3                               # DW_AT_name
91	.byte	14                              # DW_FORM_strp
92	.byte	16                              # DW_AT_stmt_list
93	.byte	23                              # DW_FORM_sec_offset
94	.byte	27                              # DW_AT_comp_dir
95	.byte	14                              # DW_FORM_strp
96	.byte	17                              # DW_AT_low_pc
97	.byte	1                               # DW_FORM_addr
98	.byte	18                              # DW_AT_high_pc
99	.byte	6                               # DW_FORM_data4
100	.byte	0                               # EOM(1)
101	.byte	0                               # EOM(2)
102	.byte	2                               # Abbreviation Code
103	.byte	46                              # DW_TAG_subprogram
104	.byte	0                               # DW_CHILDREN_no
105	.byte	3                               # DW_AT_name
106	.byte	14                              # DW_FORM_strp
107	.byte	58                              # DW_AT_decl_file
108	.byte	11                              # DW_FORM_data1
109	.byte	59                              # DW_AT_decl_line
110	.byte	11                              # DW_FORM_data1
111	.byte	39                              # DW_AT_prototyped
112	.byte	25                              # DW_FORM_flag_present
113	.byte	63                              # DW_AT_external
114	.byte	25                              # DW_FORM_flag_present
115	.byte	32                              # DW_AT_inline
116	.byte	11                              # DW_FORM_data1
117	.byte	0                               # EOM(1)
118	.byte	0                               # EOM(2)
119	.byte	3                               # Abbreviation Code
120	.byte	46                              # DW_TAG_subprogram
121	.byte	1                               # DW_CHILDREN_yes
122	.byte	17                              # DW_AT_low_pc
123	.byte	1                               # DW_FORM_addr
124	.byte	18                              # DW_AT_high_pc
125	.byte	6                               # DW_FORM_data4
126	.byte	64                              # DW_AT_frame_base
127	.byte	24                              # DW_FORM_exprloc
128	.byte	3                               # DW_AT_name
129	.byte	14                              # DW_FORM_strp
130	.byte	58                              # DW_AT_decl_file
131	.byte	11                              # DW_FORM_data1
132	.byte	59                              # DW_AT_decl_line
133	.byte	11                              # DW_FORM_data1
134	.byte	39                              # DW_AT_prototyped
135	.byte	25                              # DW_FORM_flag_present
136	.byte	63                              # DW_AT_external
137	.byte	25                              # DW_FORM_flag_present
138	.byte	0                               # EOM(1)
139	.byte	0                               # EOM(2)
140	.byte	4                               # Abbreviation Code
141	.byte	29                              # DW_TAG_inlined_subroutine
142	.byte	0                               # DW_CHILDREN_no
143	.byte	49                              # DW_AT_abstract_origin
144	.byte	19                              # DW_FORM_ref4
145	.byte	17                              # DW_AT_low_pc
146	.byte	1                               # DW_FORM_addr
147	.byte	18                              # DW_AT_high_pc
148	.byte	6                               # DW_FORM_data4
149	.byte	88                              # DW_AT_call_file
150	.byte	11                              # DW_FORM_data1
151	.byte	89                              # DW_AT_call_line
152	.byte	11                              # DW_FORM_data1
153	.byte	87                              # DW_AT_call_column
154	.byte	11                              # DW_FORM_data1
155	.byte	0                               # EOM(1)
156	.byte	0                               # EOM(2)
157	.byte	0                               # EOM(3)
158	.section	.debug_info,"",@progbits
159.Lcu_begin0:
160	.long	.Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
161.Ldebug_info_start0:
162	.short	4                               # DWARF version number
163	.long	.debug_abbrev                   # Offset Into Abbrev. Section
164	.byte	8                               # Address Size (in bytes)
165	.byte	1                               # Abbrev [1] 0xb:0x52 DW_TAG_compile_unit
166	.long	.Linfo_string0                  # DW_AT_producer
167	.short	12                              # DW_AT_language
168	.long	.Linfo_string1                  # DW_AT_name
169	.long	.Lline_table_start0             # DW_AT_stmt_list
170	.long	.Linfo_string2                  # DW_AT_comp_dir
171	.quad	.Lfunc_begin0                   # DW_AT_low_pc
172	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc
173	.byte	2                               # Abbrev [2] 0x2a:0x8 DW_TAG_subprogram
174	.long	.Linfo_string3                  # DW_AT_name
175	.byte	1                               # DW_AT_decl_file
176	.byte	7                               # DW_AT_decl_line
177                                        # DW_AT_prototyped
178                                        # DW_AT_external
179	.byte	1                               # DW_AT_inline
180	.byte	3                               # Abbrev [3] 0x32:0x2a DW_TAG_subprogram
181	.quad	.Lfunc_begin0                   # DW_AT_low_pc
182	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc
183	.byte	1                               # DW_AT_frame_base
184	.byte	86
185	.long	.Linfo_string4                  # DW_AT_name
186	.byte	1                               # DW_AT_decl_file
187	.byte	3                               # DW_AT_decl_line
188                                        # DW_AT_prototyped
189                                        # DW_AT_external
190	.byte	4                               # Abbrev [4] 0x47:0x14 DW_TAG_inlined_subroutine
191	.long	42                              # DW_AT_abstract_origin
192	.quad	.Ltmp0                          # DW_AT_low_pc
193	.long	.Ltmp1-.Ltmp0                   # DW_AT_high_pc
194	.byte	1                               # DW_AT_call_file
195	.byte	4                               # DW_AT_call_line
196	.byte	3                               # DW_AT_call_column
197	.byte	0                               # End Of Children Mark
198	.byte	0                               # End Of Children Mark
199.Ldebug_info_end0:
200	.section	.debug_str,"MS",@progbits,1
201.Linfo_string0:
202	.asciz	"Debian clang version 13.0.1-6" # string offset=0
203.Linfo_string1:
204	.asciz	"tmp.c"                         # string offset=30
205.Linfo_string2:
206	.asciz	"/tmp" # string offset=36
207.Linfo_string3:
208	.asciz	"second"                        # string offset=85
209.Linfo_string4:
210	.asciz	"first"                         # string offset=92
211	.ident	"Debian clang version 13.0.1-6"
212	.section	".note.GNU-stack","",@progbits
213	.addrsig
214	.addrsig_sym first
215	.section	.debug_line,"",@progbits
216.Lline_table_start0:
217