1/* Copyright (C) 2011-2020 Free Software Foundation, Inc. 2 3 This program is free software; you can redistribute it and/or modify 4 it under the terms of the GNU General Public License as published by 5 the Free Software Foundation; either version 3 of the License, or 6 (at your option) any later version. 7 8 This program is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License 14 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 15 16/* This test demonstrates a failure to resolve opaque structure types in 17 binaries compiled by the Intel C compiler. This is GDB PR symtab/13277. 18 19 The test was derived from opaque-pointer.c, which contains the single line: 20 21 struct opaque_struct_t *p_struct; 22 23 and opaque_struct.c, which looks like: 24 25 struct opaque_struct_t 26 { 27 int wrapped_value; 28 }; 29 30 struct opaque_struct_t opaque_internal = { 0 }; 31 32 What follows is a simplified version of the debug info generated by ICC 33 version 12.0.4.191. */ 34 35 .file "opaque-pointer.c" 36 .data 37 .comm p_struct,8,8 38 .global p_struct 39 40 .section .debug_info 41debug_info_seg1: 42 .4byte debug_info_seg1_end - 1f /* Length of compilation unit info. */ 431: 44 .2byte 0x0002 /* DWARF version number. */ 45 .4byte .debug_abbrev_seg1 /* Points to abbrev section for this unit. */ 46 .byte 0x04 /* Target address size. */ 47 48 .byte 0x01 /* DIE 1: DW_TAG_compile_unit. */ 49 .byte 0x01 /* DW_AT_language = DW_LANG_C89. */ 50 .ascii "Intel(R) C Intel(R) 64 Compiler XE " /* DW_AT_producer. */ 51 .ascii "for applications running on Intel(R) 64, " 52 .ascii "Version 12.0.4.191 Build 20110427\n " 53 .asciz "Fixes SameLinkageName MemberPointers" 54 55 .byte 0x02 /* DIE 2: DW_TAG_variable. */ 56 .byte 0x01 /* DW_AT_accessibility. */ 57 .asciz "p_struct" /* DW_AT_name. */ 58 .4byte 3f - debug_info_seg1 /* DW_AT_type. */ 59 .byte 0x05 /* DW_AT_location: 5 bytes ... */ 60 .byte 0x03 /* DW_OP_addr ... */ 61 .4byte p_struct /* followed by the address of p_struct. */ 62 .byte 0x01 /* DW_AT_external. */ 63 643: 65 .byte 0x03 /* DIE 3: DW_TAG_pointer_type. */ 66 .4byte 4f - debug_info_seg1 /* DW_AT_type. */ 67 684: 69 .byte 0x04 /* DIE 4: DW_TAG_structure_type. */ 70 .byte 0x01 /* DW_AT_accessibility. */ 71 .byte 0x00 /* DW_AT_byte_size. */ 72 .asciz "opaque_struct_t" /* DW_AT_name. */ 73 74 .byte 0x00 /* End DIE 1. */ 75debug_info_seg1_end: 76 77 .section .debug_abbrev 78.debug_abbrev_seg1: 79 .byte 0x01 /* Abbrev 1. */ 80 .byte 0x11 /* DW_TAG_compile_unit. */ 81 .byte 0x01 /* DW_CHILDREN_yes. */ 82 .byte 0x13 /* DW_AT_language. */ 83 .byte 0x0b /* DW_FORM_data1. */ 84 .byte 0x25 /* DW_AT_producer. */ 85 .byte 0x08 /* DW_AT_string. */ 86 .2byte 0x0000 /* End abbrev. */ 87 88 .byte 0x02 /* Abbrev 2. */ 89 .byte 0x34 /* DW_TAG_variable. */ 90 .byte 0x00 /* DW_CHILDREN_no. */ 91 .byte 0x32 /* DW_AT_accessibility. */ 92 .byte 0x0b /* DW_FORM_data1. */ 93 .byte 0x03 /* DW_AT_name. */ 94 .byte 0x08 /* DW_FORM_string. */ 95 .byte 0x49 /* DW_AT_type. */ 96 .byte 0x13 /* DW_FORM_ref4. */ 97 .byte 0x02 /* DW_AT_location. */ 98 .byte 0x0a /* DW_FORM_block1. */ 99 .byte 0x3f /* DW_AT_external. */ 100 .byte 0x0c /* DW_FORM_flag. */ 101 .2byte 0x0000 /* End abbrev. */ 102 103 .byte 0x03 /* Abbrev 3. */ 104 .byte 0x0f /* DW_TAG_pointer_type. */ 105 .byte 0x00 /* DW_CHILDREN_no. */ 106 .byte 0x49 /* DW_AT_type. */ 107 .byte 0x13 /* DW_FORM_ref4. */ 108 .2byte 0x0000 /* End abbrev. */ 109 110 .byte 0x04 /* Abbrev 4. */ 111 .byte 0x13 /* DW_TAG_structure_type. */ 112 .byte 0x00 /* DW_CHILDREN_no. */ 113 .byte 0x32 /* DW_AT_accessibility. */ 114 .byte 0x0b /* DW_FORM_data1. */ 115 .byte 0x0b /* DW_AT_byte_size. */ 116 .byte 0x0b /* DW_FORM_data1. */ 117 .byte 0x03 /* DW_AT_name. */ 118 .byte 0x08 /* DW_FORM_string. */ 119 .2byte 0x0000 /* End abbrev. */ 120 .byte 0x00 /* End abbrev table. */ 121 122 123 .file "opaque-struct.c" 124 .section .debug_info 125debug_info_seg2: 126 .4byte debug_info_seg2_end - 1f /* Length of compilation unit info. */ 1271: 128 .2byte 0x0002 /* DWARF version number. */ 129 .4byte .debug_abbrev_seg2 /* Points to abbrev section for this unit. */ 130 .byte 0x04 /* Target address size. */ 131 132 .byte 0x01 /* DIE 1: DW_TAG_compile_unit. */ 133 .byte 0x01 /* DW_AT_language = DW_LANG_C89. */ 134 .ascii "Intel(R) C Intel(R) 64 Compiler XE " /* DW_AT_producer. */ 135 .ascii "for applications running on Intel(R) 64, " 136 .ascii "Version 12.0.4.191 Build 20110427\n " 137 .asciz "Fixes SameLinkageName MemberPointers" 138 139 .byte 0x02 /* DIE 2: DW_TAG_structure_type. */ 140 .byte 0x01 /* DW_AT_accessibility. */ 141 .byte 0x04 /* DW_AT_byte_size. */ 142 .asciz "opaque_struct_t" /* DW_AT_name. */ 143 144 145 .byte 0x03 /* DIE 3: DW_TAG_member. */ 146 .byte 0x02 /* DW_AT_data_member_location: 2 bytes ... */ 147 .byte 0x23 /* DW_OP_plus_uconst ... */ 148 .byte 0x00 /* followed by zero. */ 149 .asciz "wrapped_value" /* DW_AT_name. */ 150 .4byte 4f - debug_info_seg2 /* DW_AT_type. */ 151 .byte 0x00 152 1534: 154 .byte 0x04 /* DIE 4: DW_TAG_base_type. */ 155 .byte 0x04 /* DW_AT_byte_size. */ 156 .byte 0x05 /* DW_AT_encoding. */ 157 .asciz "int" /* DW_AT_name. */ 158 159 .byte 0x00 /* End DIE 1. */ 160debug_info_seg2_end: 161 162 .section .debug_abbrev 163.debug_abbrev_seg2: 164 .byte 0x01 /* Abbrev 1. */ 165 .byte 0x11 /* DW_TAG_compile_unit. */ 166 .byte 0x01 /* DW_CHILDREN_yes. */ 167 .byte 0x13 /* DW_AT_language. */ 168 .byte 0x0b /* DW_FORM_data1. */ 169 .byte 0x25 /* DW_AT_producer. */ 170 .byte 0x08 /* DW_FORM_string. */ 171 .2byte 0x0000 /* End abbrev. */ 172 173 .byte 0x02 /* Abbrev 2. */ 174 .byte 0x13 /* DW_TAG_structure_type. */ 175 .byte 0x01 /* DW_CHILDREN_yes. */ 176 .byte 0x32 /* DW_AT_accessibility. */ 177 .byte 0x0b /* DW_FORM_data1. */ 178 .byte 0x0b /* DW_AT_byte_size. */ 179 .byte 0x0b /* DW_FORM_data1. */ 180 .byte 0x03 /* DW_AT_name. */ 181 .byte 0x08 /* DW_FORM_string. */ 182 .2byte 0x0000 /* End abbrev. */ 183 184 .byte 0x03 /* Abbrev 3. */ 185 .byte 0x0d /* DW_TAG_member. */ 186 .byte 0x00 /* DW_CHILDREN_no. */ 187 .byte 0x38 /* DW_AT_data_member_location. */ 188 .byte 0x0a /* DW_FORM_block1. */ 189 .byte 0x03 /* DW_AT_name. */ 190 .byte 0x08 /* DW_FORM_string. */ 191 .byte 0x49 /* DW_AT_type. */ 192 .byte 0x13 /* DW_FORM_ref4. */ 193 .2byte 0x0000 /* End abbrev. */ 194 195 .byte 0x04 /* Abbrev 4. */ 196 .byte 0x24 /* DW_TAG_base_type. */ 197 .byte 0x00 /* DW_CHILDREN_no. */ 198 .byte 0x0b /* DW_AT_byte_size. */ 199 .byte 0x0b /* DW_FORM_data1. */ 200 .byte 0x3e /* DW_AT_encoding. */ 201 .byte 0x0b /* DW_FORM_data1. */ 202 .byte 0x03 /* DW_AT_name. */ 203 .byte 0x08 /* DW_FORM_string. */ 204 .2byte 0x0000 /* End abbrev. */ 205 .byte 0x00 /* End abbrev table. */ 206 207 208 .file "opaque-pointer2.c" 209 210 .section .debug_info 211debug_info_seg3: 212 .4byte debug_info_seg3_end - 1f /* Length of compilation unit info. */ 2131: 214 .2byte 0x0002 /* DWARF version number. */ 215 .4byte .debug_abbrev_seg3 /* Points to abbrev section for this unit. */ 216 .byte 0x04 /* Target address size. */ 217 218 .byte 0x01 /* DIE 1: DW_TAG_compile_unit. */ 219 .byte 0x01 /* DW_AT_language = DW_LANG_C89. */ 220 .ascii "Intel(R) C Intel(R) 64 Compiler XE " /* DW_AT_producer. */ 221 .ascii "for applications running on Intel(R) 64, " 222 .ascii "Version 12.0.4.191 Build 20110427\n " 223 .asciz "Fixes SameLinkageName MemberPointers" 224 225 .byte 0x04 /* DIE 4: DW_TAG_structure_type. */ 226 .byte 0x01 /* DW_AT_accessibility. */ 227 .byte 0x00 /* DW_AT_byte_size. */ 228 .asciz "opaque_struct_t" /* DW_AT_name. */ 229 230 .byte 0x00 /* End DIE 1. */ 231debug_info_seg3_end: 232 233 .section .debug_abbrev 234.debug_abbrev_seg3: 235 .byte 0x01 /* Abbrev 1. */ 236 .byte 0x11 /* DW_TAG_compile_unit. */ 237 .byte 0x01 /* DW_CHILDREN_yes. */ 238 .byte 0x13 /* DW_AT_language. */ 239 .byte 0x0b /* DW_FORM_data1. */ 240 .byte 0x25 /* DW_AT_producer. */ 241 .byte 0x08 /* DW_AT_string. */ 242 .2byte 0x0000 /* End abbrev. */ 243 244 .byte 0x04 /* Abbrev 4. */ 245 .byte 0x13 /* DW_TAG_structure_type. */ 246 .byte 0x00 /* DW_CHILDREN_no. */ 247 .byte 0x32 /* DW_AT_accessibility. */ 248 .byte 0x0b /* DW_FORM_data1. */ 249 .byte 0x0b /* DW_AT_byte_size. */ 250 .byte 0x0b /* DW_FORM_data1. */ 251 .byte 0x03 /* DW_AT_name. */ 252 .byte 0x08 /* DW_FORM_string. */ 253 .2byte 0x0000 /* End abbrev. */ 254 .byte 0x00 /* End abbrev table. */ 255