| ... | ... | @@ -148,11 +148,11 @@ pub const DeclState = struct { |
| 148 | 148 | switch (ty.zigTypeTag()) { |
| 149 | 149 | .NoReturn => unreachable, |
| 150 | 150 | .Void => { |
| 151 | | try dbg_info_buffer.append(abbrev_pad1); |
| 151 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.pad1)); |
| 152 | 152 | }, |
| 153 | 153 | .Bool => { |
| 154 | 154 | try dbg_info_buffer.appendSlice(&[_]u8{ |
| 155 | | abbrev_base_type, |
| 155 | @enumToInt(AbbrevKind.base_type), |
| 156 | 156 | DW.ATE.boolean, // DW.AT.encoding , DW.FORM.data1 |
| 157 | 157 | 1, // DW.AT.byte_size, DW.FORM.data1 |
| 158 | 158 | 'b', 'o', 'o', 'l', 0, // DW.AT.name, DW.FORM.string |
| ... | ... | @@ -161,7 +161,7 @@ pub const DeclState = struct { |
| 161 | 161 | .Int => { |
| 162 | 162 | const info = ty.intInfo(target); |
| 163 | 163 | try dbg_info_buffer.ensureUnusedCapacity(12); |
| 164 | | dbg_info_buffer.appendAssumeCapacity(abbrev_base_type); |
| 164 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.base_type)); |
| 165 | 165 | // DW.AT.encoding, DW.FORM.data1 |
| 166 | 166 | dbg_info_buffer.appendAssumeCapacity(switch (info.signedness) { |
| 167 | 167 | .signed => DW.ATE.signed, |
| ... | ... | @@ -175,7 +175,7 @@ pub const DeclState = struct { |
| 175 | 175 | .Optional => { |
| 176 | 176 | if (ty.isPtrLikeOptional()) { |
| 177 | 177 | try dbg_info_buffer.ensureUnusedCapacity(12); |
| 178 | | dbg_info_buffer.appendAssumeCapacity(abbrev_base_type); |
| 178 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.base_type)); |
| 179 | 179 | // DW.AT.encoding, DW.FORM.data1 |
| 180 | 180 | dbg_info_buffer.appendAssumeCapacity(DW.ATE.address); |
| 181 | 181 | // DW.AT.byte_size, DW.FORM.data1 |
| ... | ... | @@ -187,7 +187,7 @@ pub const DeclState = struct { |
| 187 | 187 | var buf = try arena.create(Type.Payload.ElemType); |
| 188 | 188 | const payload_ty = ty.optionalChild(buf); |
| 189 | 189 | // DW.AT.structure_type |
| 190 | | try dbg_info_buffer.append(abbrev_struct_type); |
| 190 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.struct_type)); |
| 191 | 191 | // DW.AT.byte_size, DW.FORM.sdata |
| 192 | 192 | const abi_size = ty.abiSize(target); |
| 193 | 193 | try leb128.writeULEB128(dbg_info_buffer.writer(), abi_size); |
| ... | ... | @@ -195,7 +195,7 @@ pub const DeclState = struct { |
| 195 | 195 | try dbg_info_buffer.writer().print("{}\x00", .{ty.fmt(target)}); |
| 196 | 196 | // DW.AT.member |
| 197 | 197 | try dbg_info_buffer.ensureUnusedCapacity(7); |
| 198 | | dbg_info_buffer.appendAssumeCapacity(abbrev_struct_member); |
| 198 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.struct_member)); |
| 199 | 199 | // DW.AT.name, DW.FORM.string |
| 200 | 200 | dbg_info_buffer.appendSliceAssumeCapacity("maybe"); |
| 201 | 201 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -207,7 +207,7 @@ pub const DeclState = struct { |
| 207 | 207 | try dbg_info_buffer.ensureUnusedCapacity(6); |
| 208 | 208 | dbg_info_buffer.appendAssumeCapacity(0); |
| 209 | 209 | // DW.AT.member |
| 210 | | dbg_info_buffer.appendAssumeCapacity(abbrev_struct_member); |
| 210 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.struct_member)); |
| 211 | 211 | // DW.AT.name, DW.FORM.string |
| 212 | 212 | dbg_info_buffer.appendSliceAssumeCapacity("val"); |
| 213 | 213 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -227,14 +227,14 @@ pub const DeclState = struct { |
| 227 | 227 | // Slices are structs: struct { .ptr = *, .len = N } |
| 228 | 228 | // DW.AT.structure_type |
| 229 | 229 | try dbg_info_buffer.ensureUnusedCapacity(2); |
| 230 | | dbg_info_buffer.appendAssumeCapacity(abbrev_struct_type); |
| 230 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.struct_type)); |
| 231 | 231 | // DW.AT.byte_size, DW.FORM.sdata |
| 232 | 232 | dbg_info_buffer.appendAssumeCapacity(@sizeOf(usize) * 2); |
| 233 | 233 | // DW.AT.name, DW.FORM.string |
| 234 | 234 | try dbg_info_buffer.writer().print("{}\x00", .{ty.fmt(target)}); |
| 235 | 235 | // DW.AT.member |
| 236 | 236 | try dbg_info_buffer.ensureUnusedCapacity(5); |
| 237 | | dbg_info_buffer.appendAssumeCapacity(abbrev_struct_member); |
| 237 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.struct_member)); |
| 238 | 238 | // DW.AT.name, DW.FORM.string |
| 239 | 239 | dbg_info_buffer.appendSliceAssumeCapacity("ptr"); |
| 240 | 240 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -248,7 +248,7 @@ pub const DeclState = struct { |
| 248 | 248 | try dbg_info_buffer.ensureUnusedCapacity(6); |
| 249 | 249 | dbg_info_buffer.appendAssumeCapacity(0); |
| 250 | 250 | // DW.AT.member |
| 251 | | dbg_info_buffer.appendAssumeCapacity(abbrev_struct_member); |
| 251 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.struct_member)); |
| 252 | 252 | // DW.AT.name, DW.FORM.string |
| 253 | 253 | dbg_info_buffer.appendSliceAssumeCapacity("len"); |
| 254 | 254 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -263,7 +263,7 @@ pub const DeclState = struct { |
| 263 | 263 | dbg_info_buffer.appendAssumeCapacity(0); |
| 264 | 264 | } else { |
| 265 | 265 | try dbg_info_buffer.ensureUnusedCapacity(5); |
| 266 | | dbg_info_buffer.appendAssumeCapacity(abbrev_ptr_type); |
| 266 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.ptr_type)); |
| 267 | 267 | // DW.AT.type, DW.FORM.ref4 |
| 268 | 268 | const index = dbg_info_buffer.items.len; |
| 269 | 269 | try dbg_info_buffer.resize(index + 4); |
| ... | ... | @@ -272,7 +272,7 @@ pub const DeclState = struct { |
| 272 | 272 | }, |
| 273 | 273 | .Struct => blk: { |
| 274 | 274 | // DW.AT.structure_type |
| 275 | | try dbg_info_buffer.append(abbrev_struct_type); |
| 275 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.struct_type)); |
| 276 | 276 | // DW.AT.byte_size, DW.FORM.sdata |
| 277 | 277 | const abi_size = ty.abiSize(target); |
| 278 | 278 | try leb128.writeULEB128(dbg_info_buffer.writer(), abi_size); |
| ... | ... | @@ -285,7 +285,7 @@ pub const DeclState = struct { |
| 285 | 285 | const fields = ty.tupleFields(); |
| 286 | 286 | for (fields.types) |field, field_index| { |
| 287 | 287 | // DW.AT.member |
| 288 | | try dbg_info_buffer.append(abbrev_struct_member); |
| 288 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.struct_member)); |
| 289 | 289 | // DW.AT.name, DW.FORM.string |
| 290 | 290 | try dbg_info_buffer.writer().print("{d}\x00", .{field_index}); |
| 291 | 291 | // DW.AT.type, DW.FORM.ref4 |
| ... | ... | @@ -315,7 +315,7 @@ pub const DeclState = struct { |
| 315 | 315 | const field = fields.get(field_name).?; |
| 316 | 316 | // DW.AT.member |
| 317 | 317 | try dbg_info_buffer.ensureUnusedCapacity(field_name.len + 2); |
| 318 | | dbg_info_buffer.appendAssumeCapacity(abbrev_struct_member); |
| 318 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.struct_member)); |
| 319 | 319 | // DW.AT.name, DW.FORM.string |
| 320 | 320 | dbg_info_buffer.appendSliceAssumeCapacity(field_name); |
| 321 | 321 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -335,7 +335,7 @@ pub const DeclState = struct { |
| 335 | 335 | }, |
| 336 | 336 | .Enum => { |
| 337 | 337 | // DW.AT.enumeration_type |
| 338 | | try dbg_info_buffer.append(abbrev_enum_type); |
| 338 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.enum_type)); |
| 339 | 339 | // DW.AT.byte_size, DW.FORM.sdata |
| 340 | 340 | const abi_size = ty.abiSize(target); |
| 341 | 341 | try leb128.writeULEB128(dbg_info_buffer.writer(), abi_size); |
| ... | ... | @@ -355,7 +355,7 @@ pub const DeclState = struct { |
| 355 | 355 | for (fields.keys()) |field_name, field_i| { |
| 356 | 356 | // DW.AT.enumerator |
| 357 | 357 | try dbg_info_buffer.ensureUnusedCapacity(field_name.len + 2 + @sizeOf(u64)); |
| 358 | | dbg_info_buffer.appendAssumeCapacity(abbrev_enum_variant); |
| 358 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.enum_variant)); |
| 359 | 359 | // DW.AT.name, DW.FORM.string |
| 360 | 360 | dbg_info_buffer.appendSliceAssumeCapacity(field_name); |
| 361 | 361 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -385,7 +385,7 @@ pub const DeclState = struct { |
| 385 | 385 | // for untagged unions. |
| 386 | 386 | if (is_tagged) { |
| 387 | 387 | // DW.AT.structure_type |
| 388 | | try dbg_info_buffer.append(abbrev_struct_type); |
| 388 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.struct_type)); |
| 389 | 389 | // DW.AT.byte_size, DW.FORM.sdata |
| 390 | 390 | try leb128.writeULEB128(dbg_info_buffer.writer(), layout.abi_size); |
| 391 | 391 | // DW.AT.name, DW.FORM.string |
| ... | ... | @@ -395,7 +395,7 @@ pub const DeclState = struct { |
| 395 | 395 | |
| 396 | 396 | // DW.AT.member |
| 397 | 397 | try dbg_info_buffer.ensureUnusedCapacity(9); |
| 398 | | dbg_info_buffer.appendAssumeCapacity(abbrev_struct_member); |
| 398 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.struct_member)); |
| 399 | 399 | // DW.AT.name, DW.FORM.string |
| 400 | 400 | dbg_info_buffer.appendSliceAssumeCapacity("payload"); |
| 401 | 401 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -408,7 +408,7 @@ pub const DeclState = struct { |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | // DW.AT.union_type |
| 411 | | try dbg_info_buffer.append(abbrev_union_type); |
| 411 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.union_type)); |
| 412 | 412 | // DW.AT.byte_size, DW.FORM.sdata, |
| 413 | 413 | try leb128.writeULEB128(dbg_info_buffer.writer(), layout.payload_size); |
| 414 | 414 | // DW.AT.name, DW.FORM.string |
| ... | ... | @@ -423,7 +423,7 @@ pub const DeclState = struct { |
| 423 | 423 | const field = fields.get(field_name).?; |
| 424 | 424 | if (!field.ty.hasRuntimeBits()) continue; |
| 425 | 425 | // DW.AT.member |
| 426 | | try dbg_info_buffer.append(abbrev_struct_member); |
| 426 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.struct_member)); |
| 427 | 427 | // DW.AT.name, DW.FORM.string |
| 428 | 428 | try dbg_info_buffer.writer().print("{s}\x00", .{field_name}); |
| 429 | 429 | // DW.AT.type, DW.FORM.ref4 |
| ... | ... | @@ -439,7 +439,7 @@ pub const DeclState = struct { |
| 439 | 439 | if (is_tagged) { |
| 440 | 440 | // DW.AT.member |
| 441 | 441 | try dbg_info_buffer.ensureUnusedCapacity(5); |
| 442 | | dbg_info_buffer.appendAssumeCapacity(abbrev_struct_member); |
| 442 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.struct_member)); |
| 443 | 443 | // DW.AT.name, DW.FORM.string |
| 444 | 444 | dbg_info_buffer.appendSliceAssumeCapacity("tag"); |
| 445 | 445 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -471,7 +471,7 @@ pub const DeclState = struct { |
| 471 | 471 | const payload_off = mem.alignForwardGeneric(u64, error_ty.abiSize(target), abi_align); |
| 472 | 472 | |
| 473 | 473 | // DW.AT.structure_type |
| 474 | | try dbg_info_buffer.append(abbrev_struct_type); |
| 474 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.struct_type)); |
| 475 | 475 | // DW.AT.byte_size, DW.FORM.sdata |
| 476 | 476 | try leb128.writeULEB128(dbg_info_buffer.writer(), abi_size); |
| 477 | 477 | // DW.AT.name, DW.FORM.string |
| ... | ... | @@ -480,7 +480,7 @@ pub const DeclState = struct { |
| 480 | 480 | |
| 481 | 481 | // DW.AT.member |
| 482 | 482 | try dbg_info_buffer.ensureUnusedCapacity(7); |
| 483 | | dbg_info_buffer.appendAssumeCapacity(abbrev_struct_member); |
| 483 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.struct_member)); |
| 484 | 484 | // DW.AT.name, DW.FORM.string |
| 485 | 485 | dbg_info_buffer.appendSliceAssumeCapacity("value"); |
| 486 | 486 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -493,7 +493,7 @@ pub const DeclState = struct { |
| 493 | 493 | |
| 494 | 494 | // DW.AT.member |
| 495 | 495 | try dbg_info_buffer.ensureUnusedCapacity(5); |
| 496 | | dbg_info_buffer.appendAssumeCapacity(abbrev_struct_member); |
| 496 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.struct_member)); |
| 497 | 497 | // DW.AT.name, DW.FORM.string |
| 498 | 498 | dbg_info_buffer.appendSliceAssumeCapacity("err"); |
| 499 | 499 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -509,7 +509,7 @@ pub const DeclState = struct { |
| 509 | 509 | }, |
| 510 | 510 | else => { |
| 511 | 511 | log.debug("TODO implement .debug_info for type '{}'", .{ty.fmtDebug()}); |
| 512 | | try dbg_info_buffer.append(abbrev_pad1); |
| 512 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.pad1)); |
| 513 | 513 | }, |
| 514 | 514 | } |
| 515 | 515 | } |
| ... | ... | @@ -550,18 +550,21 @@ pub const SrcFn = struct { |
| 550 | 550 | |
| 551 | 551 | pub const PtrWidth = enum { p32, p64 }; |
| 552 | 552 | |
| 553 | | pub const abbrev_compile_unit = 1; |
| 554 | | pub const abbrev_subprogram = 2; |
| 555 | | pub const abbrev_subprogram_retvoid = 3; |
| 556 | | pub const abbrev_base_type = 4; |
| 557 | | pub const abbrev_ptr_type = 5; |
| 558 | | pub const abbrev_struct_type = 6; |
| 559 | | pub const abbrev_struct_member = 7; |
| 560 | | pub const abbrev_enum_type = 8; |
| 561 | | pub const abbrev_enum_variant = 9; |
| 562 | | pub const abbrev_union_type = 10; |
| 563 | | pub const abbrev_pad1 = 11; |
| 564 | | pub const abbrev_parameter = 12; |
| 553 | pub const AbbrevKind = enum(u8) { |
| 554 | compile_unit = 1, |
| 555 | subprogram, |
| 556 | subprogram_retvoid, |
| 557 | base_type, |
| 558 | ptr_type, |
| 559 | struct_type, |
| 560 | struct_member, |
| 561 | enum_type, |
| 562 | enum_variant, |
| 563 | union_type, |
| 564 | pad1, |
| 565 | parameter, |
| 566 | variable, |
| 567 | }; |
| 565 | 568 | |
| 566 | 569 | /// The reloc offset for the virtual address of a function in its Line Number Program. |
| 567 | 570 | /// Size is a virtual address integer. |
| ... | ... | @@ -670,9 +673,9 @@ pub fn initDeclState(self: *Dwarf, decl: *Module.Decl) !DeclState { |
| 670 | 673 | const fn_ret_type = decl.ty.fnReturnType(); |
| 671 | 674 | const fn_ret_has_bits = fn_ret_type.hasRuntimeBits(); |
| 672 | 675 | if (fn_ret_has_bits) { |
| 673 | | dbg_info_buffer.appendAssumeCapacity(abbrev_subprogram); |
| 676 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.subprogram)); |
| 674 | 677 | } else { |
| 675 | | dbg_info_buffer.appendAssumeCapacity(abbrev_subprogram_retvoid); |
| 678 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.subprogram_retvoid)); |
| 676 | 679 | } |
| 677 | 680 | // These get overwritten after generating the machine code. These values are |
| 678 | 681 | // "relocations" and have to be in this fixed place so that functions can be |
| ... | ... | @@ -926,7 +929,7 @@ pub fn commitDeclState( |
| 926 | 929 | else => unreachable, |
| 927 | 930 | }; |
| 928 | 931 | |
| 929 | | { |
| 932 | if (decl_state.abbrev_table.items.len > 0) { |
| 930 | 933 | // Now we emit the .debug_info types of the Decl. These will count towards the size of |
| 931 | 934 | // the buffer, so we have to do it before computing the offset, and we can't perform the actual |
| 932 | 935 | // relocations yet. |
| ... | ... | @@ -1244,14 +1247,14 @@ pub fn writeDbgAbbrev(self: *Dwarf, file: *File) !void { |
| 1244 | 1247 | // These are LEB encoded but since the values are all less than 127 |
| 1245 | 1248 | // we can simply append these bytes. |
| 1246 | 1249 | const abbrev_buf = [_]u8{ |
| 1247 | | abbrev_compile_unit, DW.TAG.compile_unit, DW.CHILDREN.yes, // header |
| 1248 | | DW.AT.stmt_list, DW.FORM.sec_offset, DW.AT.low_pc, |
| 1249 | | DW.FORM.addr, DW.AT.high_pc, DW.FORM.addr, |
| 1250 | | DW.AT.name, DW.FORM.strp, DW.AT.comp_dir, |
| 1251 | | DW.FORM.strp, DW.AT.producer, DW.FORM.strp, |
| 1252 | | DW.AT.language, DW.FORM.data2, 0, |
| 1250 | @enumToInt(AbbrevKind.compile_unit), DW.TAG.compile_unit, DW.CHILDREN.yes, // header |
| 1251 | DW.AT.stmt_list, DW.FORM.sec_offset, DW.AT.low_pc, |
| 1252 | DW.FORM.addr, DW.AT.high_pc, DW.FORM.addr, |
| 1253 | DW.AT.name, DW.FORM.strp, DW.AT.comp_dir, |
| 1254 | DW.FORM.strp, DW.AT.producer, DW.FORM.strp, |
| 1255 | DW.AT.language, DW.FORM.data2, 0, |
| 1253 | 1256 | 0, // table sentinel |
| 1254 | | abbrev_subprogram, |
| 1257 | @enumToInt(AbbrevKind.subprogram), |
| 1255 | 1258 | DW.TAG.subprogram, |
| 1256 | 1259 | DW.CHILDREN.yes, // header |
| 1257 | 1260 | DW.AT.low_pc, |
| ... | ... | @@ -1262,15 +1265,15 @@ pub fn writeDbgAbbrev(self: *Dwarf, file: *File) !void { |
| 1262 | 1265 | DW.FORM.ref4, |
| 1263 | 1266 | DW.AT.name, |
| 1264 | 1267 | DW.FORM.string, |
| 1265 | | 0, 0, // table sentinel |
| 1266 | | abbrev_subprogram_retvoid, |
| 1268 | 0, 0, // table sentinel |
| 1269 | @enumToInt(AbbrevKind.subprogram_retvoid), |
| 1267 | 1270 | DW.TAG.subprogram, DW.CHILDREN.yes, // header |
| 1268 | 1271 | DW.AT.low_pc, DW.FORM.addr, |
| 1269 | 1272 | DW.AT.high_pc, DW.FORM.data4, |
| 1270 | 1273 | DW.AT.name, DW.FORM.string, |
| 1271 | 1274 | 0, |
| 1272 | 1275 | 0, // table sentinel |
| 1273 | | abbrev_base_type, |
| 1276 | @enumToInt(AbbrevKind.base_type), |
| 1274 | 1277 | DW.TAG.base_type, |
| 1275 | 1278 | DW.CHILDREN.no, // header |
| 1276 | 1279 | DW.AT.encoding, |
| ... | ... | @@ -1281,14 +1284,14 @@ pub fn writeDbgAbbrev(self: *Dwarf, file: *File) !void { |
| 1281 | 1284 | DW.FORM.string, |
| 1282 | 1285 | 0, |
| 1283 | 1286 | 0, // table sentinel |
| 1284 | | abbrev_ptr_type, |
| 1287 | @enumToInt(AbbrevKind.ptr_type), |
| 1285 | 1288 | DW.TAG.pointer_type, |
| 1286 | 1289 | DW.CHILDREN.no, // header |
| 1287 | 1290 | DW.AT.type, |
| 1288 | 1291 | DW.FORM.ref4, |
| 1289 | 1292 | 0, |
| 1290 | 1293 | 0, // table sentinel |
| 1291 | | abbrev_struct_type, |
| 1294 | @enumToInt(AbbrevKind.struct_type), |
| 1292 | 1295 | DW.TAG.structure_type, |
| 1293 | 1296 | DW.CHILDREN.yes, // header |
| 1294 | 1297 | DW.AT.byte_size, |
| ... | ... | @@ -1297,7 +1300,7 @@ pub fn writeDbgAbbrev(self: *Dwarf, file: *File) !void { |
| 1297 | 1300 | DW.FORM.string, |
| 1298 | 1301 | 0, |
| 1299 | 1302 | 0, // table sentinel |
| 1300 | | abbrev_struct_member, |
| 1303 | @enumToInt(AbbrevKind.struct_member), |
| 1301 | 1304 | DW.TAG.member, |
| 1302 | 1305 | DW.CHILDREN.no, // header |
| 1303 | 1306 | DW.AT.name, |
| ... | ... | @@ -1308,7 +1311,7 @@ pub fn writeDbgAbbrev(self: *Dwarf, file: *File) !void { |
| 1308 | 1311 | DW.FORM.sdata, |
| 1309 | 1312 | 0, |
| 1310 | 1313 | 0, // table sentinel |
| 1311 | | abbrev_enum_type, |
| 1314 | @enumToInt(AbbrevKind.enum_type), |
| 1312 | 1315 | DW.TAG.enumeration_type, |
| 1313 | 1316 | DW.CHILDREN.yes, // header |
| 1314 | 1317 | DW.AT.byte_size, |
| ... | ... | @@ -1317,7 +1320,7 @@ pub fn writeDbgAbbrev(self: *Dwarf, file: *File) !void { |
| 1317 | 1320 | DW.FORM.string, |
| 1318 | 1321 | 0, |
| 1319 | 1322 | 0, // table sentinel |
| 1320 | | abbrev_enum_variant, |
| 1323 | @enumToInt(AbbrevKind.enum_variant), |
| 1321 | 1324 | DW.TAG.enumerator, |
| 1322 | 1325 | DW.CHILDREN.no, // header |
| 1323 | 1326 | DW.AT.name, |
| ... | ... | @@ -1326,7 +1329,7 @@ pub fn writeDbgAbbrev(self: *Dwarf, file: *File) !void { |
| 1326 | 1329 | DW.FORM.data8, |
| 1327 | 1330 | 0, |
| 1328 | 1331 | 0, // table sentinel |
| 1329 | | abbrev_union_type, |
| 1332 | @enumToInt(AbbrevKind.union_type), |
| 1330 | 1333 | DW.TAG.union_type, |
| 1331 | 1334 | DW.CHILDREN.yes, // header |
| 1332 | 1335 | DW.AT.byte_size, |
| ... | ... | @@ -1335,18 +1338,25 @@ pub fn writeDbgAbbrev(self: *Dwarf, file: *File) !void { |
| 1335 | 1338 | DW.FORM.string, |
| 1336 | 1339 | 0, |
| 1337 | 1340 | 0, // table sentinel |
| 1338 | | abbrev_pad1, |
| 1341 | @enumToInt(AbbrevKind.pad1), |
| 1339 | 1342 | DW.TAG.unspecified_type, |
| 1340 | 1343 | DW.CHILDREN.no, // header |
| 1341 | 1344 | 0, |
| 1342 | 1345 | 0, // table sentinel |
| 1343 | | abbrev_parameter, |
| 1346 | @enumToInt(AbbrevKind.parameter), |
| 1344 | 1347 | DW.TAG.formal_parameter, DW.CHILDREN.no, // header |
| 1345 | 1348 | DW.AT.location, DW.FORM.exprloc, |
| 1346 | 1349 | DW.AT.type, DW.FORM.ref4, |
| 1347 | 1350 | DW.AT.name, DW.FORM.string, |
| 1348 | 1351 | 0, |
| 1349 | 1352 | 0, // table sentinel |
| 1353 | @enumToInt(AbbrevKind.variable), |
| 1354 | DW.TAG.variable, DW.CHILDREN.no, // header |
| 1355 | DW.AT.location, DW.FORM.exprloc, |
| 1356 | DW.AT.type, DW.FORM.ref4, |
| 1357 | DW.AT.name, DW.FORM.string, |
| 1358 | 0, |
| 1359 | 0, // table sentinel |
| 1350 | 1360 | 0, |
| 1351 | 1361 | 0, |
| 1352 | 1362 | 0, // section sentinel |
| ... | ... | @@ -1459,7 +1469,7 @@ pub fn writeDbgInfoHeader(self: *Dwarf, file: *File, module: *Module, low_pc: u6 |
| 1459 | 1469 | const comp_dir_strp = try self.makeString(module.root_pkg.root_src_directory.path orelse "."); |
| 1460 | 1470 | const producer_strp = try self.makeString(link.producer_string); |
| 1461 | 1471 | |
| 1462 | | di_buf.appendAssumeCapacity(abbrev_compile_unit); |
| 1472 | di_buf.appendAssumeCapacity(@enumToInt(AbbrevKind.compile_unit)); |
| 1463 | 1473 | if (self.tag == .macho) { |
| 1464 | 1474 | mem.writeIntLittle(u32, di_buf.addManyAsArrayAssumeCapacity(4), 0); // DW.AT.stmt_list, DW.FORM.sec_offset |
| 1465 | 1475 | mem.writeIntLittle(u64, di_buf.addManyAsArrayAssumeCapacity(8), low_pc); |
| ... | ... | @@ -1606,7 +1616,7 @@ fn pwriteDbgInfoNops( |
| 1606 | 1616 | const tracy = trace(@src()); |
| 1607 | 1617 | defer tracy.end(); |
| 1608 | 1618 | |
| 1609 | | const page_of_nops = [1]u8{abbrev_pad1} ** 4096; |
| 1619 | const page_of_nops = [1]u8{@enumToInt(AbbrevKind.pad1)} ** 4096; |
| 1610 | 1620 | var vecs: [32]std.os.iovec_const = undefined; |
| 1611 | 1621 | var vec_index: usize = 0; |
| 1612 | 1622 | { |
| ... | ... | @@ -1673,7 +1683,7 @@ pub fn writeDbgAranges(self: *Dwarf, file: *File, addr: u64, size: u64) !void { |
| 1673 | 1683 | .p32 => @as(usize, 4), |
| 1674 | 1684 | .p64 => 12, |
| 1675 | 1685 | }; |
| 1676 | | const ptr_width_bytes: u8 = self.ptrWidthBytes(); |
| 1686 | const ptr_width_bytes = self.ptrWidthBytes(); |
| 1677 | 1687 | |
| 1678 | 1688 | // Enough for all the data without resizing. When support for more compilation units |
| 1679 | 1689 | // is added, the size of this section will become more variable. |
| ... | ... | @@ -2040,7 +2050,7 @@ fn addDbgInfoErrorSet( |
| 2040 | 2050 | const target_endian = target.cpu.arch.endian(); |
| 2041 | 2051 | |
| 2042 | 2052 | // DW.AT.enumeration_type |
| 2043 | | try dbg_info_buffer.append(abbrev_enum_type); |
| 2053 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.enum_type)); |
| 2044 | 2054 | // DW.AT.byte_size, DW.FORM.sdata |
| 2045 | 2055 | const abi_size = ty.abiSize(target); |
| 2046 | 2056 | try leb128.writeULEB128(dbg_info_buffer.writer(), abi_size); |
| ... | ... | @@ -2051,7 +2061,7 @@ fn addDbgInfoErrorSet( |
| 2051 | 2061 | // DW.AT.enumerator |
| 2052 | 2062 | const no_error = "(no error)"; |
| 2053 | 2063 | try dbg_info_buffer.ensureUnusedCapacity(no_error.len + 2 + @sizeOf(u64)); |
| 2054 | | dbg_info_buffer.appendAssumeCapacity(abbrev_enum_variant); |
| 2064 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.enum_variant)); |
| 2055 | 2065 | // DW.AT.name, DW.FORM.string |
| 2056 | 2066 | dbg_info_buffer.appendSliceAssumeCapacity(no_error); |
| 2057 | 2067 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -2063,7 +2073,7 @@ fn addDbgInfoErrorSet( |
| 2063 | 2073 | const kv = module.getErrorValue(error_name) catch unreachable; |
| 2064 | 2074 | // DW.AT.enumerator |
| 2065 | 2075 | try dbg_info_buffer.ensureUnusedCapacity(error_name.len + 2 + @sizeOf(u64)); |
| 2066 | | dbg_info_buffer.appendAssumeCapacity(abbrev_enum_variant); |
| 2076 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.enum_variant)); |
| 2067 | 2077 | // DW.AT.name, DW.FORM.string |
| 2068 | 2078 | dbg_info_buffer.appendSliceAssumeCapacity(error_name); |
| 2069 | 2079 | dbg_info_buffer.appendAssumeCapacity(0); |