brintos

brintos / llvm-project-archived public Read only

0
0
Text · 18.4 KiB · 6cf4203 Raw
394 lines · plain
1## Use llvm-dwarfdump to check the integrity of the inlined function "bar"2## DWARF range after llvm-bolt removes a 6-byte nop instruction.3##4## If the range is not properly updated, it will exceed the range of the5## containing function causing llvm-dwarfdump to issue an error.6 7# CHECK-NOT: error: DIE address ranges are not contained in its parent's ranges8 9# REQUIRES: system-linux10 11# RUN: %clang++ %cflags -gdwarf-4 %s -o %t.exe -Wl,-q12# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections13# RUN: llvm-dwarfdump --verify %t.bolt | FileCheck %s14 15 16# Test compiled with "-O2 -g" from:17#18# unsigned long bar(unsigned long i) {19#   asm volatile("nopw    %cs:(%rax,%rax)");20#   return ++i;21# }22#23# int main(int argc, char **argv) {24#   bar(argc);25#   return 0;26# }27 28	.text29	.file	"dwarf-inline-range.cpp"30	.globl	_Z3barm                         # -- Begin function _Z3barm31	.p2align	4, 0x9032	.type	_Z3barm,@function33_Z3barm:                                # @_Z3barm34.Lfunc_begin0:35	.file	1 "." "dwarf-inline-range.cpp"36	.loc	1 1 0                           # dwarf-inline-range.cpp:1:037	.cfi_startproc38# %bb.0:39	#DEBUG_VALUE: bar:i <- $rdi40	.loc	1 2 3 prologue_end              # dwarf-inline-range.cpp:2:341	#APP42	nopw	%cs:(%rax,%rax)43	#NO_APP44	.loc	1 3 10                          # dwarf-inline-range.cpp:3:1045	leaq	1(%rdi), %rax46.Ltmp0:47	#DEBUG_VALUE: bar:i <- $rax48	.loc	1 3 3 is_stmt 0                 # dwarf-inline-range.cpp:3:349	retq50.Ltmp1:51.Lfunc_end0:52	.size	_Z3barm, .Lfunc_end0-_Z3barm53	.cfi_endproc54                                        # -- End function55	.globl	main                            # -- Begin function main56	.p2align	4, 0x9057	.type	main,@function58main:                                   # @main59.Lfunc_begin1:60	.loc	1 6 0 is_stmt 1                 # dwarf-inline-range.cpp:6:061	.cfi_startproc62# %bb.0:63	#DEBUG_VALUE: main:argc <- $edi64	#DEBUG_VALUE: main:argv <- $rsi65	#DEBUG_VALUE: bar:i <- [DW_OP_LLVM_convert 32 5, DW_OP_LLVM_convert 64 5, DW_OP_stack_value] $edi66	.loc	1 2 3 prologue_end              # dwarf-inline-range.cpp:2:367	#APP68	nopw	%cs:(%rax,%rax)69	#NO_APP70.Ltmp2:71	#DEBUG_VALUE: bar:i <- [DW_OP_LLVM_convert 32 5, DW_OP_LLVM_convert 64 5, DW_OP_plus_uconst 1, DW_OP_stack_value] undef72	.loc	1 8 3                           # dwarf-inline-range.cpp:8:373	xorl	%eax, %eax74	retq75.Ltmp3:76.Lfunc_end1:77	.size	main, .Lfunc_end1-main78	.cfi_endproc79                                        # -- End function80	.section	.debug_loc,"",@progbits81.Ldebug_loc0:82	.quad	.Lfunc_begin0-.Lfunc_begin083	.quad	.Ltmp0-.Lfunc_begin084	.short	1                               # Loc expr size85	.byte	85                              # DW_OP_reg586	.quad	.Ltmp0-.Lfunc_begin087	.quad	.Lfunc_end0-.Lfunc_begin088	.short	1                               # Loc expr size89	.byte	80                              # DW_OP_reg090	.quad	091	.quad	092.Ldebug_loc1:93	.quad	.Lfunc_begin1-.Lfunc_begin094	.quad	.Ltmp2-.Lfunc_begin095	.short	21                              # Loc expr size96	.byte	117                             # DW_OP_breg597	.byte	0                               # 098	.byte	16                              # DW_OP_constu99	.byte	255                             # 4294967295100	.byte	255                             # 101	.byte	255                             # 102	.byte	255                             # 103	.byte	15                              # 104	.byte	26                              # DW_OP_and105	.byte	18                              # DW_OP_dup106	.byte	16                              # DW_OP_constu107	.byte	31                              # 31108	.byte	37                              # DW_OP_shr109	.byte	48                              # DW_OP_lit0110	.byte	32                              # DW_OP_not111	.byte	30                              # DW_OP_mul112	.byte	16                              # DW_OP_constu113	.byte	32                              # 32114	.byte	36                              # DW_OP_shl115	.byte	33                              # DW_OP_or116	.byte	159                             # DW_OP_stack_value117	.quad	0118	.quad	0119	.section	.debug_abbrev,"",@progbits120	.byte	1                               # Abbreviation Code121	.byte	17                              # DW_TAG_compile_unit122	.byte	1                               # DW_CHILDREN_yes123	.byte	37                              # DW_AT_producer124	.byte	14                              # DW_FORM_strp125	.byte	19                              # DW_AT_language126	.byte	5                               # DW_FORM_data2127	.byte	3                               # DW_AT_name128	.byte	14                              # DW_FORM_strp129	.byte	16                              # DW_AT_stmt_list130	.byte	23                              # DW_FORM_sec_offset131	.byte	27                              # DW_AT_comp_dir132	.byte	14                              # DW_FORM_strp133	.byte	17                              # DW_AT_low_pc134	.byte	1                               # DW_FORM_addr135	.byte	18                              # DW_AT_high_pc136	.byte	6                               # DW_FORM_data4137	.byte	0                               # EOM(1)138	.byte	0                               # EOM(2)139	.byte	2                               # Abbreviation Code140	.byte	46                              # DW_TAG_subprogram141	.byte	1                               # DW_CHILDREN_yes142	.byte	17                              # DW_AT_low_pc143	.byte	1                               # DW_FORM_addr144	.byte	18                              # DW_AT_high_pc145	.byte	6                               # DW_FORM_data4146	.byte	64                              # DW_AT_frame_base147	.byte	24                              # DW_FORM_exprloc148	.ascii	"\227B"                         # DW_AT_GNU_all_call_sites149	.byte	25                              # DW_FORM_flag_present150	.byte	49                              # DW_AT_abstract_origin151	.byte	19                              # DW_FORM_ref4152	.byte	0                               # EOM(1)153	.byte	0                               # EOM(2)154	.byte	3                               # Abbreviation Code155	.byte	5                               # DW_TAG_formal_parameter156	.byte	0                               # DW_CHILDREN_no157	.byte	2                               # DW_AT_location158	.byte	23                              # DW_FORM_sec_offset159	.byte	49                              # DW_AT_abstract_origin160	.byte	19                              # DW_FORM_ref4161	.byte	0                               # EOM(1)162	.byte	0                               # EOM(2)163	.byte	4                               # Abbreviation Code164	.byte	46                              # DW_TAG_subprogram165	.byte	1                               # DW_CHILDREN_yes166	.byte	110                             # DW_AT_linkage_name167	.byte	14                              # DW_FORM_strp168	.byte	3                               # DW_AT_name169	.byte	14                              # DW_FORM_strp170	.byte	58                              # DW_AT_decl_file171	.byte	11                              # DW_FORM_data1172	.byte	59                              # DW_AT_decl_line173	.byte	11                              # DW_FORM_data1174	.byte	73                              # DW_AT_type175	.byte	19                              # DW_FORM_ref4176	.byte	63                              # DW_AT_external177	.byte	25                              # DW_FORM_flag_present178	.byte	32                              # DW_AT_inline179	.byte	11                              # DW_FORM_data1180	.byte	0                               # EOM(1)181	.byte	0                               # EOM(2)182	.byte	5                               # Abbreviation Code183	.byte	5                               # DW_TAG_formal_parameter184	.byte	0                               # DW_CHILDREN_no185	.byte	3                               # DW_AT_name186	.byte	14                              # DW_FORM_strp187	.byte	58                              # DW_AT_decl_file188	.byte	11                              # DW_FORM_data1189	.byte	59                              # DW_AT_decl_line190	.byte	11                              # DW_FORM_data1191	.byte	73                              # DW_AT_type192	.byte	19                              # DW_FORM_ref4193	.byte	0                               # EOM(1)194	.byte	0                               # EOM(2)195	.byte	6                               # Abbreviation Code196	.byte	36                              # DW_TAG_base_type197	.byte	0                               # DW_CHILDREN_no198	.byte	3                               # DW_AT_name199	.byte	14                              # DW_FORM_strp200	.byte	62                              # DW_AT_encoding201	.byte	11                              # DW_FORM_data1202	.byte	11                              # DW_AT_byte_size203	.byte	11                              # DW_FORM_data1204	.byte	0                               # EOM(1)205	.byte	0                               # EOM(2)206	.byte	7                               # Abbreviation Code207	.byte	46                              # DW_TAG_subprogram208	.byte	1                               # DW_CHILDREN_yes209	.byte	17                              # DW_AT_low_pc210	.byte	1                               # DW_FORM_addr211	.byte	18                              # DW_AT_high_pc212	.byte	6                               # DW_FORM_data4213	.byte	64                              # DW_AT_frame_base214	.byte	24                              # DW_FORM_exprloc215	.ascii	"\227B"                         # DW_AT_GNU_all_call_sites216	.byte	25                              # DW_FORM_flag_present217	.byte	3                               # DW_AT_name218	.byte	14                              # DW_FORM_strp219	.byte	58                              # DW_AT_decl_file220	.byte	11                              # DW_FORM_data1221	.byte	59                              # DW_AT_decl_line222	.byte	11                              # DW_FORM_data1223	.byte	73                              # DW_AT_type224	.byte	19                              # DW_FORM_ref4225	.byte	63                              # DW_AT_external226	.byte	25                              # DW_FORM_flag_present227	.byte	0                               # EOM(1)228	.byte	0                               # EOM(2)229	.byte	8                               # Abbreviation Code230	.byte	5                               # DW_TAG_formal_parameter231	.byte	0                               # DW_CHILDREN_no232	.byte	2                               # DW_AT_location233	.byte	24                              # DW_FORM_exprloc234	.byte	3                               # DW_AT_name235	.byte	14                              # DW_FORM_strp236	.byte	58                              # DW_AT_decl_file237	.byte	11                              # DW_FORM_data1238	.byte	59                              # DW_AT_decl_line239	.byte	11                              # DW_FORM_data1240	.byte	73                              # DW_AT_type241	.byte	19                              # DW_FORM_ref4242	.byte	0                               # EOM(1)243	.byte	0                               # EOM(2)244	.byte	9                               # Abbreviation Code245	.byte	29                              # DW_TAG_inlined_subroutine246	.byte	1                               # DW_CHILDREN_yes247	.byte	49                              # DW_AT_abstract_origin248	.byte	19                              # DW_FORM_ref4249	.byte	17                              # DW_AT_low_pc250	.byte	1                               # DW_FORM_addr251	.byte	18                              # DW_AT_high_pc252	.byte	6                               # DW_FORM_data4253	.byte	88                              # DW_AT_call_file254	.byte	11                              # DW_FORM_data1255	.byte	89                              # DW_AT_call_line256	.byte	11                              # DW_FORM_data1257	.byte	87                              # DW_AT_call_column258	.byte	11                              # DW_FORM_data1259	.byte	0                               # EOM(1)260	.byte	0                               # EOM(2)261	.byte	10                              # Abbreviation Code262	.byte	15                              # DW_TAG_pointer_type263	.byte	0                               # DW_CHILDREN_no264	.byte	73                              # DW_AT_type265	.byte	19                              # DW_FORM_ref4266	.byte	0                               # EOM(1)267	.byte	0                               # EOM(2)268	.byte	0                               # EOM(3)269	.section	.debug_info,"",@progbits270.Lcu_begin0:271	.long	.Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit272.Ldebug_info_start0:273	.short	4                               # DWARF version number274	.long	.debug_abbrev                   # Offset Into Abbrev. Section275	.byte	8                               # Address Size (in bytes)276	.byte	1                               # Abbrev [1] 0xb:0xca DW_TAG_compile_unit277	.long	.Linfo_string0                  # DW_AT_producer278	.short	33                              # DW_AT_language279	.long	.Linfo_string1                  # DW_AT_name280	.long	.Lline_table_start0             # DW_AT_stmt_list281	.long	.Linfo_string2                  # DW_AT_comp_dir282	.quad	.Lfunc_begin0                   # DW_AT_low_pc283	.long	.Lfunc_end1-.Lfunc_begin0       # DW_AT_high_pc284	.byte	2                               # Abbrev [2] 0x2a:0x1d DW_TAG_subprogram285	.quad	.Lfunc_begin0                   # DW_AT_low_pc286	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc287	.byte	1                               # DW_AT_frame_base288	.byte	87289                                        # DW_AT_GNU_all_call_sites290	.long	71                              # DW_AT_abstract_origin291	.byte	3                               # Abbrev [3] 0x3d:0x9 DW_TAG_formal_parameter292	.long	.Ldebug_loc0                    # DW_AT_location293	.long	87                              # DW_AT_abstract_origin294	.byte	0                               # End Of Children Mark295	.byte	4                               # Abbrev [4] 0x47:0x1c DW_TAG_subprogram296	.long	.Linfo_string3                  # DW_AT_linkage_name297	.long	.Linfo_string4                  # DW_AT_name298	.byte	1                               # DW_AT_decl_file299	.byte	1                               # DW_AT_decl_line300	.long	99                              # DW_AT_type301                                        # DW_AT_external302	.byte	1                               # DW_AT_inline303	.byte	5                               # Abbrev [5] 0x57:0xb DW_TAG_formal_parameter304	.long	.Linfo_string6                  # DW_AT_name305	.byte	1                               # DW_AT_decl_file306	.byte	1                               # DW_AT_decl_line307	.long	99                              # DW_AT_type308	.byte	0                               # End Of Children Mark309	.byte	6                               # Abbrev [6] 0x63:0x7 DW_TAG_base_type310	.long	.Linfo_string5                  # DW_AT_name311	.byte	7                               # DW_AT_encoding312	.byte	8                               # DW_AT_byte_size313	.byte	7                               # Abbrev [7] 0x6a:0x52 DW_TAG_subprogram314	.quad	.Lfunc_begin1                   # DW_AT_low_pc315	.long	.Lfunc_end1-.Lfunc_begin1       # DW_AT_high_pc316	.byte	1                               # DW_AT_frame_base317	.byte	87318                                        # DW_AT_GNU_all_call_sites319	.long	.Linfo_string7                  # DW_AT_name320	.byte	1                               # DW_AT_decl_file321	.byte	6                               # DW_AT_decl_line322	.long	188                             # DW_AT_type323                                        # DW_AT_external324	.byte	8                               # Abbrev [8] 0x83:0xd DW_TAG_formal_parameter325	.byte	1                               # DW_AT_location326	.byte	85327	.long	.Linfo_string9                  # DW_AT_name328	.byte	1                               # DW_AT_decl_file329	.byte	6                               # DW_AT_decl_line330	.long	188                             # DW_AT_type331	.byte	8                               # Abbrev [8] 0x90:0xd DW_TAG_formal_parameter332	.byte	1                               # DW_AT_location333	.byte	84334	.long	.Linfo_string10                 # DW_AT_name335	.byte	1                               # DW_AT_decl_file336	.byte	6                               # DW_AT_decl_line337	.long	195                             # DW_AT_type338	.byte	9                               # Abbrev [9] 0x9d:0x1e DW_TAG_inlined_subroutine339	.long	71                              # DW_AT_abstract_origin340	.quad	.Lfunc_begin1                   # DW_AT_low_pc341	.long	.Ltmp2-.Lfunc_begin1            # DW_AT_high_pc342	.byte	1                               # DW_AT_call_file343	.byte	7                               # DW_AT_call_line344	.byte	3                               # DW_AT_call_column345	.byte	3                               # Abbrev [3] 0xb1:0x9 DW_TAG_formal_parameter346	.long	.Ldebug_loc1                    # DW_AT_location347	.long	87                              # DW_AT_abstract_origin348	.byte	0                               # End Of Children Mark349	.byte	0                               # End Of Children Mark350	.byte	6                               # Abbrev [6] 0xbc:0x7 DW_TAG_base_type351	.long	.Linfo_string8                  # DW_AT_name352	.byte	5                               # DW_AT_encoding353	.byte	4                               # DW_AT_byte_size354	.byte	10                              # Abbrev [10] 0xc3:0x5 DW_TAG_pointer_type355	.long	200                             # DW_AT_type356	.byte	10                              # Abbrev [10] 0xc8:0x5 DW_TAG_pointer_type357	.long	205                             # DW_AT_type358	.byte	6                               # Abbrev [6] 0xcd:0x7 DW_TAG_base_type359	.long	.Linfo_string11                 # DW_AT_name360	.byte	6                               # DW_AT_encoding361	.byte	1                               # DW_AT_byte_size362	.byte	0                               # End Of Children Mark363.Ldebug_info_end0:364	.section	.debug_str,"MS",@progbits,1365.Linfo_string0:366	.asciz	"clang version 15"367.Linfo_string1:368	.asciz	"dwarf-inline-range.cpp"        # string offset=69369.Linfo_string2:370	.asciz	"."           # string offset=92371.Linfo_string3:372	.asciz	"_Z3barm"                       # string offset=112373.Linfo_string4:374	.asciz	"bar"                           # string offset=120375.Linfo_string5:376	.asciz	"unsigned long"                 # string offset=124377.Linfo_string6:378	.asciz	"i"                             # string offset=138379.Linfo_string7:380	.asciz	"main"                          # string offset=140381.Linfo_string8:382	.asciz	"int"                           # string offset=145383.Linfo_string9:384	.asciz	"argc"                          # string offset=149385.Linfo_string10:386	.asciz	"argv"                          # string offset=154387.Linfo_string11:388	.asciz	"char"                          # string offset=159389	.ident	"clang version 15"390	.section	".note.GNU-stack","",@progbits391	.addrsig392	.section	.debug_line,"",@progbits393.Lline_table_start0:394