blob: 0825c5ddd08b5d47ca720468eade922ee1ea77bf [file] [log] [blame]
; The assembly below corresponds to this program:
; __attribute__((nodebug))
; int foo() {
; return 10;
; }
; int main(int argc, char **argv) {
; foo();
; return 0;
; }
;
; The assembly was edited in two places (search for "EDIT"):
; 1. A "orr x29, x29, #0x1000000000000000" instruction was added in foo. This
; effectively changes the CFA value of the frame above foo (i.e. main).
; 2. In main, the DWARF location of `argv` was changed to DW_AT_call_frame_cfa.
;
; This allows us to stop in foo, go to frame 1 (main) and do `v &argv`,
; obtaining the result of evaluating DW_AT_call_frame_cfa.
.section __TEXT,__text,regular,pure_instructions
.globl _foo ; -- Begin function foo
.p2align 2
_foo: ; @foo
Lfunc_begin0:
.cfi_startproc
orr x29, x29, #0x1000000000000000 ; EDIT: Set top byte of fp.
stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
mov x29, sp
.cfi_def_cfa w29, 16
.cfi_offset w30, -8
.cfi_offset w29, -16
mov w0, #10 ; =0xa
ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
ret
Lfunc_end0:
.cfi_endproc
; -- End function
.globl _main ; -- Begin function main
.p2align 2
_main: ; @main
Lfunc_begin1:
.file 1 "/test" "test.c"
.loc 1 6 0 ; test.c:6:0
.cfi_startproc
sub sp, sp, #48
stp x29, x30, [sp, #32] ; 16-byte Folded Spill
add x29, sp, #32
.cfi_def_cfa w29, 16
.cfi_offset w30, -8
.cfi_offset w29, -16
mov w8, #0 ; =0x0
str w8, [sp, #12] ; 4-byte Folded Spill
stur wzr, [x29, #-4]
stur w0, [x29, #-8]
str x1, [sp, #16]
Ltmp0:
bl _foo
ldr w0, [sp, #12] ; 4-byte Folded Reload
ldp x29, x30, [sp, #32] ; 16-byte Folded Reload
add sp, sp, #48
ret
Ltmp1:
Lfunc_end1:
.cfi_endproc
; -- End function
.section __DWARF,__debug_abbrev,regular,debug
Lsection_abbrev:
.byte 1 ; Abbreviation Code
.byte 17 ; DW_TAG_compile_unit
.byte 1 ; DW_CHILDREN_yes
.byte 37 ; DW_AT_producer
.byte 14 ; DW_FORM_strp
.byte 19 ; DW_AT_language
.byte 5 ; DW_FORM_data2
.byte 3 ; DW_AT_name
.byte 14 ; DW_FORM_strp
.ascii "\202|" ; DW_AT_LLVM_sysroot
.byte 14 ; DW_FORM_strp
.ascii "\357\177" ; DW_AT_APPLE_sdk
.byte 14 ; DW_FORM_strp
.byte 16 ; DW_AT_stmt_list
.byte 23 ; DW_FORM_sec_offset
.byte 27 ; DW_AT_comp_dir
.byte 14 ; DW_FORM_strp
.byte 17 ; DW_AT_low_pc
.byte 1 ; DW_FORM_addr
.byte 18 ; DW_AT_high_pc
.byte 6 ; DW_FORM_data4
.byte 0 ; EOM(1)
.byte 0 ; EOM(2)
.byte 2 ; Abbreviation Code
.byte 46 ; DW_TAG_subprogram
.byte 1 ; DW_CHILDREN_yes
.byte 17 ; DW_AT_low_pc
.byte 1 ; DW_FORM_addr
.byte 18 ; DW_AT_high_pc
.byte 6 ; DW_FORM_data4
.byte 64 ; DW_AT_frame_base
.byte 24 ; DW_FORM_exprloc
.byte 3 ; DW_AT_name
.byte 14 ; DW_FORM_strp
.byte 58 ; DW_AT_decl_file
.byte 11 ; DW_FORM_data1
.byte 59 ; DW_AT_decl_line
.byte 11 ; DW_FORM_data1
.byte 39 ; DW_AT_prototyped
.byte 25 ; DW_FORM_flag_present
.byte 73 ; DW_AT_type
.byte 19 ; DW_FORM_ref4
.byte 63 ; DW_AT_external
.byte 25 ; DW_FORM_flag_present
.byte 0 ; EOM(1)
.byte 0 ; EOM(2)
.byte 3 ; Abbreviation Code
.byte 5 ; DW_TAG_formal_parameter
.byte 0 ; DW_CHILDREN_no
.byte 2 ; DW_AT_location
.byte 24 ; DW_FORM_exprloc
.byte 3 ; DW_AT_name
.byte 14 ; DW_FORM_strp
.byte 58 ; DW_AT_decl_file
.byte 11 ; DW_FORM_data1
.byte 59 ; DW_AT_decl_line
.byte 11 ; DW_FORM_data1
.byte 73 ; DW_AT_type
.byte 19 ; DW_FORM_ref4
.byte 0 ; EOM(1)
.byte 0 ; EOM(2)
.byte 4 ; Abbreviation Code
.byte 36 ; DW_TAG_base_type
.byte 0 ; DW_CHILDREN_no
.byte 3 ; DW_AT_name
.byte 14 ; DW_FORM_strp
.byte 62 ; DW_AT_encoding
.byte 11 ; DW_FORM_data1
.byte 11 ; DW_AT_byte_size
.byte 11 ; DW_FORM_data1
.byte 0 ; EOM(1)
.byte 0 ; EOM(2)
.byte 5 ; Abbreviation Code
.byte 15 ; DW_TAG_pointer_type
.byte 0 ; DW_CHILDREN_no
.byte 73 ; DW_AT_type
.byte 19 ; DW_FORM_ref4
.byte 0 ; EOM(1)
.byte 0 ; EOM(2)
.byte 0 ; EOM(3)
.section __DWARF,__debug_info,regular,debug
Lsection_info:
Lcu_begin0:
.set Lset0, Ldebug_info_end0-Ldebug_info_start0 ; Length of Unit
.long Lset0
Ldebug_info_start0:
.short 4 ; DWARF version number
.set Lset1, Lsection_abbrev-Lsection_abbrev ; Offset Into Abbrev. Section
.long Lset1
.byte 8 ; Address Size (in bytes)
.byte 1 ; Abbrev [1] 0xb:0x76 DW_TAG_compile_unit
.long 0 ; DW_AT_producer
.short 12 ; DW_AT_language
.long 47 ; DW_AT_name
.long 54 ; DW_AT_LLVM_sysroot
.long 165 ; DW_AT_APPLE_sdk
.set Lset2, Lline_table_start0-Lsection_line ; DW_AT_stmt_list
.long Lset2
.long 180 ; DW_AT_comp_dir
.quad Lfunc_begin1 ; DW_AT_low_pc
.set Lset3, Lfunc_end1-Lfunc_begin1 ; DW_AT_high_pc
.long Lset3
.byte 2 ; Abbrev [2] 0x32:0x36 DW_TAG_subprogram
.quad Lfunc_begin1 ; DW_AT_low_pc
.set Lset4, Lfunc_end1-Lfunc_begin1 ; DW_AT_high_pc
.long Lset4
.byte 1 ; DW_AT_frame_base
.byte 109
.long 247 ; DW_AT_name
.byte 1 ; DW_AT_decl_file
.byte 6 ; DW_AT_decl_line
; DW_AT_prototyped
.long 107 ; DW_AT_type
; DW_AT_external
.byte 3 ; Abbrev [3] 0x4b:0xe DW_TAG_formal_parameter
.byte 2 ; DW_AT_location
.byte 145
.byte 120
.long 256 ; DW_AT_name
.byte 1 ; DW_AT_decl_file
.byte 6 ; DW_AT_decl_line
.long 103 ; DW_AT_type
.byte 3 ; Abbrev [3] 0x59:0xe DW_TAG_formal_parameter
.byte 1 ; DW_AT_location
.byte 0x9c ; EDIT: DW_AT_call_frame_cfa
.long 261 ; DW_AT_name
.byte 1 ; DW_AT_decl_file
.byte 6 ; DW_AT_decl_line
.long 110 ; DW_AT_type
.byte 0 ; End Of Children Mark
.byte 4 ; Abbrev [4] 0x68:0x7 DW_TAG_base_type
.long 252 ; DW_AT_name
.byte 5 ; DW_AT_encoding
.byte 4 ; DW_AT_byte_size
.byte 5 ; Abbrev [5] 0x6f:0x5 DW_TAG_pointer_type
.long 115 ; DW_AT_type
.byte 5 ; Abbrev [5] 0x74:0x5 DW_TAG_pointer_type
.long 120 ; DW_AT_type
.byte 4 ; Abbrev [4] 0x79:0x7 DW_TAG_base_type
.long 266 ; DW_AT_name
.byte 6 ; DW_AT_encoding
.byte 1 ; DW_AT_byte_size
.byte 0 ; End Of Children Mark
Ldebug_info_end0:
.section __DWARF,__debug_str,regular,debug
Linfo_string:
.asciz "Apple clang " ; string offset=0
.asciz "test.c" ; string offset=47
.asciz "/Applications/Xcode..........................................................................................." ; string offset=54
.asciz ".............." ; string offset=165
.asciz "......................................................../llvm_src1" ; string offset=180
.asciz "main" ; string offset=247
.asciz "int" ; string offset=252
.asciz "argc" ; string offset=256
.asciz "argv" ; string offset=261
.asciz "char" ; string offset=266
.subsections_via_symbols
.section __DWARF,__debug_line,regular,debug
Lsection_line:
Lline_table_start0: