|
| 1 | +# This test produces DWARF that contains a union type whose DW_TAG_member does |
| 2 | +# not have a DW_AT_data_member_location set to zero. This is how GCC emits |
| 3 | +# debug information for unions. There was code in the DWARFASTParserClang that |
| 4 | +# was emitting an invalid error in this case. This test verifies that this |
| 5 | +# error does not get emitted. |
| 6 | +# |
| 7 | +# 0x0000000b: DW_TAG_compile_unit |
| 8 | +# DW_AT_name ("main.cpp") |
| 9 | +# DW_AT_language (DW_LANG_C) |
| 10 | +# |
| 11 | +# 0x00000011: DW_TAG_base_type |
| 12 | +# DW_AT_name ("int") |
| 13 | +# DW_AT_encoding (DW_ATE_signed_char) |
| 14 | +# DW_AT_byte_size (0x04) |
| 15 | +# |
| 16 | +# 0x00000018: DW_TAG_base_type |
| 17 | +# DW_AT_name ("__ARRAY_SIZE_TYPE__") |
| 18 | +# DW_AT_encoding (DW_ATE_unsigned) |
| 19 | +# DW_AT_byte_size (0x08) |
| 20 | +# |
| 21 | +# 0x0000001f: DW_TAG_array_type |
| 22 | +# DW_AT_type (0x00000011 "int") |
| 23 | +# |
| 24 | +# 0x00000024: DW_TAG_subrange_type |
| 25 | +# DW_AT_type (0x00000018 "__ARRAY_SIZE_TYPE__") |
| 26 | +# DW_AT_count (0x20) |
| 27 | +# |
| 28 | +# 0x0000002a: NULL |
| 29 | +# |
| 30 | +# 0x0000002b: DW_TAG_union_type |
| 31 | +# DW_AT_name ("UnionType") |
| 32 | +# DW_AT_byte_size (0x20) |
| 33 | +# |
| 34 | +# 0x00000031: DW_TAG_member |
| 35 | +# DW_AT_name ("array") |
| 36 | +# DW_AT_type (0x0000001f "int[32]") |
| 37 | +# |
| 38 | +# 0x0000003a: NULL |
| 39 | +# |
| 40 | +# 0x0000003b: DW_TAG_subprogram |
| 41 | +# DW_AT_low_pc (0x0000000000001000) |
| 42 | +# DW_AT_high_pc (0x0000000000001050) |
| 43 | +# DW_AT_name ("foo") |
| 44 | +# DW_AT_type (0x00000031 "array") |
| 45 | +# |
| 46 | +# 0x00000054: NULL |
| 47 | + |
| 48 | +# RUN: yaml2obj %s > %t |
| 49 | +# RUN: lldb-test symbols --name=UnionType --find=type %t > %t.stdout |
| 50 | +# RUN: cat %t.stdout | FileCheck --check-prefix=STDOUT %s |
| 51 | +# RUN: lldb-test symbols --name=UnionType --find=type %t 2> %t.stderr |
| 52 | +# RUN: cat %t.stderr | FileCheck --allow-empty --check-prefix=STDERR %s |
| 53 | + |
| 54 | +# STDOUT: Found 1 types: |
| 55 | +# STDOUT: 0x{{[0-9a-fA-F]+}}: Type{0x0000002b} , name = "UnionType", size = 32, compiler_type = 0x{{[0-9a-fA-F]+}} union UnionType { |
| 56 | + |
| 57 | +# STDERR-NOT: error: union-types-no-member-location.yaml.tmp 0x00000031: DW_TAG_member 'array' refers to type 0x000000000000001f which extends beyond the bounds of 0x0000002b |
| 58 | + |
| 59 | +--- !ELF |
| 60 | +FileHeader: |
| 61 | + Class: ELFCLASS64 |
| 62 | + Data: ELFDATA2LSB |
| 63 | + Type: ET_EXEC |
| 64 | + Machine: EM_X86_64 |
| 65 | +DWARF: |
| 66 | + debug_str: |
| 67 | + - '' |
| 68 | + - main.cpp |
| 69 | + - int |
| 70 | + - __ARRAY_SIZE_TYPE__ |
| 71 | + - UnionType |
| 72 | + - array |
| 73 | + debug_abbrev: |
| 74 | + - ID: 0 |
| 75 | + Table: |
| 76 | + - Code: 0x1 |
| 77 | + Tag: DW_TAG_compile_unit |
| 78 | + Children: DW_CHILDREN_yes |
| 79 | + Attributes: |
| 80 | + - Attribute: DW_AT_name |
| 81 | + Form: DW_FORM_strp |
| 82 | + - Attribute: DW_AT_language |
| 83 | + Form: DW_FORM_udata |
| 84 | + - Code: 0x2 |
| 85 | + Tag: DW_TAG_base_type |
| 86 | + Children: DW_CHILDREN_no |
| 87 | + Attributes: |
| 88 | + - Attribute: DW_AT_name |
| 89 | + Form: DW_FORM_strp |
| 90 | + - Attribute: DW_AT_encoding |
| 91 | + Form: DW_FORM_data1 |
| 92 | + - Attribute: DW_AT_byte_size |
| 93 | + Form: DW_FORM_data1 |
| 94 | + - Code: 0x3 |
| 95 | + Tag: DW_TAG_array_type |
| 96 | + Children: DW_CHILDREN_yes |
| 97 | + Attributes: |
| 98 | + - Attribute: DW_AT_type |
| 99 | + Form: DW_FORM_ref4 |
| 100 | + - Code: 0x4 |
| 101 | + Tag: DW_TAG_subrange_type |
| 102 | + Children: DW_CHILDREN_no |
| 103 | + Attributes: |
| 104 | + - Attribute: DW_AT_type |
| 105 | + Form: DW_FORM_ref4 |
| 106 | + - Attribute: DW_AT_count |
| 107 | + Form: DW_FORM_data1 |
| 108 | + - Code: 0x5 |
| 109 | + Tag: DW_TAG_union_type |
| 110 | + Children: DW_CHILDREN_yes |
| 111 | + Attributes: |
| 112 | + - Attribute: DW_AT_name |
| 113 | + Form: DW_FORM_strp |
| 114 | + - Attribute: DW_AT_byte_size |
| 115 | + Form: DW_FORM_data1 |
| 116 | + - Code: 0x6 |
| 117 | + Tag: DW_TAG_member |
| 118 | + Children: DW_CHILDREN_no |
| 119 | + Attributes: |
| 120 | + - Attribute: DW_AT_name |
| 121 | + Form: DW_FORM_strp |
| 122 | + - Attribute: DW_AT_type |
| 123 | + Form: DW_FORM_ref4 |
| 124 | + - Code: 0x7 |
| 125 | + Tag: DW_TAG_subprogram |
| 126 | + Children: DW_CHILDREN_no |
| 127 | + Attributes: |
| 128 | + - Attribute: DW_AT_low_pc |
| 129 | + Form: DW_FORM_addr |
| 130 | + - Attribute: DW_AT_high_pc |
| 131 | + Form: DW_FORM_addr |
| 132 | + - Attribute: DW_AT_name |
| 133 | + Form: DW_FORM_string |
| 134 | + - Attribute: DW_AT_type |
| 135 | + Form: DW_FORM_ref4 |
| 136 | + debug_info: |
| 137 | + - Length: 0x51 |
| 138 | + Version: 4 |
| 139 | + AbbrevTableID: 0 |
| 140 | + AbbrOffset: 0x0 |
| 141 | + AddrSize: 8 |
| 142 | + Entries: |
| 143 | + - AbbrCode: 0x1 |
| 144 | + Values: |
| 145 | + - Value: 0x1 |
| 146 | + - Value: 0x2 |
| 147 | + - AbbrCode: 0x2 |
| 148 | + Values: |
| 149 | + - Value: 0xA |
| 150 | + - Value: 0x6 |
| 151 | + - Value: 0x4 |
| 152 | + - AbbrCode: 0x2 |
| 153 | + Values: |
| 154 | + - Value: 0xE |
| 155 | + - Value: 0x7 |
| 156 | + - Value: 0x8 |
| 157 | + - AbbrCode: 0x3 |
| 158 | + Values: |
| 159 | + - Value: 0x11 |
| 160 | + - AbbrCode: 0x4 |
| 161 | + Values: |
| 162 | + - Value: 0x18 |
| 163 | + - Value: 0x20 |
| 164 | + - AbbrCode: 0x0 |
| 165 | + - AbbrCode: 0x5 |
| 166 | + Values: |
| 167 | + - Value: 0x22 |
| 168 | + - Value: 0x20 |
| 169 | + - AbbrCode: 0x6 |
| 170 | + Values: |
| 171 | + - Value: 0x2C |
| 172 | + - Value: 0x1F |
| 173 | + - AbbrCode: 0x0 |
| 174 | + - AbbrCode: 0x7 |
| 175 | + Values: |
| 176 | + - Value: 0x1000 |
| 177 | + - Value: 0x1050 |
| 178 | + - Value: 0xDEADBEEFDEADBEEF |
| 179 | + CStr: foo |
| 180 | + - Value: 0x31 |
| 181 | + - AbbrCode: 0x0 |
| 182 | +... |
0 commit comments