111 lines · plain
1## Test disassembling of functions which are spread over multiple sections (ELF2## segments are modelled as LLDB sections).3 4 5# REQUIRES: x86, lld6 7# RUN: split-file %s %t8# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux %t/file.s -o %t/file.o9# RUN: ld.lld %t/file.o -o %t/file.out -T %t/file.lds10# RUN: %lldb %t/file.out -o "disassemble --name func1" -o exit | FileCheck %s11 12# CHECK: (lldb) disassemble --name func113# CHECK: file.out`func1:14# CHECK-NEXT: file.out[0x0] <+0>: int $0x2a15# CHECK: file.out`func1:16# CHECK-NEXT: file.out[0x1000] <+4096>: int $0x2f17 18 19#--- file.lds20## Linker script placing the parts of the section into different segments21## (typically one of these would be for the "hot" code).22PHDRS {23 text1 PT_LOAD;24 text2 PT_LOAD;25}26SECTIONS {27 . = 0;28 .text.part1 : { *(.text.part1) } :text129 .text.part2 : { *(.text.part2) } :text230}31 32#--- file.s33## A very simple function consisting of two parts and DWARF describing the34## function.35 .section .text.part1,"ax",@progbits36 .p2align 1237func1:38 int $4239.Lfunc1_end:40 41 .section .text.part2,"ax",@progbits42 .p2align 1243func1.__part.1:44 int $4745.Lfunc1.__part.1_end:46 47 48 49 .section .debug_abbrev,"",@progbits50 .byte 1 # Abbreviation Code51 .byte 17 # DW_TAG_compile_unit52 .byte 1 # DW_CHILDREN_yes53 .byte 37 # DW_AT_producer54 .byte 8 # DW_FORM_string55 .byte 19 # DW_AT_language56 .byte 5 # DW_FORM_data257 .byte 17 # DW_AT_low_pc58 .byte 1 # DW_FORM_addr59 .byte 85 # DW_AT_ranges60 .byte 23 # DW_FORM_sec_offset61 .byte 0 # EOM(1)62 .byte 0 # EOM(2)63 .byte 2 # Abbreviation Code64 .byte 46 # DW_TAG_subprogram65 .byte 0 # DW_CHILDREN_no66 .byte 85 # DW_AT_ranges67 .byte 23 # DW_FORM_sec_offset68 .byte 3 # DW_AT_name69 .byte 8 # DW_FORM_string70 .byte 0 # EOM(1)71 .byte 0 # EOM(2)72 .byte 0 # EOM(3)73 74 .section .debug_info,"",@progbits75.Lcu_begin0:76 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit77.Ldebug_info_start0:78 .short 5 # DWARF version number79 .byte 1 # DWARF Unit Type80 .byte 8 # Address Size (in bytes)81 .long .debug_abbrev # Offset Into Abbrev. Section82 .byte 1 # Abbrev DW_TAG_compile_unit83 .asciz "Hand-written DWARF" # DW_AT_producer84 .short 29 # DW_AT_language85 .quad 0 # DW_AT_low_pc86 .long .Ldebug_ranges0 # DW_AT_ranges87 .byte 2 # Abbrev DW_TAG_subprogram88 .long .Ldebug_ranges0 # DW_AT_ranges89 .asciz "func1" # DW_AT_name90 .byte 0 # End Of Children Mark91.Ldebug_info_end0:92 93 .section .debug_rnglists,"",@progbits94 .long .Ldebug_list_header_end0-.Ldebug_list_header_start0 # Length95.Ldebug_list_header_start0:96 .short 5 # Version97 .byte 8 # Address size98 .byte 0 # Segment selector size99 .long 1 # Offset entry count100.Lrnglists_table_base0:101 .long .Ldebug_ranges0-.Lrnglists_table_base0102.Ldebug_ranges0:103 .byte 6 # DW_RLE_start_end104 .quad func1105 .quad .Lfunc1_end106 .byte 6 # DW_RLE_start_end107 .quad func1.__part.1108 .quad .Lfunc1.__part.1_end109 .byte 0 # DW_RLE_end_of_list110.Ldebug_list_header_end0:111