207 lines · plain
1# An example of a function which has been split into two parts. Roughly2# corresponds to this C code.3# int baz();4# int bar() { return 47; }5# int foo(int flag) { return flag ? bar() : baz(); }6# The function bar has been placed "in the middle" of foo, and the function7# entry point is deliberately not its lowest address.8 9# RUN: split-file %s %t10# RUN: llvm-mc -triple x86_64-pc-linux -filetype=obj %t/input.s -o %t/input.o11# RUN: %lldb %t/input.o -s %t/commands -o exit | FileCheck %s12 13#--- commands14 15image lookup -v -n foo16# CHECK-LABEL: image lookup -v -n foo17# CHECK: 1 match found in {{.*}}18# CHECK: Summary: input.o`foo19# CHECK: Function: id = {{.*}}, name = "foo", ranges = [0x0000000000000000-0x000000000000000f)[0x0000000000000015-0x000000000000001d)20 21image lookup -v --regex -n '^foo$'22# CHECK-LABEL: image lookup -v --regex -n '^foo$'23# CHECK: 1 match found in {{.*}}24# CHECK: Summary: input.o`foo25# CHECK: Function: id = {{.*}}, name = "foo", ranges = [0x0000000000000000-0x000000000000000f)[0x0000000000000015-0x000000000000001d)26 27expr -- &foo28# CHECK-LABEL: expr -- &foo29# CHECK: (void (*)()) $0 = 0x000000000000000730 31breakpoint set --name foo --skip-prologue false32# CHECK-LABEL: breakpoint set --name foo --skip-prologue false33# CHECK: Breakpoint 1: where = input.o`foo at -:1, address = 0x000000000000000734 35breakpoint set --name foo --skip-prologue true36# CHECK-LABEL: breakpoint set --name foo --skip-prologue true37# CHECK: Breakpoint 2: where = input.o`foo + 1 at -:2, address = 0x000000000000000838 39#--- input.s40 .text41 42 .file 0 "." "-"43foo.__part.1:44 .loc 0 1045 .cfi_startproc46 callq bar47 jmp foo.__part.348.Lfoo.__part.1_end:49 .size foo.__part.1, .Lfoo.__part.1_end-foo.__part.150 .cfi_endproc51 52 .type foo,@function53foo:54 .loc 0 155 .cfi_startproc56 nop57 .loc 0 2 prologue_end58 cmpl $0, %edi59 je foo.__part.260 jmp foo.__part.161 .cfi_endproc62.Lfoo_end:63 .size foo, .Lfoo_end-foo64 65bar:66 .cfi_startproc67 .loc 0 10068 movl $47, %eax69 retq70 .cfi_endproc71.Lbar_end:72 .size bar, .Lbar_end-bar73 74foo.__part.2:75 .loc 0 2076 .cfi_startproc77 callq baz78 jmp foo.__part.379.Lfoo.__part.2_end:80 .size foo.__part.2, .Lfoo.__part.2_end-foo.__part.281 .cfi_endproc82 83foo.__part.3:84 .loc 0 3085 .cfi_startproc86 retq87.Lfoo.__part.3_end:88 .size foo.__part.3, .Lfoo.__part.3_end-foo.__part.389 .cfi_endproc90 91 92 .section .debug_abbrev,"",@progbits93 .byte 1 # Abbreviation Code94 .byte 17 # DW_TAG_compile_unit95 .byte 1 # DW_CHILDREN_yes96 .byte 37 # DW_AT_producer97 .byte 8 # DW_FORM_string98 .byte 19 # DW_AT_language99 .byte 5 # DW_FORM_data2100 .byte 17 # DW_AT_low_pc101 .byte 1 # DW_FORM_addr102 .byte 85 # DW_AT_ranges103 .byte 35 # DW_FORM_rnglistx104 .byte 116 # DW_AT_rnglists_base105 .byte 23 # DW_FORM_sec_offset106 .byte 16 # DW_AT_stmt_list107 .byte 23 # DW_FORM_sec_offset108 .byte 0 # EOM(1)109 .byte 0 # EOM(2)110 .byte 2 # Abbreviation Code111 .byte 46 # DW_TAG_subprogram112 .byte 0 # DW_CHILDREN_no113 .byte 17 # DW_AT_low_pc114 .byte 1 # DW_FORM_addr115 .byte 18 # DW_AT_high_pc116 .byte 1 # DW_FORM_addr117 .byte 3 # DW_AT_name118 .byte 8 # DW_FORM_string119 .byte 0 # EOM(1)120 .byte 0 # EOM(2)121 .byte 3 # Abbreviation Code122 .byte 46 # DW_TAG_subprogram123 .byte 0 # DW_CHILDREN_no124 .byte 85 # DW_AT_ranges125 .byte 35 # DW_FORM_rnglistx126 .byte 64 # DW_AT_frame_base127 .byte 24 # DW_FORM_exprloc128 .byte 3 # DW_AT_name129 .byte 8 # DW_FORM_string130 .byte 0 # EOM(1)131 .byte 0 # EOM(2)132 .byte 0 # EOM(3)133 134 .section .debug_info,"",@progbits135.Lcu_begin0:136 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit137.Ldebug_info_start0:138 .short 5 # DWARF version number139 .byte 1 # DWARF Unit Type140 .byte 8 # Address Size (in bytes)141 .long .debug_abbrev # Offset Into Abbrev. Section142 .byte 1 # Abbrev [1] DW_TAG_compile_unit143 .asciz "Hand-written DWARF" # DW_AT_producer144 .short 29 # DW_AT_language145 .quad 0 # DW_AT_low_pc146 .byte 1 # DW_AT_ranges147 .long .Lrnglists_table_base0 # DW_AT_rnglists_base148 .long .Lline_table_start0 # DW_AT_stmt_list149 .byte 2 # Abbrev [2] DW_TAG_subprogram150 .quad bar # DW_AT_low_pc151 .quad .Lbar_end # DW_AT_high_pc152 .asciz "bar" # DW_AT_name153 .byte 3 # Abbrev [3] DW_TAG_subprogram154 .byte 0 # DW_AT_ranges155 .byte 1 # DW_AT_frame_base156 .byte 86157 .asciz "foo" # DW_AT_name158 .byte 0 # End Of Children Mark159.Ldebug_info_end0:160 161 .section .debug_rnglists,"",@progbits162 .long .Ldebug_list_header_end0-.Ldebug_list_header_start0 # Length163.Ldebug_list_header_start0:164 .short 5 # Version165 .byte 8 # Address size166 .byte 0 # Segment selector size167 .long 2 # Offset entry count168.Lrnglists_table_base0:169 .long .Ldebug_ranges0-.Lrnglists_table_base0170 .long .Ldebug_ranges1-.Lrnglists_table_base0171.Ldebug_ranges0:172 .byte 6 # DW_RLE_start_end173 .quad foo174 .quad .Lfoo_end175 .byte 6 # DW_RLE_start_end176 .quad foo.__part.1177 .quad .Lfoo.__part.1_end178 .byte 6 # DW_RLE_start_end179 .quad foo.__part.2180 .quad .Lfoo.__part.2_end181 .byte 6 # DW_RLE_start_end182 .quad foo.__part.3183 .quad .Lfoo.__part.3_end184 .byte 0 # DW_RLE_end_of_list185.Ldebug_ranges1:186 .byte 6 # DW_RLE_start_end187 .quad bar188 .quad .Lbar_end189 .byte 6 # DW_RLE_start_end190 .quad foo.__part.1191 .quad .Lfoo.__part.1_end192 .byte 6 # DW_RLE_start_end193 .quad foo.__part.2194 .quad .Lfoo.__part.2_end195 .byte 6 # DW_RLE_start_end196 .quad foo.__part.3197 .quad .Lfoo.__part.3_end198 .byte 6 # DW_RLE_start_end199 .quad foo200 .quad .Lfoo_end201 .byte 0 # DW_RLE_end_of_list202.Ldebug_list_header_end0:203 204 .section ".note.GNU-stack","",@progbits205 .section .debug_line,"",@progbits206.Lline_table_start0:207