143 lines · plain
1## Test that lldb handles (mainly, that it doesn't crash) the situation where2## two skeleton compile units have the same DWO ID (and try to claim the same3## split unit from the DWP file. This can sometimes happen when the compile unit4## is nearly empty (e.g. because LTO has optimized all of it away).5 6# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s --defsym MAIN=0 > %t7# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t.dwp8# RUN: %lldb %t -o "image lookup -t my_enum_type" \9# RUN: -o "image dump separate-debug-info" -o exit | FileCheck %s10 11## Check that we're able to access the type within the split unit (no matter12## which skeleton unit it ends up associated with). Completely ignoring the unit13## might also be reasonable.14# CHECK: image lookup -t my_enum_type15# CHECK: 1 match found16# CHECK: name = "my_enum_type", byte-size = 4, compiler_type = "enum my_enum_type {17# CHECK-NEXT: }"18#19## Check that we get some indication of the error.20# CHECK: image dump separate-debug-info21# CHECK: Dwo ID Err Dwo Path22# CHECK: 0xdeadbeefbaadf00d E multiple compile units with Dwo ID 0xdeadbeefbaadf00d23 24.set DWO_ID, 0xdeadbeefbaadf00d25 26## The main file.27.ifdef MAIN28 .section .debug_abbrev,"",@progbits29 .byte 1 # Abbreviation Code30 .byte 74 # DW_TAG_compile_unit31 .byte 0 # DW_CHILDREN_no32 .byte 0x76 # DW_AT_dwo_name33 .byte 8 # DW_FORM_string34 .byte 0 # EOM(1)35 .byte 0 # EOM(2)36 .byte 0 # EOM(3)37 38 39 .section .debug_info,"",@progbits40.irpc I,0141.Lcu_begin\I:42 .long .Ldebug_info_end\I-.Ldebug_info_start\I # Length of Unit43.Ldebug_info_start\I:44 .short 5 # DWARF version number45 .byte 4 # DWARF Unit Type46 .byte 8 # Address Size (in bytes)47 .long .debug_abbrev # Offset Into Abbrev. Section48 .quad DWO_ID # DWO id49 .byte 1 # Abbrev [1] DW_TAG_compile_unit50 .ascii "foo"51 .byte '0' + \I52 .asciz ".dwo\0" # DW_AT_dwo_name53.Ldebug_info_end\I:54.endr55 56.else57## DWP file starts here.58 59 .section .debug_abbrev.dwo,"e",@progbits60.LAbbrevBegin:61 .byte 1 # Abbreviation Code62 .byte 17 # DW_TAG_compile_unit63 .byte 1 # DW_CHILDREN_yes64 .byte 37 # DW_AT_producer65 .byte 8 # DW_FORM_string66 .byte 19 # DW_AT_language67 .byte 5 # DW_FORM_data268 .byte 0 # EOM(1)69 .byte 0 # EOM(2)70 .byte 2 # Abbreviation Code71 .byte 4 # DW_TAG_enumeration_type72 .byte 0 # DW_CHILDREN_no73 .byte 3 # DW_AT_name74 .byte 8 # DW_FORM_string75 .byte 73 # DW_AT_type76 .byte 19 # DW_FORM_ref477 .byte 11 # DW_AT_byte_size78 .byte 11 # DW_FORM_data179 .byte 0 # EOM(1)80 .byte 0 # EOM(2)81 .byte 4 # Abbreviation Code82 .byte 36 # DW_TAG_base_type83 .byte 0 # DW_CHILDREN_no84 .byte 3 # DW_AT_name85 .byte 8 # DW_FORM_string86 .byte 62 # DW_AT_encoding87 .byte 11 # DW_FORM_data188 .byte 11 # DW_AT_byte_size89 .byte 11 # DW_FORM_data190 .byte 0 # EOM(1)91 .byte 0 # EOM(2)92 .byte 0 # EOM(3)93.LAbbrevEnd:94 .section .debug_info.dwo,"e",@progbits95.LCUBegin:96.Lcu_begin1:97 .long .Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit98.Ldebug_info_start1:99 .short 5 # DWARF version number100 .byte 5 # DWARF Unit Type101 .byte 8 # Address Size (in bytes)102 .long 0 # Offset Into Abbrev. Section103 .quad DWO_ID # DWO id104 .byte 1 # Abbrev [1] DW_TAG_compile_unit105 .asciz "Hand-written DWARF" # DW_AT_producer106 .short 12 # DW_AT_language107 .byte 2 # Abbrev [2] DW_TAG_enumeration_type108 .asciz "my_enum_type" # DW_AT_name109 .long .Lint-.Lcu_begin1 # DW_AT_type110 .byte 4 # DW_AT_byte_size111.Lint:112 .byte 4 # Abbrev [4] DW_TAG_base_type113 .asciz "int" # DW_AT_name114 .byte 5 # DW_AT_encoding115 .byte 4 # DW_AT_byte_size116 .byte 0 # End Of Children Mark117.Ldebug_info_end1:118.LCUEnd:119 .section .debug_cu_index, "", @progbits120## Header:121 .short 5 # Version122 .short 0 # Padding123 .long 2 # Section count124 .long 1 # Unit count125 .long 2 # Slot count126## Hash Table of Signatures:127 .quad 0128 .quad DWO_ID129## Parallel Table of Indexes:130 .long 0131 .long 1132## Table of Section Offsets:133## Row 0:134 .long 1 # DW_SECT_INFO135 .long 3 # DW_SECT_ABBREV136## Row 1:137 .long 0 # Offset in .debug_info.dwo138 .long 0 # Offset in .debug_abbrev.dwo139## Table of Section Sizes:140 .long .LCUEnd-.LCUBegin # Size in .debug_info.dwo141 .long .LAbbrevEnd-.LAbbrevBegin # Size in .debug_abbrev.dwo142.endif143