1/* This testcase is part of GDB, the GNU debugger. 2 3 Copyright 2007-2019 Free Software Foundation, Inc. 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 17 18#define CONCAT1(a, b) CONCAT2(a, b) 19#define CONCAT2(a, b) a ## b 20 21#ifdef SYMBOL_PREFIX 22# define SYMBOL(str) CONCAT1(SYMBOL_PREFIX, str) 23#else 24# define SYMBOL(str) str 25#endif 26 27 .data 28 29/* VAR1 is wrong here, in the real inferior it is located on stack. As both 30 places are never modified and they are initialized to the same value it 31 makes no difference. Ensure the name clash for "var". */ 32SYMBOL(var1): .byte 1 33 34 .globl SYMBOL(var) 35SYMBOL(var): .byte 2 36 37/* Debug information */ 38 39 .section .debug_info 40.Lcu1_begin: 41 /* CU header */ 42 .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ 43.Lcu1_start: 44 .2byte 2 /* DWARF Version */ 45 .4byte .Labbrev1_begin /* Offset into abbrev section */ 46 .byte 4 /* Pointer size */ 47 48 /* CU die */ 49 .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ 50 .4byte cu_text_end /* DW_AT_high_pc */ 51 .4byte cu_text_start /* DW_AT_low_pc */ 52 .ascii "dw2-unresolved-main.c\0" /* DW_AT_name */ 53 .ascii "GNU C 4.3.2\0" /* DW_AT_producer */ 54 .byte 1 /* DW_AT_language (C) */ 55 56.Ltype_uchar: 57 .uleb128 2 /* Abbrev: DW_TAG_base_type */ 58 .ascii "unsigned char\0" /* DW_AT_name */ 59 .byte 1 /* DW_AT_byte_size */ 60 .byte 7 /* DW_AT_encoding */ 61 62 /* main */ 63 .uleb128 3 /* Abbrev: DW_TAG_subprogram */ 64 .byte 1 /* DW_AT_decl_file */ 65 .byte 2 /* DW_AT_decl_line */ 66 .ascii "main\0" /* DW_AT_name */ 67 .4byte .Ltype_uchar-.Lcu1_begin /* DW_AT_type */ 68 .4byte cu_text_start /* DW_AT_low_pc */ 69 .4byte cu_text_end /* DW_AT_high_pc */ 70 71 .uleb128 4 /* Abbrev: DW_TAG_variable (location) */ 72 .ascii "var\0" /* DW_AT_name */ 73 .byte 2f - 1f /* DW_AT_location */ 741: .byte 3 /* DW_OP_addr */ 75/* See VAR1 definition why this DIE is not correct. */ 76 .4byte SYMBOL(var1) /* <addr> */ 772: .4byte .Ltype_uchar-.Lcu1_begin /* DW_AT_type */ 78 79 .uleb128 6 /* Abbrev: DW_TAG_lexical_block */ 80 .4byte SYMBOL(extern_block_start) /* DW_AT_low_pc */ 81 .4byte SYMBOL(extern_block_end) /* DW_AT_high_pc */ 82 83 .uleb128 5 /* Abbrev: DW_TAG_variable (extern) */ 84 .ascii "var\0" /* DW_AT_name */ 85 .4byte .Ltype_uchar-.Lcu1_begin /* DW_AT_type */ 86 .byte 1 /* DW_AT_external */ 87 88 .byte 0 /* End of children of the lexical block */ 89 90 .byte 0 /* End of children of main */ 91 92 .byte 0 /* End of children of CU */ 93 94.Lcu1_end: 95 96/* Abbrev table */ 97 .section .debug_abbrev 98.Labbrev1_begin: 99 .uleb128 1 /* Abbrev code */ 100 .uleb128 0x11 /* DW_TAG_compile_unit */ 101 .byte 1 /* has_children */ 102 .uleb128 0x12 /* DW_AT_high_pc */ 103 .uleb128 0x1 /* DW_FORM_addr */ 104 .uleb128 0x11 /* DW_AT_low_pc */ 105 .uleb128 0x1 /* DW_FORM_addr */ 106 .uleb128 0x3 /* DW_AT_name */ 107 .uleb128 0x8 /* DW_FORM_string */ 108 .uleb128 0x25 /* DW_AT_producer */ 109 .uleb128 0x8 /* DW_FORM_string */ 110 .uleb128 0x13 /* DW_AT_language */ 111 .uleb128 0xb /* DW_FORM_data1 */ 112 .byte 0x0 /* Terminator */ 113 .byte 0x0 /* Terminator */ 114 115 .uleb128 2 /* Abbrev code */ 116 .uleb128 0x24 /* DW_TAG_base_type */ 117 .byte 0 /* has_children */ 118 .uleb128 0x3 /* DW_AT_name */ 119 .uleb128 0x8 /* DW_FORM_string */ 120 .uleb128 0xb /* DW_AT_byte_size */ 121 .uleb128 0xb /* DW_FORM_data1 */ 122 .uleb128 0x3e /* DW_AT_encoding */ 123 .uleb128 0xb /* DW_FORM_data1 */ 124 .byte 0x0 /* Terminator */ 125 .byte 0x0 /* Terminator */ 126 127 .uleb128 3 /* Abbrev code */ 128 .uleb128 0x2e /* DW_TAG_subprogram */ 129 .byte 1 /* has_children */ 130 .uleb128 0x3a /* DW_AT_decl_file */ 131 .uleb128 0xb /* DW_FORM_data1 */ 132 .uleb128 0x3b /* DW_AT_decl_line */ 133 .uleb128 0xb /* DW_FORM_data1 */ 134 .uleb128 0x3 /* DW_AT_name */ 135 .uleb128 0x8 /* DW_FORM_string */ 136 .uleb128 0x49 /* DW_AT_type */ 137 .uleb128 0x13 /* DW_FORM_ref4 */ 138 .uleb128 0x11 /* DW_AT_low_pc */ 139 .uleb128 0x1 /* DW_FORM_addr */ 140 .uleb128 0x12 /* DW_AT_high_pc */ 141 .uleb128 0x1 /* DW_FORM_addr */ 142 .byte 0x0 /* Terminator */ 143 .byte 0x0 /* Terminator */ 144 145 .uleb128 4 /* Abbrev code (location) */ 146 .uleb128 0x34 /* DW_TAG_variable */ 147 .byte 0 /* has_children */ 148 .uleb128 0x3 /* DW_AT_name */ 149 .uleb128 0x8 /* DW_FORM_string */ 150 .uleb128 0x2 /* DW_AT_location */ 151 .uleb128 0xa /* DW_FORM_block1 */ 152 .uleb128 0x49 /* DW_AT_type */ 153 .uleb128 0x13 /* DW_FORM_ref4 */ 154 .byte 0x0 /* Terminator */ 155 .byte 0x0 /* Terminator */ 156 157 .uleb128 5 /* Abbrev code (extern) */ 158 .uleb128 0x34 /* DW_TAG_variable */ 159 .byte 0 /* has_children */ 160 .uleb128 0x3 /* DW_AT_name */ 161 .uleb128 0x8 /* DW_FORM_string */ 162 .uleb128 0x49 /* DW_AT_type */ 163 .uleb128 0x13 /* DW_FORM_ref4 */ 164 .uleb128 0x3f /* DW_AT_external */ 165 .uleb128 0xc /* DW_FORM_flag */ 166 .byte 0x0 /* Terminator */ 167 .byte 0x0 /* Terminator */ 168 169 .uleb128 6 /* Abbrev code */ 170 .uleb128 0x0b /* DW_TAG_lexical_block */ 171 .byte 1 /* has_children */ 172 .uleb128 0x11 /* DW_AT_low_pc */ 173 .uleb128 0x1 /* DW_FORM_addr */ 174 .uleb128 0x12 /* DW_AT_high_pc */ 175 .uleb128 0x1 /* DW_FORM_addr */ 176 .byte 0x0 /* Terminator */ 177 .byte 0x0 /* Terminator */ 178 179 .byte 0x0 /* Terminator */ 180 .byte 0x0 /* Terminator */ 181