brintos

brintos / llvm-project-archived public Read only

0
0
Text · 10.4 KiB · 0825c5d Raw
227 lines · plain
1; The assembly below corresponds to this program:2; __attribute__((nodebug))3; int foo() {4;   return 10;5; }6; int main(int argc, char **argv) {7;   foo();8;   return 0;9; }10;11; The assembly was edited in two places (search for "EDIT"):12; 1. A "orr    x29, x29, #0x1000000000000000" instruction was added in foo. This13; effectively changes the CFA value of the frame above foo (i.e. main).14; 2. In main, the DWARF location of `argv` was changed to DW_AT_call_frame_cfa.15;16; This allows us to stop in foo, go to frame 1 (main) and do `v &argv`,17; obtaining the result of evaluating DW_AT_call_frame_cfa.18 19	.section	__TEXT,__text,regular,pure_instructions20	.globl	_foo                            ; -- Begin function foo21	.p2align	222_foo:                                   ; @foo23Lfunc_begin0:24	.cfi_startproc25  orr    x29, x29, #0x1000000000000000    ; EDIT: Set top byte of fp.26	stp	x29, x30, [sp, #-16]!           ; 16-byte Folded Spill27	mov	x29, sp28	.cfi_def_cfa w29, 1629	.cfi_offset w30, -830	.cfi_offset w29, -1631	mov	w0, #10                         ; =0xa32	ldp	x29, x30, [sp], #16             ; 16-byte Folded Reload33	ret34Lfunc_end0:35	.cfi_endproc36                                        ; -- End function37	.globl	_main                           ; -- Begin function main38	.p2align	239_main:                                  ; @main40Lfunc_begin1:41	.file	1 "/test" "test.c"42	.loc	1 6 0                           ; test.c:6:043	.cfi_startproc44	sub	sp, sp, #4845	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill46	add	x29, sp, #3247	.cfi_def_cfa w29, 1648	.cfi_offset w30, -849	.cfi_offset w29, -1650	mov	w8, #0                          ; =0x051	str	w8, [sp, #12]                   ; 4-byte Folded Spill52	stur	wzr, [x29, #-4]53	stur	w0, [x29, #-8]54	str	x1, [sp, #16]55Ltmp0:56	bl	_foo57	ldr	w0, [sp, #12]                   ; 4-byte Folded Reload58	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload59	add	sp, sp, #4860	ret61Ltmp1:62Lfunc_end1:63	.cfi_endproc64                                        ; -- End function65	.section	__DWARF,__debug_abbrev,regular,debug66Lsection_abbrev:67	.byte	1                               ; Abbreviation Code68	.byte	17                              ; DW_TAG_compile_unit69	.byte	1                               ; DW_CHILDREN_yes70	.byte	37                              ; DW_AT_producer71	.byte	14                              ; DW_FORM_strp72	.byte	19                              ; DW_AT_language73	.byte	5                               ; DW_FORM_data274	.byte	3                               ; DW_AT_name75	.byte	14                              ; DW_FORM_strp76	.ascii	"\202|"                       ; DW_AT_LLVM_sysroot77	.byte	14                              ; DW_FORM_strp78	.ascii	"\357\177"                    ; DW_AT_APPLE_sdk79	.byte	14                              ; DW_FORM_strp80	.byte	16                              ; DW_AT_stmt_list81	.byte	23                              ; DW_FORM_sec_offset82	.byte	27                              ; DW_AT_comp_dir83	.byte	14                              ; DW_FORM_strp84	.byte	17                              ; DW_AT_low_pc85	.byte	1                               ; DW_FORM_addr86	.byte	18                              ; DW_AT_high_pc87	.byte	6                               ; DW_FORM_data488	.byte	0                               ; EOM(1)89	.byte	0                               ; EOM(2)90	.byte	2                               ; Abbreviation Code91	.byte	46                              ; DW_TAG_subprogram92	.byte	1                               ; DW_CHILDREN_yes93	.byte	17                              ; DW_AT_low_pc94	.byte	1                               ; DW_FORM_addr95	.byte	18                              ; DW_AT_high_pc96	.byte	6                               ; DW_FORM_data497	.byte	64                              ; DW_AT_frame_base98	.byte	24                              ; DW_FORM_exprloc99	.byte	3                               ; DW_AT_name100	.byte	14                              ; DW_FORM_strp101	.byte	58                              ; DW_AT_decl_file102	.byte	11                              ; DW_FORM_data1103	.byte	59                              ; DW_AT_decl_line104	.byte	11                              ; DW_FORM_data1105	.byte	39                              ; DW_AT_prototyped106	.byte	25                              ; DW_FORM_flag_present107	.byte	73                              ; DW_AT_type108	.byte	19                              ; DW_FORM_ref4109	.byte	63                              ; DW_AT_external110	.byte	25                              ; DW_FORM_flag_present111	.byte	0                               ; EOM(1)112	.byte	0                               ; EOM(2)113	.byte	3                               ; Abbreviation Code114	.byte	5                               ; DW_TAG_formal_parameter115	.byte	0                               ; DW_CHILDREN_no116	.byte	2                               ; DW_AT_location117	.byte	24                              ; DW_FORM_exprloc118	.byte	3                               ; DW_AT_name119	.byte	14                              ; DW_FORM_strp120	.byte	58                              ; DW_AT_decl_file121	.byte	11                              ; DW_FORM_data1122	.byte	59                              ; DW_AT_decl_line123	.byte	11                              ; DW_FORM_data1124	.byte	73                              ; DW_AT_type125	.byte	19                              ; DW_FORM_ref4126	.byte	0                               ; EOM(1)127	.byte	0                               ; EOM(2)128	.byte	4                               ; Abbreviation Code129	.byte	36                              ; DW_TAG_base_type130	.byte	0                               ; DW_CHILDREN_no131	.byte	3                               ; DW_AT_name132	.byte	14                              ; DW_FORM_strp133	.byte	62                              ; DW_AT_encoding134	.byte	11                              ; DW_FORM_data1135	.byte	11                              ; DW_AT_byte_size136	.byte	11                              ; DW_FORM_data1137	.byte	0                               ; EOM(1)138	.byte	0                               ; EOM(2)139	.byte	5                               ; Abbreviation Code140	.byte	15                              ; DW_TAG_pointer_type141	.byte	0                               ; DW_CHILDREN_no142	.byte	73                              ; DW_AT_type143	.byte	19                              ; DW_FORM_ref4144	.byte	0                               ; EOM(1)145	.byte	0                               ; EOM(2)146	.byte	0                               ; EOM(3)147	.section	__DWARF,__debug_info,regular,debug148Lsection_info:149Lcu_begin0:150.set Lset0, Ldebug_info_end0-Ldebug_info_start0 ; Length of Unit151	.long	Lset0152Ldebug_info_start0:153	.short	4                               ; DWARF version number154.set Lset1, Lsection_abbrev-Lsection_abbrev ; Offset Into Abbrev. Section155	.long	Lset1156	.byte	8                               ; Address Size (in bytes)157	.byte	1                               ; Abbrev [1] 0xb:0x76 DW_TAG_compile_unit158	.long	0                               ; DW_AT_producer159	.short	12                              ; DW_AT_language160	.long	47                              ; DW_AT_name161	.long	54                              ; DW_AT_LLVM_sysroot162	.long	165                             ; DW_AT_APPLE_sdk163.set Lset2, Lline_table_start0-Lsection_line ; DW_AT_stmt_list164	.long	Lset2165	.long	180                             ; DW_AT_comp_dir166	.quad	Lfunc_begin1                    ; DW_AT_low_pc167.set Lset3, Lfunc_end1-Lfunc_begin1     ; DW_AT_high_pc168	.long	Lset3169	.byte	2                               ; Abbrev [2] 0x32:0x36 DW_TAG_subprogram170	.quad	Lfunc_begin1                    ; DW_AT_low_pc171.set Lset4, Lfunc_end1-Lfunc_begin1     ; DW_AT_high_pc172	.long	Lset4173	.byte	1                               ; DW_AT_frame_base174	.byte	109175	.long	247                             ; DW_AT_name176	.byte	1                               ; DW_AT_decl_file177	.byte	6                               ; DW_AT_decl_line178                                        ; DW_AT_prototyped179	.long	107                             ; DW_AT_type180                                        ; DW_AT_external181	.byte	3                               ; Abbrev [3] 0x4b:0xe DW_TAG_formal_parameter182	.byte	2                               ; DW_AT_location183	.byte	145184	.byte	120185	.long	256                             ; DW_AT_name186	.byte	1                               ; DW_AT_decl_file187	.byte	6                               ; DW_AT_decl_line188	.long	103                             ; DW_AT_type189	.byte	3                               ; Abbrev [3] 0x59:0xe DW_TAG_formal_parameter190	.byte	1                               ; DW_AT_location191	.byte	0x9c                            ; EDIT: DW_AT_call_frame_cfa192	.long	261                             ; DW_AT_name193	.byte	1                               ; DW_AT_decl_file194	.byte	6                               ; DW_AT_decl_line195	.long	110                             ; DW_AT_type196	.byte	0                               ; End Of Children Mark197	.byte	4                               ; Abbrev [4] 0x68:0x7 DW_TAG_base_type198	.long	252                             ; DW_AT_name199	.byte	5                               ; DW_AT_encoding200	.byte	4                               ; DW_AT_byte_size201	.byte	5                               ; Abbrev [5] 0x6f:0x5 DW_TAG_pointer_type202	.long	115                             ; DW_AT_type203	.byte	5                               ; Abbrev [5] 0x74:0x5 DW_TAG_pointer_type204	.long	120                             ; DW_AT_type205	.byte	4                               ; Abbrev [4] 0x79:0x7 DW_TAG_base_type206	.long	266                             ; DW_AT_name207	.byte	6                               ; DW_AT_encoding208	.byte	1                               ; DW_AT_byte_size209	.byte	0                               ; End Of Children Mark210Ldebug_info_end0:211	.section	__DWARF,__debug_str,regular,debug212Linfo_string:213	.asciz	"Apple clang                                   " ; string offset=0214	.asciz	"test.c"                        ; string offset=47215	.asciz	"/Applications/Xcode..........................................................................................." ; string offset=54216	.asciz	".............."                ; string offset=165217	.asciz	"......................................................../llvm_src1" ; string offset=180218	.asciz	"main"                          ; string offset=247219	.asciz	"int"                           ; string offset=252220	.asciz	"argc"                          ; string offset=256221	.asciz	"argv"                          ; string offset=261222	.asciz	"char"                          ; string offset=266223.subsections_via_symbols224	.section	__DWARF,__debug_line,regular,debug225Lsection_line:226Lline_table_start0:227