94 lines · plain
1# REQUIRES: x86, zlib2## -gdwarf-5 -fdebug-types-section may produce multiple .debug_info sections.3## All except one are type units. Test we can locate the compile unit, add it to4## the index, and not erroneously duplicate it (which would happen if we5## consider every .debug_info a compile unit).6 7# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o8# RUN: ld.lld --gdb-index --image-base=0x1000 -Ttext=0x1000 %t.o -o %t9# RUN: llvm-dwarfdump --gdb-index %t | FileCheck %s10 11## Test we don't uncompress a section while another thread is concurrently12## accessing it. This would be detected by tsan as a data race.13# RUN: llvm-objcopy --compress-debug-sections %t.o14# RUN: ld.lld --gdb-index --image-base=0x1000 -Ttext=0x1000 %t.o -o %t115# RUN: llvm-dwarfdump --gdb-index %t1 | FileCheck %s16 17## In this test, there are actually two compile unit .debug_info (very uncommon;18## -r --unique). Currently we only handle the last compile unit.19# CHECK: CU list offset = 0x18, has 1 entries:20# CHECK-NEXT: 0: Offset = 0x32, Length = 0x1921 22# CHECK: Address area offset = 0x28, has 1 entries:23# CHECK-NEXT: Low/High address = [0x1001, 0x1002) (Size: 0x1), CU id = 024 25.Lfunc_begin0:26 ret27.Lfunc_end0:28.Lfunc_begin1:29 ret30.Lfunc_end1:31 32.section .debug_abbrev,"",@progbits33 .byte 1 # Abbreviation Code34 .byte 65 # DW_TAG_type_unit35 .byte 0 # DW_CHILDREN_no36 .byte 0 # EOM(1)37 .byte 0 # EOM(2)38 39 .byte 2 # Abbreviation Code40 .byte 17 # DW_TAG_compile_unit41 .byte 0 # DW_CHILDREN_no42 .byte 17 # DW_AT_low_pc43 .byte 1 # DW_FORM_addr44 .byte 18 # DW_AT_high_pc45 .byte 6 # DW_FORM_data446 .byte 0 # EOM(1)47 .byte 0 # EOM(2)48 49 .byte 0 # EOM(3)50 51.macro TYPE_UNIT id signature52.section .debug_info,"G",@progbits,\signature53 .long .Ldebug_info_end\id-.Ldebug_info_start\id # Length of Unit54.Ldebug_info_start\id:55 .short 5 # DWARF version number56 .byte 2 # DWARF Unit Type57 .byte 8 # Address Size58 .long .debug_abbrev # Offset Into Abbrev. Section59 .quad \signature # Type Signature60 .long .Ldebug_info_end\id # Type DIE Offset61 .byte 1 # Abbrev [1] DW_TAG_type_unit62.Ldebug_info_end\id:63.endm64 65## We place compile units between two type units (rare). A naive approach will66## take either the first or the last .debug_info67TYPE_UNIT 0, 12368 69.section .debug_info,"",@progbits,unique,070.Lcu_begin0:71 .long .Lcu_end0-.Lcu_begin0-4 # Length of Unit72 .short 5 # DWARF version number73 .byte 1 # DWARF Unit Type74 .byte 8 # Address Size75 .long .debug_abbrev # Offset Into Abbrev. Section76 .byte 2 # Abbrev [2] DW_TAG_compile_unit77 .quad .Lfunc_begin0 # DW_AT_low_pc78 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc79.Lcu_end0:80 81.section .debug_info,"",@progbits,unique,182.Lcu_begin1:83 .long .Lcu_end1-.Lcu_begin1-4 # Length of Unit84 .short 5 # DWARF version number85 .byte 1 # DWARF Unit Type86 .byte 8 # Address Size87 .long .debug_abbrev # Offset Into Abbrev. Section88 .byte 2 # Abbrev [2] DW_TAG_compile_unit89 .quad .Lfunc_begin1 # DW_AT_low_pc90 .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc91.Lcu_end1:92 93TYPE_UNIT 1, 45694