139 lines · plain
1## The test checks that llvm-dwp avoids an out of bound access when there is2## an unknown section identifier in an index section. Without the fix, the test3## failed when LLVM is built with UBSan.4## Note that additional sections (.debug_abbrev.dwo, .debug_info.dwo, and5## .debug_types.dwo) are required to reach the test points in the code.6 7# RUN: llvm-mc -triple x86_64-unknown-linux-gnu %s -filetype=obj -o %t.dwp8# RUN: llvm-dwp %t.dwp -o - | \9# RUN: llvm-dwarfdump -debug-cu-index -debug-tu-index - | \10# RUN: FileCheck %s11 12## Check that all known sections are preserved and no data for unknown section13## identifiers is copied.14 15# CHECK: .debug_cu_index contents:16# CHECK-NEXT: version = 2, units = 1, slots = 217# CHECK: Index Signature INFO ABBREV18# CHECK-NOT: Unknown19# CHECK: -----20# CHECK-NEXT: 1 0x1100002222222222 [0x0000000000000000, 0x0000000000000014) [0x00000000, 0x00000009)21# CHECK-NOT: [22 23# CHECK: .debug_tu_index contents:24# CHECK-NEXT: version = 2, units = 1, slots = 225# CHECK: Index Signature TYPES ABBREV26# CHECK-NOT: Unknown27# CHECK: -----28# CHECK-NEXT: 2 0x1100003333333333 [0x0000000000000000, 0x0000000000000019) [0x00000009, 0x00000014)29# CHECK-NOT: [30 31.section .debug_abbrev.dwo, "e", @progbits32.LCUAbbrevBegin:33 .uleb128 1 # Abbreviation Code34 .uleb128 0x11 # DW_TAG_compile_unit35 .byte 0 # DW_CHILDREN_no36 .uleb128 0x2131 # DW_AT_GNU_dwo_id37 .uleb128 7 # DW_FORM_data838 .byte 0 # EOM(1)39 .byte 0 # EOM(2)40 .byte 0 # EOM(3)41.LCUAbbrevEnd:42 43.LTUAbbrevBegin:44 .uleb128 1 # Abbreviation Code45 .uleb128 0x41 # DW_TAG_type_unit46 .byte 1 # DW_CHILDREN_yes47 .byte 0 # EOM(1)48 .byte 0 # EOM(2)49 .uleb128 2 # Abbreviation Code50 .uleb128 0x13 # DW_TAG_structure_type51 .byte 0 # DW_CHILDREN_no52 .byte 0 # EOM(1)53 .byte 0 # EOM(2)54 .byte 0 # EOM(3)55.LTUAbbrevEnd:56 57 .section .debug_info.dwo, "e", @progbits58.LCUBegin:59 .long .LCUEnd-.LCUVersion # Length of Unit60.LCUVersion:61 .short 4 # Version62 .long 0 # Abbrev offset63 .byte 8 # Address size64 .uleb128 1 # Abbrev [1] DW_TAG_compile_unit65 .quad 0x1100002222222222 # DW_AT_GNU_dwo_id66.LCUEnd:67 68 .section .debug_types.dwo, "e", @progbits69.LTUBegin:70 .long .LTUEnd-.LTUVersion # Length of Unit71.LTUVersion:72 .short 4 # Version73 .long 0 # Abbrev offset74 .byte 8 # Address size75 .quad 0x1100003333333333 # Type signature76 .long .LTUType-.LTUBegin # Type offset77 .uleb128 1 # Abbrev [1] DW_TAG_type_unit78.LTUType:79 .uleb128 2 # Abbrev [2] DW_TAG_structure_type80.LTUEnd:81 82 .section .debug_cu_index, "", @progbits83## Header:84 .long 2 # Version85 .long 4 # Section count86 .long 1 # Unit count87 .long 2 # Slot count88## Hash Table of Signatures:89 .quad 0x110000222222222290 .quad 091## Parallel Table of Indexes:92 .long 193 .long 094## Table of Section Offsets:95## Row 0:96 .long 1 # DW_SECT_INFO97 .long 3 # DW_SECT_ABBREV98 .long 0 # Invalid ID, less than DW_SECT_INFO99 .long 9 # Invalid ID, greater than DW_SECT_MACRO100## Row 1:101 .long 0 # Offset in .debug_info.dwo102 .long 0 # Offset in .debug_abbrev.dwo103 .long 0104 .long 0105## Table of Section Sizes:106 .long .LCUEnd-.LCUBegin # Size in .debug_info.dwo107 .long .LCUAbbrevEnd-.LCUAbbrevBegin # Size in .debug_abbrev.dwo108 .long 1109 .long 1110 111 .section .debug_tu_index, "", @progbits112## Header:113 .long 2 # Version114 .long 4 # Section count115 .long 1 # Unit count116 .long 2 # Slot count117## Hash Table of Signatures:118 .quad 0119 .quad 0x1100003333333333120## Parallel Table of Indexes:121 .long 0122 .long 1123## Table of Section Offsets:124## Row 0:125 .long 2 # DW_SECT_TYPES126 .long 3 # DW_SECT_ABBREV127 .long 0 # Invalid ID, less than DW_SECT_INFO128 .long 9 # Invalid ID, greater than DW_SECT_MACRO129## Row 1:130 .long 0 # Offset in .debug_types.dwo131 .long .LTUAbbrevBegin-.debug_abbrev.dwo # Offset in .debug_abbrev.dwo132 .long 0133 .long 0134## Table of Section Sizes:135 .long .LTUEnd-.LTUBegin # Size in .debug_types.dwo136 .long .LTUAbbrevEnd-.LTUAbbrevBegin # Size in .debug_abbrev.dwo137 .long 1138 .long 1139