brintos

brintos / llvm-project-archived public Read only

0
0
Text · 15.1 KiB · 6c3d326 Raw
373 lines · plain
1## Check that the --debug-vars option works for simple register locations, when2## using DWARF4 debug info, with multiple functions in one section.3 4## Generated with this compile command and source code:5## clang --target=arm--none-eabi -march=armv7-a -c debug.c -O1 -gdwarf-3 -S -o -6 7## clang --target=powerpc64-unknown-linux -c debug.c -O1 -S -o -8 9## int foo(int a, int b, int c) {10##   int x = a + b;11##   int y = x + c;12##   return y;13## }14##15## int bar(int a) {16##   a++;17##   return a;18## }19 20# RUN: llvm-mc -triple powerpc64-unknown-linux < %s -filetype=obj | \21# RUN:     llvm-objdump - -d --debug-vars --no-show-raw-insn | \22# RUN:     FileCheck %s23 24# CHECK: Disassembly of section .text:25# CHECK-EMPTY:26# CHECK-NEXT: 0000000000000000 <.text>:27# CHECK-NEXT:                                                                   ┠─ a = S328# CHECK-NEXT:                                                                   ┃ ┠─ b = S429# CHECK-NEXT:                                                                   ┃ ┃ ┠─ c = S530# CHECK-NEXT:                                                                   ┃ ┃ ┃ ┌─ x = S331# CHECK-NEXT:        0:       add 3, 4, 3                                       ┻ ┃ ┃ ╈32# CHECK-NEXT:                                                                   ┌─ y = S333# CHECK-NEXT:        4:       add 3, 3, 5                                       ╈ ┃ ┃ ┻34# CHECK-NEXT:        8:       extsw 3, 3                                        ┻ ┃ ┃35# CHECK-NEXT:        c:       blr                                                 ┃ ┃36# CHECK-NEXT:                 ...37# CHECK-NEXT:                                                                   ┠─ a = S338# CHECK-NEXT:       1c:       addi 3, 3, 1                                      ┃39# CHECK-NEXT:       20:       extsw 3, 3                                        ┻40# CHECK-NEXT:       24:       blr41# CHECK-NEXT:                 ...42 43	.text44	.file	"debug.c"45	.globl	foo                     # -- Begin function foo46	.p2align	247	.type	foo,@function48	.section	.opd,"aw",@progbits49foo:                                    # @foo50	.p2align	351	.quad	.Lfunc_begin052	.quad	.TOC.@tocbase53	.quad	054	.text55.Lfunc_begin0:56	.file	1 "/work" "llvm/src/llvm/test/tools/llvm-objdump/ARM/Inputs/debug.c"57	.loc	1 1 0                   # llvm/src/llvm/test/tools/llvm-objdump/ARM/Inputs/debug.c:1:058	.cfi_sections .debug_frame59	.cfi_startproc60# %bb.0:                                # %entry61	#DEBUG_VALUE: foo:a <- $x362	#DEBUG_VALUE: foo:a <- $r363	#DEBUG_VALUE: foo:b <- $x464	#DEBUG_VALUE: foo:b <- $x465	#DEBUG_VALUE: foo:b <- $r466	#DEBUG_VALUE: foo:c <- $x567	#DEBUG_VALUE: foo:c <- $x568	#DEBUG_VALUE: foo:c <- $r569	.loc	1 2 13 prologue_end     # llvm/src/llvm/test/tools/llvm-objdump/ARM/Inputs/debug.c:2:1370	add 3, 4, 371.Ltmp0:72	#DEBUG_VALUE: foo:x <- $r373	.loc	1 3 13                  # llvm/src/llvm/test/tools/llvm-objdump/ARM/Inputs/debug.c:3:1374	add 3, 3, 575.Ltmp1:76	#DEBUG_VALUE: foo:y <- $r377	.loc	1 4 3                   # llvm/src/llvm/test/tools/llvm-objdump/ARM/Inputs/debug.c:4:378	extsw 3, 379.Ltmp2:80	blr81.Ltmp3:82	.long	083	.quad	084.Lfunc_end0:85	.size	foo, .Lfunc_end0-.Lfunc_begin086	.cfi_endproc87                                        # -- End function88	.globl	bar                     # -- Begin function bar89	.p2align	290	.type	bar,@function91	.section	.opd,"aw",@progbits92bar:                                    # @bar93	.p2align	394	.quad	.Lfunc_begin195	.quad	.TOC.@tocbase96	.quad	097	.text98.Lfunc_begin1:99	.loc	1 7 0                   # llvm/src/llvm/test/tools/llvm-objdump/ARM/Inputs/debug.c:7:0100	.cfi_startproc101# %bb.0:                                # %entry102	#DEBUG_VALUE: bar:a <- $x3103	#DEBUG_VALUE: bar:a <- $r3104	.loc	1 8 4 prologue_end      # llvm/src/llvm/test/tools/llvm-objdump/ARM/Inputs/debug.c:8:4105	addi 3, 3, 1106.Ltmp4:107	#DEBUG_VALUE: bar:a <- $r3108	.loc	1 9 3                   # llvm/src/llvm/test/tools/llvm-objdump/ARM/Inputs/debug.c:9:3109	extsw 3, 3110.Ltmp5:111	blr112.Ltmp6:113	.long	0114	.quad	0115.Lfunc_end1:116	.size	bar, .Lfunc_end1-.Lfunc_begin1117	.cfi_endproc118                                        # -- End function119	.section	.debug_str,"MS",@progbits,1120.Linfo_string0:121	.asciz	"clang version 10.0.0 (git@github.com:llvm/llvm-project.git e73f78acd34360f7450b81167d9dc858ccddc262)" # string offset=0122.Linfo_string1:123	.asciz	"/work/llvm/src/llvm/test/tools/llvm-objdump/ARM/Inputs/debug.c" # string offset=101124.Linfo_string2:125	.asciz	"/work/scratch"         # string offset=164126.Linfo_string3:127	.asciz	"foo"                   # string offset=178128.Linfo_string4:129	.asciz	"int"                   # string offset=182130.Linfo_string5:131	.asciz	"bar"                   # string offset=186132.Linfo_string6:133	.asciz	"a"                     # string offset=190134.Linfo_string7:135	.asciz	"b"                     # string offset=192136.Linfo_string8:137	.asciz	"c"                     # string offset=194138.Linfo_string9:139	.asciz	"x"                     # string offset=196140.Linfo_string10:141	.asciz	"y"                     # string offset=198142	.section	.debug_loc,"",@progbits143.Ldebug_loc0:144	.quad	.Lfunc_begin0-.Lfunc_begin0145	.quad	.Ltmp0-.Lfunc_begin0146	.short	3                       # Loc expr size147	.byte	144                     # super-register DW_OP_regx148	.byte	179                     # 1203149	.byte	9                       #150	.quad	0151	.quad	0152.Ldebug_loc1:153	.quad	.Ltmp0-.Lfunc_begin0154	.quad	.Ltmp1-.Lfunc_begin0155	.short	3                       # Loc expr size156	.byte	144                     # super-register DW_OP_regx157	.byte	179                     # 1203158	.byte	9                       #159	.quad	0160	.quad	0161.Ldebug_loc2:162	.quad	.Ltmp1-.Lfunc_begin0163	.quad	.Ltmp2-.Lfunc_begin0164	.short	3                       # Loc expr size165	.byte	144                     # super-register DW_OP_regx166	.byte	179                     # 1203167	.byte	9                       #168	.quad	0169	.quad	0170.Ldebug_loc3:171	.quad	.Lfunc_begin1-.Lfunc_begin0172	.quad	.Ltmp5-.Lfunc_begin0173	.short	3                       # Loc expr size174	.byte	144                     # super-register DW_OP_regx175	.byte	179                     # 1203176	.byte	9                       #177	.quad	0178	.quad	0179	.section	.debug_abbrev,"",@progbits180	.byte	1                       # Abbreviation Code181	.byte	17                      # DW_TAG_compile_unit182	.byte	1                       # DW_CHILDREN_yes183	.byte	37                      # DW_AT_producer184	.byte	14                      # DW_FORM_strp185	.byte	19                      # DW_AT_language186	.byte	5                       # DW_FORM_data2187	.byte	3                       # DW_AT_name188	.byte	14                      # DW_FORM_strp189	.byte	16                      # DW_AT_stmt_list190	.byte	23                      # DW_FORM_sec_offset191	.byte	27                      # DW_AT_comp_dir192	.byte	14                      # DW_FORM_strp193	.byte	17                      # DW_AT_low_pc194	.byte	1                       # DW_FORM_addr195	.byte	18                      # DW_AT_high_pc196	.byte	6                       # DW_FORM_data4197	.byte	0                       # EOM(1)198	.byte	0                       # EOM(2)199	.byte	2                       # Abbreviation Code200	.byte	46                      # DW_TAG_subprogram201	.byte	1                       # DW_CHILDREN_yes202	.byte	17                      # DW_AT_low_pc203	.byte	1                       # DW_FORM_addr204	.byte	18                      # DW_AT_high_pc205	.byte	6                       # DW_FORM_data4206	.byte	64                      # DW_AT_frame_base207	.byte	24                      # DW_FORM_exprloc208	.ascii	"\227B"                 # DW_AT_GNU_all_call_sites209	.byte	25                      # DW_FORM_flag_present210	.byte	3                       # DW_AT_name211	.byte	14                      # DW_FORM_strp212	.byte	58                      # DW_AT_decl_file213	.byte	11                      # DW_FORM_data1214	.byte	59                      # DW_AT_decl_line215	.byte	11                      # DW_FORM_data1216	.byte	39                      # DW_AT_prototyped217	.byte	25                      # DW_FORM_flag_present218	.byte	73                      # DW_AT_type219	.byte	19                      # DW_FORM_ref4220	.byte	63                      # DW_AT_external221	.byte	25                      # DW_FORM_flag_present222	.byte	0                       # EOM(1)223	.byte	0                       # EOM(2)224	.byte	3                       # Abbreviation Code225	.byte	5                       # DW_TAG_formal_parameter226	.byte	0                       # DW_CHILDREN_no227	.byte	2                       # DW_AT_location228	.byte	23                      # DW_FORM_sec_offset229	.byte	3                       # DW_AT_name230	.byte	14                      # DW_FORM_strp231	.byte	58                      # DW_AT_decl_file232	.byte	11                      # DW_FORM_data1233	.byte	59                      # DW_AT_decl_line234	.byte	11                      # DW_FORM_data1235	.byte	73                      # DW_AT_type236	.byte	19                      # DW_FORM_ref4237	.byte	0                       # EOM(1)238	.byte	0                       # EOM(2)239	.byte	4                       # Abbreviation Code240	.byte	5                       # DW_TAG_formal_parameter241	.byte	0                       # DW_CHILDREN_no242	.byte	2                       # DW_AT_location243	.byte	24                      # DW_FORM_exprloc244	.byte	3                       # DW_AT_name245	.byte	14                      # DW_FORM_strp246	.byte	58                      # DW_AT_decl_file247	.byte	11                      # DW_FORM_data1248	.byte	59                      # DW_AT_decl_line249	.byte	11                      # DW_FORM_data1250	.byte	73                      # DW_AT_type251	.byte	19                      # DW_FORM_ref4252	.byte	0                       # EOM(1)253	.byte	0                       # EOM(2)254	.byte	5                       # Abbreviation Code255	.byte	52                      # DW_TAG_variable256	.byte	0                       # DW_CHILDREN_no257	.byte	2                       # DW_AT_location258	.byte	23                      # DW_FORM_sec_offset259	.byte	3                       # DW_AT_name260	.byte	14                      # DW_FORM_strp261	.byte	58                      # DW_AT_decl_file262	.byte	11                      # DW_FORM_data1263	.byte	59                      # DW_AT_decl_line264	.byte	11                      # DW_FORM_data1265	.byte	73                      # DW_AT_type266	.byte	19                      # DW_FORM_ref4267	.byte	0                       # EOM(1)268	.byte	0                       # EOM(2)269	.byte	6                       # Abbreviation Code270	.byte	36                      # DW_TAG_base_type271	.byte	0                       # DW_CHILDREN_no272	.byte	3                       # DW_AT_name273	.byte	14                      # DW_FORM_strp274	.byte	62                      # DW_AT_encoding275	.byte	11                      # DW_FORM_data1276	.byte	11                      # DW_AT_byte_size277	.byte	11                      # DW_FORM_data1278	.byte	0                       # EOM(1)279	.byte	0                       # EOM(2)280	.byte	0                       # EOM(3)281	.section	.debug_info,"",@progbits282.Lcu_begin0:283	.long	.Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit284.Ldebug_info_start0:285	.short	4                       # DWARF version number286	.long	.debug_abbrev           # Offset Into Abbrev. Section287	.byte	8                       # Address Size (in bytes)288	.byte	1                       # Abbrev [1] 0xb:0xb5 DW_TAG_compile_unit289	.long	.Linfo_string0          # DW_AT_producer290	.short	12                      # DW_AT_language291	.long	.Linfo_string1          # DW_AT_name292	.long	.Lline_table_start0     # DW_AT_stmt_list293	.long	.Linfo_string2          # DW_AT_comp_dir294	.quad	.Lfunc_begin0           # DW_AT_low_pc295	.long	.Lfunc_end1-.Lfunc_begin0 # DW_AT_high_pc296	.byte	2                       # Abbrev [2] 0x2a:0x65 DW_TAG_subprogram297	.quad	.Lfunc_begin0           # DW_AT_low_pc298	.long	.Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc299	.byte	1                       # DW_AT_frame_base300	.byte	81301                                        # DW_AT_GNU_all_call_sites302	.long	.Linfo_string3          # DW_AT_name303	.byte	1                       # DW_AT_decl_file304	.byte	1                       # DW_AT_decl_line305                                        # DW_AT_prototyped306	.long	184                     # DW_AT_type307                                        # DW_AT_external308	.byte	3                       # Abbrev [3] 0x43:0xf DW_TAG_formal_parameter309	.long	.Ldebug_loc0            # DW_AT_location310	.long	.Linfo_string6          # DW_AT_name311	.byte	1                       # DW_AT_decl_file312	.byte	1                       # DW_AT_decl_line313	.long	184                     # DW_AT_type314	.byte	4                       # Abbrev [4] 0x52:0xf DW_TAG_formal_parameter315	.byte	3                       # DW_AT_location316	.byte	144317	.ascii	"\264\t"318	.long	.Linfo_string7          # DW_AT_name319	.byte	1                       # DW_AT_decl_file320	.byte	1                       # DW_AT_decl_line321	.long	184                     # DW_AT_type322	.byte	4                       # Abbrev [4] 0x61:0xf DW_TAG_formal_parameter323	.byte	3                       # DW_AT_location324	.byte	144325	.ascii	"\265\t"326	.long	.Linfo_string8          # DW_AT_name327	.byte	1                       # DW_AT_decl_file328	.byte	1                       # DW_AT_decl_line329	.long	184                     # DW_AT_type330	.byte	5                       # Abbrev [5] 0x70:0xf DW_TAG_variable331	.long	.Ldebug_loc1            # DW_AT_location332	.long	.Linfo_string9          # DW_AT_name333	.byte	1                       # DW_AT_decl_file334	.byte	2                       # DW_AT_decl_line335	.long	184                     # DW_AT_type336	.byte	5                       # Abbrev [5] 0x7f:0xf DW_TAG_variable337	.long	.Ldebug_loc2            # DW_AT_location338	.long	.Linfo_string10         # DW_AT_name339	.byte	1                       # DW_AT_decl_file340	.byte	3                       # DW_AT_decl_line341	.long	184                     # DW_AT_type342	.byte	0                       # End Of Children Mark343	.byte	2                       # Abbrev [2] 0x8f:0x29 DW_TAG_subprogram344	.quad	.Lfunc_begin1           # DW_AT_low_pc345	.long	.Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc346	.byte	1                       # DW_AT_frame_base347	.byte	81348                                        # DW_AT_GNU_all_call_sites349	.long	.Linfo_string5          # DW_AT_name350	.byte	1                       # DW_AT_decl_file351	.byte	7                       # DW_AT_decl_line352                                        # DW_AT_prototyped353	.long	184                     # DW_AT_type354                                        # DW_AT_external355	.byte	3                       # Abbrev [3] 0xa8:0xf DW_TAG_formal_parameter356	.long	.Ldebug_loc3            # DW_AT_location357	.long	.Linfo_string6          # DW_AT_name358	.byte	1                       # DW_AT_decl_file359	.byte	7                       # DW_AT_decl_line360	.long	184                     # DW_AT_type361	.byte	0                       # End Of Children Mark362	.byte	6                       # Abbrev [6] 0xb8:0x7 DW_TAG_base_type363	.long	.Linfo_string4          # DW_AT_name364	.byte	5                       # DW_AT_encoding365	.byte	4                       # DW_AT_byte_size366	.byte	0                       # End Of Children Mark367.Ldebug_info_end0:368	.ident	"clang version 10.0.0 (git@github.com:llvm/llvm-project.git e73f78acd34360f7450b81167d9dc858ccddc262)"369	.section	".note.GNU-stack","",@progbits370	.addrsig371	.section	.debug_line,"",@progbits372.Lline_table_start0:373