brintos

brintos / llvm-project-archived public Read only

0
0
Text · 20.7 KiB · e7fc0da Raw
445 lines · plain
1# REQUIRES: system-linux2 3# RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %s -o %tmain.o4# RUN: %clang %cflags -dwarf-4 %tmain.o -o %t.exe -Wl,-q5# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections --use-old-text6# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt > %t.txt7# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe >> %t.txt8# RUN: cat %t.txt | FileCheck --check-prefix=CHECK %s9 10# CHECK: 		DW_TAG_inlined_subroutine11# CHECK: 		DW_AT_low_pc [DW_FORM_addr] (0x[[#%.16x,ADDR:]])12# CHECK:		DW_AT_high_pc [DW_FORM_data4] (0x00000000)13 14# CHECK:		DW_TAG_inlined_subroutine15# CHECK-NOT:	DW_AT_low_pc [DW_FORM_addr] (0x[[#ADDR]])16# CHECK:		DW_AT_high_pc [DW_FORM_data4] (0x00000000)17 18 19## Testing BOLT handles correctly when size of DW_AT_inlined_subroutine is 0.20## In other words DW_AT_high_pc is 0 or DW_AT_low_pc == DW_AT_high_pc.21 22# Modified assembly manually to set DW_AT_high_pc to 0.23# clang++ -g2 -gdwarf-4 main.cpp -O1 -S -o main4.s24 25# static int helper(int i) {26#   return ++i;27# }28# void may_not_exist(void) __attribute__ ((weak));29# int main(int argc, char *argv[]) {30#   if (may_not_exist)31#     may_not_exist();32#   int j = 0;33#   [[clang::always_inline]] j = helper(argc);34#   return j;35# }36 37 38	.text39	.file	"main.cpp"40	.globl	main                            # -- Begin function main41	.p2align	4, 0x9042	.type	main,@function43main:                                   # @main44.Lfunc_begin0:45	.file	1 "." "main.cpp"46	.loc	1 5 0                           # main.cpp:5:047	.cfi_startproc48# %bb.0:                                # %entry49	#DEBUG_VALUE: main:argc <- $edi50	#DEBUG_VALUE: main:argv <- $rsi51	pushq	%rbx52	.cfi_def_cfa_offset 1653	.cfi_offset %rbx, -1654	movl	%edi, %ebx55.Ltmp0:56	.loc	1 6 7 prologue_end              # main.cpp:6:757	cmpq	$0, _Z13may_not_existv@GOTPCREL(%rip)58	je	.LBB0_259.Ltmp1:60# %bb.1:                                # %if.then61	#DEBUG_VALUE: main:argc <- $ebx62	#DEBUG_VALUE: main:argv <- $rsi63	.loc	1 7 5                           # main.cpp:7:564	callq	_Z13may_not_existv@PLT65.Ltmp2:66	#DEBUG_VALUE: main:argv <- [DW_OP_LLVM_entry_value 1] $rsi67.LBB0_2:                                # %if.end68	#DEBUG_VALUE: main:argc <- $ebx69	#DEBUG_VALUE: main:argv <- [DW_OP_LLVM_entry_value 1] $rsi70	#DEBUG_VALUE: main:j <- 071	#DEBUG_VALUE: helper:i <- $ebx72	.loc	1 2 10                          # main.cpp:2:1073	incl	%ebx74.Ltmp3:75	#DEBUG_VALUE: main:argc <- [DW_OP_LLVM_entry_value 1] $edi76	#DEBUG_VALUE: helper:i <- $ebx77	#DEBUG_VALUE: main:j <- $ebx78	.loc	1 10 3                          # main.cpp:10:379	movl	%ebx, %eax80	popq	%rbx81.Ltmp4:82	#DEBUG_VALUE: helper:i <- $eax83	#DEBUG_VALUE: main:j <- $eax84	.cfi_def_cfa_offset 885	retq86.Ltmp5:87.Lfunc_end0:88	.size	main, .Lfunc_end0-main89	.cfi_endproc90                                        # -- End function91	.section	.debug_loc,"",@progbits92.Ldebug_loc0:93	.quad	.Lfunc_begin0-.Lfunc_begin094	.quad	.Ltmp1-.Lfunc_begin095	.short	1                               # Loc expr size96	.byte	85                              # super-register DW_OP_reg597	.quad	.Ltmp1-.Lfunc_begin098	.quad	.Ltmp3-.Lfunc_begin099	.short	1                               # Loc expr size100	.byte	83                              # super-register DW_OP_reg3101	.quad	.Ltmp3-.Lfunc_begin0102	.quad	.Lfunc_end0-.Lfunc_begin0103	.short	4                               # Loc expr size104	.byte	243                             # DW_OP_GNU_entry_value105	.byte	1                               # 1106	.byte	85                              # super-register DW_OP_reg5107	.byte	159                             # DW_OP_stack_value108	.quad	0109	.quad	0110.Ldebug_loc1:111	.quad	.Lfunc_begin0-.Lfunc_begin0112	.quad	.Ltmp2-.Lfunc_begin0113	.short	1                               # Loc expr size114	.byte	84                              # DW_OP_reg4115	.quad	.Ltmp2-.Lfunc_begin0116	.quad	.Lfunc_end0-.Lfunc_begin0117	.short	4                               # Loc expr size118	.byte	243                             # DW_OP_GNU_entry_value119	.byte	1                               # 1120	.byte	84                              # DW_OP_reg4121	.byte	159                             # DW_OP_stack_value122	.quad	0123	.quad	0124.Ldebug_loc2:125	.quad	.Ltmp2-.Lfunc_begin0126	.quad	.Ltmp3-.Lfunc_begin0127	.short	3                               # Loc expr size128	.byte	17                              # DW_OP_consts129	.byte	0                               # 0130	.byte	159                             # DW_OP_stack_value131	.quad	.Ltmp3-.Lfunc_begin0132	.quad	.Ltmp4-.Lfunc_begin0133	.short	1                               # Loc expr size134	.byte	83                              # super-register DW_OP_reg3135	.quad	.Ltmp4-.Lfunc_begin0136	.quad	.Lfunc_end0-.Lfunc_begin0137	.short	1                               # Loc expr size138	.byte	80                              # super-register DW_OP_reg0139	.quad	0140	.quad	0141	.section	.debug_abbrev,"",@progbits142	.byte	1                               # Abbreviation Code143	.byte	17                              # DW_TAG_compile_unit144	.byte	1                               # DW_CHILDREN_yes145	.byte	37                              # DW_AT_producer146	.byte	14                              # DW_FORM_strp147	.byte	19                              # DW_AT_language148	.byte	5                               # DW_FORM_data2149	.byte	3                               # DW_AT_name150	.byte	14                              # DW_FORM_strp151	.byte	16                              # DW_AT_stmt_list152	.byte	23                              # DW_FORM_sec_offset153	.byte	27                              # DW_AT_comp_dir154	.byte	14                              # DW_FORM_strp155	.byte	17                              # DW_AT_low_pc156	.byte	1                               # DW_FORM_addr157	.byte	18                              # DW_AT_high_pc158	.byte	6                               # DW_FORM_data4159	.byte	0                               # EOM(1)160	.byte	0                               # EOM(2)161	.byte	2                               # Abbreviation Code162	.byte	46                              # DW_TAG_subprogram163	.byte	1                               # DW_CHILDREN_yes164	.byte	110                             # DW_AT_linkage_name165	.byte	14                              # DW_FORM_strp166	.byte	3                               # DW_AT_name167	.byte	14                              # DW_FORM_strp168	.byte	58                              # DW_AT_decl_file169	.byte	11                              # DW_FORM_data1170	.byte	59                              # DW_AT_decl_line171	.byte	11                              # DW_FORM_data1172	.byte	73                              # DW_AT_type173	.byte	19                              # DW_FORM_ref4174	.byte	32                              # DW_AT_inline175	.byte	11                              # DW_FORM_data1176	.byte	0                               # EOM(1)177	.byte	0                               # EOM(2)178	.byte	3                               # Abbreviation Code179	.byte	5                               # DW_TAG_formal_parameter180	.byte	0                               # DW_CHILDREN_no181	.byte	3                               # DW_AT_name182	.byte	14                              # DW_FORM_strp183	.byte	58                              # DW_AT_decl_file184	.byte	11                              # DW_FORM_data1185	.byte	59                              # DW_AT_decl_line186	.byte	11                              # DW_FORM_data1187	.byte	73                              # DW_AT_type188	.byte	19                              # DW_FORM_ref4189	.byte	0                               # EOM(1)190	.byte	0                               # EOM(2)191	.byte	4                               # Abbreviation Code192	.byte	36                              # DW_TAG_base_type193	.byte	0                               # DW_CHILDREN_no194	.byte	3                               # DW_AT_name195	.byte	14                              # DW_FORM_strp196	.byte	62                              # DW_AT_encoding197	.byte	11                              # DW_FORM_data1198	.byte	11                              # DW_AT_byte_size199	.byte	11                              # DW_FORM_data1200	.byte	0                               # EOM(1)201	.byte	0                               # EOM(2)202	.byte	5                               # Abbreviation Code203	.byte	46                              # DW_TAG_subprogram204	.byte	1                               # DW_CHILDREN_yes205	.byte	17                              # DW_AT_low_pc206	.byte	1                               # DW_FORM_addr207	.byte	18                              # DW_AT_high_pc208	.byte	6                               # DW_FORM_data4209	.byte	64                              # DW_AT_frame_base210	.byte	24                              # DW_FORM_exprloc211	.ascii	"\227B"                         # DW_AT_GNU_all_call_sites212	.byte	25                              # DW_FORM_flag_present213	.byte	3                               # DW_AT_name214	.byte	14                              # DW_FORM_strp215	.byte	58                              # DW_AT_decl_file216	.byte	11                              # DW_FORM_data1217	.byte	59                              # DW_AT_decl_line218	.byte	11                              # DW_FORM_data1219	.byte	73                              # DW_AT_type220	.byte	19                              # DW_FORM_ref4221	.byte	63                              # DW_AT_external222	.byte	25                              # DW_FORM_flag_present223	.byte	0                               # EOM(1)224	.byte	0                               # EOM(2)225	.byte	6                               # Abbreviation Code226	.byte	5                               # DW_TAG_formal_parameter227	.byte	0                               # DW_CHILDREN_no228	.byte	2                               # DW_AT_location229	.byte	23                              # DW_FORM_sec_offset230	.byte	3                               # DW_AT_name231	.byte	14                              # DW_FORM_strp232	.byte	58                              # DW_AT_decl_file233	.byte	11                              # DW_FORM_data1234	.byte	59                              # DW_AT_decl_line235	.byte	11                              # DW_FORM_data1236	.byte	73                              # DW_AT_type237	.byte	19                              # DW_FORM_ref4238	.byte	0                               # EOM(1)239	.byte	0                               # EOM(2)240	.byte	7                               # Abbreviation Code241	.byte	52                              # DW_TAG_variable242	.byte	0                               # DW_CHILDREN_no243	.byte	2                               # DW_AT_location244	.byte	23                              # DW_FORM_sec_offset245	.byte	3                               # DW_AT_name246	.byte	14                              # DW_FORM_strp247	.byte	58                              # DW_AT_decl_file248	.byte	11                              # DW_FORM_data1249	.byte	59                              # DW_AT_decl_line250	.byte	11                              # DW_FORM_data1251	.byte	73                              # DW_AT_type252	.byte	19                              # DW_FORM_ref4253	.byte	0                               # EOM(1)254	.byte	0                               # EOM(2)255	.byte	8                               # Abbreviation Code256	.byte	29                              # DW_TAG_inlined_subroutine257	.byte	1                               # DW_CHILDREN_yes258	.byte	49                              # DW_AT_abstract_origin259	.byte	19                              # DW_FORM_ref4260	.byte	17                              # DW_AT_low_pc261	.byte	1                               # DW_FORM_addr262	.byte	18                              # DW_AT_high_pc263	.byte	6                               # DW_FORM_data4264	.byte	88                              # DW_AT_call_file265	.byte	11                              # DW_FORM_data1266	.byte	89                              # DW_AT_call_line267	.byte	11                              # DW_FORM_data1268	.byte	87                              # DW_AT_call_column269	.byte	11                              # DW_FORM_data1270	.byte	0                               # EOM(1)271	.byte	0                               # EOM(2)272	.byte	9                               # Abbreviation Code273	.byte	5                               # DW_TAG_formal_parameter274	.byte	0                               # DW_CHILDREN_no275	.byte	2                               # DW_AT_location276	.byte	24                              # DW_FORM_exprloc277	.byte	49                              # DW_AT_abstract_origin278	.byte	19                              # DW_FORM_ref4279	.byte	0                               # EOM(1)280	.byte	0                               # EOM(2)281	.byte	10                              # Abbreviation Code282	.ascii	"\211\202\001"                  # DW_TAG_GNU_call_site283	.byte	0                               # DW_CHILDREN_no284	.byte	49                              # DW_AT_abstract_origin285	.byte	19                              # DW_FORM_ref4286	.byte	17                              # DW_AT_low_pc287	.byte	1                               # DW_FORM_addr288	.byte	0                               # EOM(1)289	.byte	0                               # EOM(2)290	.byte	11                              # Abbreviation Code291	.byte	46                              # DW_TAG_subprogram292	.byte	0                               # DW_CHILDREN_no293	.byte	110                             # DW_AT_linkage_name294	.byte	14                              # DW_FORM_strp295	.byte	3                               # DW_AT_name296	.byte	14                              # DW_FORM_strp297	.byte	58                              # DW_AT_decl_file298	.byte	11                              # DW_FORM_data1299	.byte	59                              # DW_AT_decl_line300	.byte	11                              # DW_FORM_data1301	.byte	60                              # DW_AT_declaration302	.byte	25                              # DW_FORM_flag_present303	.byte	63                              # DW_AT_external304	.byte	25                              # DW_FORM_flag_present305	.byte	0                               # EOM(1)306	.byte	0                               # EOM(2)307	.byte	12                              # Abbreviation Code308	.byte	15                              # DW_TAG_pointer_type309	.byte	0                               # DW_CHILDREN_no310	.byte	73                              # DW_AT_type311	.byte	19                              # DW_FORM_ref4312	.byte	0                               # EOM(1)313	.byte	0                               # EOM(2)314	.byte	0                               # EOM(3)315	.section	.debug_info,"",@progbits316.Lcu_begin0:317	.long	.Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit318.Ldebug_info_start0:319	.short	4                               # DWARF version number320	.long	.debug_abbrev                   # Offset Into Abbrev. Section321	.byte	8                               # Address Size (in bytes)322	.byte	1                               # Abbrev [1] 0xb:0xcf DW_TAG_compile_unit323	.long	.Linfo_string0                  # DW_AT_producer324	.short	33                              # DW_AT_language325	.long	.Linfo_string1                  # DW_AT_name326	.long	.Lline_table_start0             # DW_AT_stmt_list327	.long	.Linfo_string2                  # DW_AT_comp_dir328	.quad	.Lfunc_begin0                   # DW_AT_low_pc329	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc330	.byte	2                               # Abbrev [2] 0x2a:0x1c DW_TAG_subprogram331	.long	.Linfo_string3                  # DW_AT_linkage_name332	.long	.Linfo_string4                  # DW_AT_name333	.byte	1                               # DW_AT_decl_file334	.byte	1                               # DW_AT_decl_line335	.long	70                              # DW_AT_type336	.byte	1                               # DW_AT_inline337	.byte	3                               # Abbrev [3] 0x3a:0xb DW_TAG_formal_parameter338	.long	.Linfo_string6                  # DW_AT_name339	.byte	1                               # DW_AT_decl_file340	.byte	1                               # DW_AT_decl_line341	.long	70                              # DW_AT_type342	.byte	0                               # End Of Children Mark343	.byte	4                               # Abbrev [4] 0x46:0x7 DW_TAG_base_type344	.long	.Linfo_string5                  # DW_AT_name345	.byte	5                               # DW_AT_encoding346	.byte	4                               # DW_AT_byte_size347	.byte	5                               # Abbrev [5] 0x4d:0x70 DW_TAG_subprogram348	.quad	.Lfunc_begin0                   # DW_AT_low_pc349	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc350	.byte	1                               # DW_AT_frame_base351	.byte	87352                                        # DW_AT_GNU_all_call_sites353	.long	.Linfo_string9                  # DW_AT_name354	.byte	1                               # DW_AT_decl_file355	.byte	5                               # DW_AT_decl_line356	.long	70                              # DW_AT_type357                                        # DW_AT_external358	.byte	6                               # Abbrev [6] 0x66:0xf DW_TAG_formal_parameter359	.long	.Ldebug_loc0                    # DW_AT_location360	.long	.Linfo_string10                 # DW_AT_name361	.byte	1                               # DW_AT_decl_file362	.byte	5                               # DW_AT_decl_line363	.long	70                              # DW_AT_type364	.byte	6                               # Abbrev [6] 0x75:0xf DW_TAG_formal_parameter365	.long	.Ldebug_loc1                    # DW_AT_location366	.long	.Linfo_string11                 # DW_AT_name367	.byte	1                               # DW_AT_decl_file368	.byte	5                               # DW_AT_decl_line369	.long	200                             # DW_AT_type370	.byte	7                               # Abbrev [7] 0x84:0xf DW_TAG_variable371	.long	.Ldebug_loc2                    # DW_AT_location372	.long	.Linfo_string13                 # DW_AT_name373	.byte	1                               # DW_AT_decl_file374	.byte	8                               # DW_AT_decl_line375	.long	70                              # DW_AT_type376	.byte	8                               # Abbrev [8] 0x93:0x1c DW_TAG_inlined_subroutine377	.long	42                              # DW_AT_abstract_origin378	.quad	.Ltmp2                          # DW_AT_low_pc379	.long	0			                    # DW_AT_high_pc Manually modified380	.byte	1                               # DW_AT_call_file381	.byte	9                               # DW_AT_call_line382	.byte	32                              # DW_AT_call_column383	.byte	9                               # Abbrev [9] 0xa7:0x7 DW_TAG_formal_parameter384	.byte	1                               # DW_AT_location385	.byte	83386	.long	58                              # DW_AT_abstract_origin387	.byte	0                               # End Of Children Mark388	.byte	10                              # Abbrev [10] 0xaf:0xd DW_TAG_GNU_call_site389	.long	189                             # DW_AT_abstract_origin390	.quad	.Ltmp2                          # DW_AT_low_pc391	.byte	0                               # End Of Children Mark392	.byte	11                              # Abbrev [11] 0xbd:0xb DW_TAG_subprogram393	.long	.Linfo_string7                  # DW_AT_linkage_name394	.long	.Linfo_string8                  # DW_AT_name395	.byte	1                               # DW_AT_decl_file396	.byte	4                               # DW_AT_decl_line397                                        # DW_AT_declaration398                                        # DW_AT_external399	.byte	12                              # Abbrev [12] 0xc8:0x5 DW_TAG_pointer_type400	.long	205                             # DW_AT_type401	.byte	12                              # Abbrev [12] 0xcd:0x5 DW_TAG_pointer_type402	.long	210                             # DW_AT_type403	.byte	4                               # Abbrev [4] 0xd2:0x7 DW_TAG_base_type404	.long	.Linfo_string12                 # DW_AT_name405	.byte	6                               # DW_AT_encoding406	.byte	1                               # DW_AT_byte_size407	.byte	0                               # End Of Children Mark408.Ldebug_info_end0:409	.section	.debug_str,"MS",@progbits,1410.Linfo_string0:411	.asciz	"clang version 16.0.0" # string offset=0412.Linfo_string1:413	.asciz	"main.cpp"                      # string offset=105414.Linfo_string2:415	.asciz	"." # string offset=114416.Linfo_string3:417	.asciz	"_ZL6helperi"                   # string offset=152418.Linfo_string4:419	.asciz	"helper"                        # string offset=164420.Linfo_string5:421	.asciz	"int"                           # string offset=171422.Linfo_string6:423	.asciz	"i"                             # string offset=175424.Linfo_string7:425	.asciz	"_Z13may_not_existv"            # string offset=177426.Linfo_string8:427	.asciz	"may_not_exist"                 # string offset=196428.Linfo_string9:429	.asciz	"main"                          # string offset=210430.Linfo_string10:431	.asciz	"argc"                          # string offset=215432.Linfo_string11:433	.asciz	"argv"                          # string offset=220434.Linfo_string12:435	.asciz	"char"                          # string offset=225436.Linfo_string13:437	.asciz	"j"                             # string offset=230438	.weak	_Z13may_not_existv439	.ident	"clang version 16.0.0"440	.section	".note.GNU-stack","",@progbits441	.addrsig442	.addrsig_sym _Z13may_not_existv443	.section	.debug_line,"",@progbits444.Lline_table_start0:445