| 1 | /* This testcase is part of GDB, the GNU debugger. |
| 2 | |
| 3 | Copyright 2004-2015 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 | /* Test a minimal file containing DWARF-2 information. This test also |
| 19 | serves as a skeleton for other DWARF-2 tests. Most other tests will |
| 20 | not be this extensively itemized and commented... */ |
| 21 | |
| 22 | /* Dummy function to provide debug information for. */ |
| 23 | |
| 24 | .text |
| 25 | .Lbegin_text1: |
| 26 | .globl func_cu1 |
| 27 | .type func_cu1, %function |
| 28 | func_cu1: |
| 29 | .Lbegin_func_cu1: |
| 30 | .4byte 0 |
| 31 | .Lend_func_cu1: |
| 32 | .size func_cu1, .-func_cu1 |
| 33 | .Lend_text1: |
| 34 | |
| 35 | /* Debug information */ |
| 36 | |
| 37 | .section .debug_info |
| 38 | .Lcu1_begin: |
| 39 | /* CU header */ |
| 40 | .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ |
| 41 | .Lcu1_start: |
| 42 | .2byte 2 /* DWARF Version */ |
| 43 | .4byte .Labbrev1_begin /* Offset into abbrev section */ |
| 44 | .byte 4 /* Pointer size */ |
| 45 | |
| 46 | /* CU die */ |
| 47 | .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ |
| 48 | .4byte .Lline1_begin /* DW_AT_stmt_list */ |
| 49 | .4byte .Lend_text1 /* DW_AT_high_pc */ |
| 50 | .4byte .Lbegin_text1 /* DW_AT_low_pc */ |
| 51 | .ascii "file1.txt\0" /* DW_AT_name */ |
| 52 | .ascii "GNU C 3.3.3\0" /* DW_AT_producer */ |
| 53 | .byte 1 /* DW_AT_language (C) */ |
| 54 | |
| 55 | /* func_cu1 */ |
| 56 | .uleb128 2 /* Abbrev: DW_TAG_subprogram */ |
| 57 | .byte 1 /* DW_AT_external */ |
| 58 | .byte 1 /* DW_AT_decl_file */ |
| 59 | .byte 2 /* DW_AT_decl_line */ |
| 60 | .ascii "func_cu1\0" /* DW_AT_name */ |
| 61 | .4byte .Ltype_int2_in_cu2 /* DW_AT_type */ |
| 62 | .4byte .Lbegin_func_cu1 /* DW_AT_low_pc */ |
| 63 | .4byte .Lend_func_cu1 /* DW_AT_high_pc */ |
| 64 | .byte 1 /* DW_AT_frame_base: length */ |
| 65 | .byte 0x55 /* DW_AT_frame_base: DW_OP_reg5 */ |
| 66 | |
| 67 | /* This type is named "int1" and not "int" to ensure it is unique, |
| 68 | and thus we can easily ensure we expand this CU and not some |
| 69 | other CU with "int". */ |
| 70 | .Ltype_int1_in_cu1: |
| 71 | .uleb128 3 /* Abbrev: DW_TAG_base_type */ |
| 72 | .ascii "int1\0" /* DW_AT_name */ |
| 73 | .byte 4 /* DW_AT_byte_size */ |
| 74 | .byte 5 /* DW_AT_encoding */ |
| 75 | |
| 76 | .Ltype_const_int1_in_cu1: |
| 77 | .uleb128 4 /* Abbrev: DW_TAG_const_type */ |
| 78 | .4byte .Ltype_int1_in_cu1-.Lcu1_begin /* DW_AT_type */ |
| 79 | |
| 80 | .uleb128 5 /* Abbrev: DW_TAG_variable */ |
| 81 | .ascii "one\0" /* DW_AT_name */ |
| 82 | .4byte .Ltype_const_int1_in_cu1-.Lcu1_begin /* DW_AT_type */ |
| 83 | .byte 1 /* DW_AT_const_value */ |
| 84 | |
| 85 | .byte 0 /* End of children of CU */ |
| 86 | |
| 87 | .Lcu1_end: |
| 88 | |
| 89 | /* Second compilation unit. */ |
| 90 | .Lcu2_begin: |
| 91 | /* CU header */ |
| 92 | .4byte .Lcu2_end - .Lcu2_start /* Length of Compilation Unit */ |
| 93 | .Lcu2_start: |
| 94 | .2byte 2 /* DWARF Version */ |
| 95 | .4byte .Labbrev2_begin /* Offset into abbrev section */ |
| 96 | .byte 4 /* Pointer size */ |
| 97 | |
| 98 | /* CU die */ |
| 99 | .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ |
| 100 | .ascii "file1.txt\0" /* DW_AT_name */ |
| 101 | .ascii "GNU C 3.3.3\0" /* DW_AT_producer */ |
| 102 | .byte 1 /* DW_AT_language (C) */ |
| 103 | |
| 104 | /* This type is named "int2" and not "int" to ensure it is unique, |
| 105 | and thus we can easily ensure we expand this CU and not some |
| 106 | other CU with "int". */ |
| 107 | .Ltype_int2_in_cu2: |
| 108 | .uleb128 2 /* Abbrev: DW_TAG_base_type */ |
| 109 | .ascii "int2\0" /* DW_AT_name */ |
| 110 | .byte 4 /* DW_AT_byte_size */ |
| 111 | .byte 5 /* DW_AT_encoding */ |
| 112 | |
| 113 | .Ltype_const_int2_in_cu2: |
| 114 | .uleb128 3 /* Abbrev: DW_TAG_const_type */ |
| 115 | .4byte .Ltype_int2_in_cu2-.Lcu2_begin /* DW_AT_type */ |
| 116 | |
| 117 | .uleb128 4 /* Abbrev: DW_TAG_variable */ |
| 118 | .ascii "two\0" /* DW_AT_name */ |
| 119 | .4byte .Ltype_const_int2_in_cu2-.Lcu2_begin /* DW_AT_type */ |
| 120 | .byte 2 /* DW_AT_const_value */ |
| 121 | |
| 122 | .byte 0 /* End of children of CU */ |
| 123 | |
| 124 | .Lcu2_end: |
| 125 | |
| 126 | /* Abbrev table */ |
| 127 | .section .debug_abbrev |
| 128 | .Labbrev1_begin: |
| 129 | .uleb128 1 /* Abbrev code */ |
| 130 | .uleb128 0x11 /* DW_TAG_compile_unit */ |
| 131 | .byte 1 /* has_children */ |
| 132 | .uleb128 0x10 /* DW_AT_stmt_list */ |
| 133 | .uleb128 0x6 /* DW_FORM_data4 */ |
| 134 | .uleb128 0x12 /* DW_AT_high_pc */ |
| 135 | .uleb128 0x1 /* DW_FORM_addr */ |
| 136 | .uleb128 0x11 /* DW_AT_low_pc */ |
| 137 | .uleb128 0x1 /* DW_FORM_addr */ |
| 138 | .uleb128 0x3 /* DW_AT_name */ |
| 139 | .uleb128 0x8 /* DW_FORM_string */ |
| 140 | .uleb128 0x25 /* DW_AT_producer */ |
| 141 | .uleb128 0x8 /* DW_FORM_string */ |
| 142 | .uleb128 0x13 /* DW_AT_language */ |
| 143 | .uleb128 0xb /* DW_FORM_data1 */ |
| 144 | .byte 0x0 /* Terminator */ |
| 145 | .byte 0x0 /* Terminator */ |
| 146 | |
| 147 | .uleb128 2 /* Abbrev code */ |
| 148 | .uleb128 0x2e /* DW_TAG_subprogram */ |
| 149 | .byte 0 /* has_children */ |
| 150 | .uleb128 0x3f /* DW_AT_external */ |
| 151 | .uleb128 0xc /* DW_FORM_flag */ |
| 152 | .uleb128 0x3a /* DW_AT_decl_file */ |
| 153 | .uleb128 0xb /* DW_FORM_data1 */ |
| 154 | .uleb128 0x3b /* DW_AT_decl_line */ |
| 155 | .uleb128 0xb /* DW_FORM_data1 */ |
| 156 | .uleb128 0x3 /* DW_AT_name */ |
| 157 | .uleb128 0x8 /* DW_FORM_string */ |
| 158 | .uleb128 0x49 /* DW_AT_type */ |
| 159 | .uleb128 0x10 /* DW_FORM_ref_addr */ |
| 160 | .uleb128 0x11 /* DW_AT_low_pc */ |
| 161 | .uleb128 0x1 /* DW_FORM_addr */ |
| 162 | .uleb128 0x12 /* DW_AT_high_pc */ |
| 163 | .uleb128 0x1 /* DW_FORM_addr */ |
| 164 | .uleb128 0x40 /* DW_AT_frame_base */ |
| 165 | .uleb128 0xa /* DW_FORM_block1 */ |
| 166 | .byte 0x0 /* Terminator */ |
| 167 | .byte 0x0 /* Terminator */ |
| 168 | |
| 169 | .uleb128 3 /* Abbrev code */ |
| 170 | .uleb128 0x24 /* DW_TAG_base_type */ |
| 171 | .byte 0 /* has_children */ |
| 172 | .uleb128 0x3 /* DW_AT_name */ |
| 173 | .uleb128 0x8 /* DW_FORM_string */ |
| 174 | .uleb128 0xb /* DW_AT_byte_size */ |
| 175 | .uleb128 0xb /* DW_FORM_data1 */ |
| 176 | .uleb128 0x3e /* DW_AT_encoding */ |
| 177 | .uleb128 0xb /* DW_FORM_data1 */ |
| 178 | .byte 0x0 /* Terminator */ |
| 179 | .byte 0x0 /* Terminator */ |
| 180 | |
| 181 | .uleb128 4 /* Abbrev code */ |
| 182 | .uleb128 0x26 /* DW_TAG_const_type */ |
| 183 | .byte 0x0 /* DW_children_no */ |
| 184 | .uleb128 0x49 /* DW_AT_type */ |
| 185 | .uleb128 0x13 /* DW_FORM_ref4 */ |
| 186 | .byte 0x0 /* Terminator */ |
| 187 | .byte 0x0 /* Terminator */ |
| 188 | |
| 189 | .uleb128 5 /* Abbrev code */ |
| 190 | .uleb128 0x34 /* DW_TAG_variable */ |
| 191 | .byte 0x0 /* DW_children_no */ |
| 192 | .uleb128 0x3 /* DW_AT_name */ |
| 193 | .uleb128 0x8 /* DW_FORM_string */ |
| 194 | .uleb128 0x49 /* DW_AT_type */ |
| 195 | .uleb128 0x13 /* DW_FORM_ref4 */ |
| 196 | .uleb128 0x1c /* DW_AT_const_value */ |
| 197 | .uleb128 0xb /* DW_FORM_data1 */ |
| 198 | .byte 0x0 /* Terminator */ |
| 199 | .byte 0x0 /* Terminator */ |
| 200 | |
| 201 | .byte 0x0 /* Terminator */ |
| 202 | .byte 0x0 /* Terminator */ |
| 203 | |
| 204 | .Labbrev2_begin: |
| 205 | .uleb128 1 /* Abbrev code */ |
| 206 | .uleb128 0x11 /* DW_TAG_compile_unit */ |
| 207 | .byte 1 /* has_children */ |
| 208 | .uleb128 0x3 /* DW_AT_name */ |
| 209 | .uleb128 0x8 /* DW_FORM_string */ |
| 210 | .uleb128 0x25 /* DW_AT_producer */ |
| 211 | .uleb128 0x8 /* DW_FORM_string */ |
| 212 | .uleb128 0x13 /* DW_AT_language */ |
| 213 | .uleb128 0xb /* DW_FORM_data1 */ |
| 214 | .byte 0x0 /* Terminator */ |
| 215 | .byte 0x0 /* Terminator */ |
| 216 | |
| 217 | .uleb128 2 /* Abbrev code */ |
| 218 | .uleb128 0x24 /* DW_TAG_base_type */ |
| 219 | .byte 0 /* has_children */ |
| 220 | .uleb128 0x3 /* DW_AT_name */ |
| 221 | .uleb128 0x8 /* DW_FORM_string */ |
| 222 | .uleb128 0xb /* DW_AT_byte_size */ |
| 223 | .uleb128 0xb /* DW_FORM_data1 */ |
| 224 | .uleb128 0x3e /* DW_AT_encoding */ |
| 225 | .uleb128 0xb /* DW_FORM_data1 */ |
| 226 | .byte 0x0 /* Terminator */ |
| 227 | .byte 0x0 /* Terminator */ |
| 228 | |
| 229 | .uleb128 3 /* Abbrev code */ |
| 230 | .uleb128 0x26 /* DW_TAG_const_type */ |
| 231 | .byte 0x0 /* DW_children_no */ |
| 232 | .uleb128 0x49 /* DW_AT_type */ |
| 233 | .uleb128 0x13 /* DW_FORM_ref4 */ |
| 234 | .byte 0x0 /* Terminator */ |
| 235 | .byte 0x0 /* Terminator */ |
| 236 | |
| 237 | .uleb128 4 /* Abbrev code */ |
| 238 | .uleb128 0x34 /* DW_TAG_variable */ |
| 239 | .byte 0x0 /* DW_children_no */ |
| 240 | .uleb128 0x3 /* DW_AT_name */ |
| 241 | .uleb128 0x8 /* DW_FORM_string */ |
| 242 | .uleb128 0x49 /* DW_AT_type */ |
| 243 | .uleb128 0x13 /* DW_FORM_ref4 */ |
| 244 | .uleb128 0x1c /* DW_AT_const_value */ |
| 245 | .uleb128 0xb /* DW_FORM_data1 */ |
| 246 | .byte 0x0 /* Terminator */ |
| 247 | .byte 0x0 /* Terminator */ |
| 248 | |
| 249 | .byte 0x0 /* Terminator */ |
| 250 | .byte 0x0 /* Terminator */ |
| 251 | |
| 252 | /* Line table */ |
| 253 | .section .debug_line |
| 254 | .Lline1_begin: |
| 255 | .4byte .Lline1_end - .Lline1_start /* Initial length */ |
| 256 | .Lline1_start: |
| 257 | .2byte 2 /* Version */ |
| 258 | .4byte .Lline1_lines - .Lline1_hdr /* header_length */ |
| 259 | .Lline1_hdr: |
| 260 | .byte 1 /* Minimum insn length */ |
| 261 | .byte 1 /* default_is_stmt */ |
| 262 | .byte 1 /* line_base */ |
| 263 | .byte 1 /* line_range */ |
| 264 | .byte 0x10 /* opcode_base */ |
| 265 | |
| 266 | /* Standard lengths */ |
| 267 | .byte 0 |
| 268 | .byte 1 |
| 269 | .byte 1 |
| 270 | .byte 1 |
| 271 | .byte 1 |
| 272 | .byte 0 |
| 273 | .byte 0 |
| 274 | .byte 0 |
| 275 | .byte 1 |
| 276 | .byte 0 |
| 277 | .byte 0 |
| 278 | .byte 1 |
| 279 | .byte 0 |
| 280 | .byte 0 |
| 281 | .byte 0 |
| 282 | |
| 283 | /* Include directories */ |
| 284 | .byte 0 |
| 285 | |
| 286 | /* File names */ |
| 287 | .ascii "file1.txt\0" |
| 288 | .uleb128 0 |
| 289 | .uleb128 0 |
| 290 | .uleb128 0 |
| 291 | |
| 292 | .byte 0 |
| 293 | |
| 294 | .Lline1_lines: |
| 295 | .byte 0 /* DW_LNE_set_address */ |
| 296 | .uleb128 5 |
| 297 | .byte 2 |
| 298 | .4byte .Lbegin_func_cu1 |
| 299 | |
| 300 | .byte 3 /* DW_LNS_advance_line */ |
| 301 | .sleb128 3 /* ... to 4 */ |
| 302 | |
| 303 | .byte 1 /* DW_LNS_copy */ |
| 304 | |
| 305 | .byte 1 /* DW_LNS_copy (second time as an end-of-prologue marker) */ |
| 306 | |
| 307 | .byte 0 /* DW_LNE_set_address */ |
| 308 | .uleb128 5 |
| 309 | .byte 2 |
| 310 | .4byte .Lend_func_cu1 |
| 311 | |
| 312 | .byte 0 /* DW_LNE_end_of_sequence */ |
| 313 | .uleb128 1 |
| 314 | .byte 1 |
| 315 | |
| 316 | .Lline1_end: |