| ... | ... | @@ -140,11 +140,11 @@ pub const DeclState = struct { |
| 140 | 140 | switch (ty.zigTypeTag(mod)) { |
| 141 | 141 | .NoReturn => unreachable, |
| 142 | 142 | .Void => { |
| 143 | | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.pad1)); |
| 143 | try dbg_info_buffer.append(@intFromEnum(AbbrevCode.zero_bit_type)); |
| 144 | 144 | }, |
| 145 | 145 | .Bool => { |
| 146 | 146 | try dbg_info_buffer.ensureUnusedCapacity(12); |
| 147 | | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.base_type)); |
| 147 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevCode.base_type)); |
| 148 | 148 | // DW.AT.encoding, DW.FORM.data1 |
| 149 | 149 | dbg_info_buffer.appendAssumeCapacity(DW.ATE.boolean); |
| 150 | 150 | // DW.AT.byte_size, DW.FORM.udata |
| ... | ... | @@ -155,7 +155,7 @@ pub const DeclState = struct { |
| 155 | 155 | .Int => { |
| 156 | 156 | const info = ty.intInfo(mod); |
| 157 | 157 | try dbg_info_buffer.ensureUnusedCapacity(12); |
| 158 | | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.base_type)); |
| 158 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevCode.base_type)); |
| 159 | 159 | // DW.AT.encoding, DW.FORM.data1 |
| 160 | 160 | dbg_info_buffer.appendAssumeCapacity(switch (info.signedness) { |
| 161 | 161 | .signed => DW.ATE.signed, |
| ... | ... | @@ -169,7 +169,7 @@ pub const DeclState = struct { |
| 169 | 169 | .Optional => { |
| 170 | 170 | if (ty.isPtrLikeOptional(mod)) { |
| 171 | 171 | try dbg_info_buffer.ensureUnusedCapacity(12); |
| 172 | | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.base_type)); |
| 172 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevCode.base_type)); |
| 173 | 173 | // DW.AT.encoding, DW.FORM.data1 |
| 174 | 174 | dbg_info_buffer.appendAssumeCapacity(DW.ATE.address); |
| 175 | 175 | // DW.AT.byte_size, DW.FORM.udata |
| ... | ... | @@ -180,7 +180,7 @@ pub const DeclState = struct { |
| 180 | 180 | // Non-pointer optionals are structs: struct { .maybe = *, .val = * } |
| 181 | 181 | const payload_ty = ty.optionalChild(mod); |
| 182 | 182 | // DW.AT.structure_type |
| 183 | | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.struct_type)); |
| 183 | try dbg_info_buffer.append(@intFromEnum(AbbrevCode.struct_type)); |
| 184 | 184 | // DW.AT.byte_size, DW.FORM.udata |
| 185 | 185 | const abi_size = ty.abiSize(mod); |
| 186 | 186 | try leb128.writeULEB128(dbg_info_buffer.writer(), abi_size); |
| ... | ... | @@ -188,7 +188,7 @@ pub const DeclState = struct { |
| 188 | 188 | try dbg_info_buffer.writer().print("{}\x00", .{ty.fmt(mod)}); |
| 189 | 189 | // DW.AT.member |
| 190 | 190 | try dbg_info_buffer.ensureUnusedCapacity(7); |
| 191 | | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.struct_member)); |
| 191 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevCode.struct_member)); |
| 192 | 192 | // DW.AT.name, DW.FORM.string |
| 193 | 193 | dbg_info_buffer.appendSliceAssumeCapacity("maybe"); |
| 194 | 194 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -200,7 +200,7 @@ pub const DeclState = struct { |
| 200 | 200 | try dbg_info_buffer.ensureUnusedCapacity(6); |
| 201 | 201 | dbg_info_buffer.appendAssumeCapacity(0); |
| 202 | 202 | // DW.AT.member |
| 203 | | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.struct_member)); |
| 203 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevCode.struct_member)); |
| 204 | 204 | // DW.AT.name, DW.FORM.string |
| 205 | 205 | dbg_info_buffer.appendSliceAssumeCapacity("val"); |
| 206 | 206 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -222,14 +222,14 @@ pub const DeclState = struct { |
| 222 | 222 | const ptr_bytes: u8 = @intCast(@divExact(ptr_bits, 8)); |
| 223 | 223 | // DW.AT.structure_type |
| 224 | 224 | try dbg_info_buffer.ensureUnusedCapacity(2); |
| 225 | | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.struct_type)); |
| 225 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevCode.struct_type)); |
| 226 | 226 | // DW.AT.byte_size, DW.FORM.udata |
| 227 | 227 | try leb128.writeULEB128(dbg_info_buffer.writer(), ty.abiSize(mod)); |
| 228 | 228 | // DW.AT.name, DW.FORM.string |
| 229 | 229 | try dbg_info_buffer.writer().print("{}\x00", .{ty.fmt(mod)}); |
| 230 | 230 | // DW.AT.member |
| 231 | 231 | try dbg_info_buffer.ensureUnusedCapacity(5); |
| 232 | | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.struct_member)); |
| 232 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevCode.struct_member)); |
| 233 | 233 | // DW.AT.name, DW.FORM.string |
| 234 | 234 | dbg_info_buffer.appendSliceAssumeCapacity("ptr"); |
| 235 | 235 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -242,7 +242,7 @@ pub const DeclState = struct { |
| 242 | 242 | try dbg_info_buffer.ensureUnusedCapacity(6); |
| 243 | 243 | dbg_info_buffer.appendAssumeCapacity(0); |
| 244 | 244 | // DW.AT.member |
| 245 | | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.struct_member)); |
| 245 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevCode.struct_member)); |
| 246 | 246 | // DW.AT.name, DW.FORM.string |
| 247 | 247 | dbg_info_buffer.appendSliceAssumeCapacity("len"); |
| 248 | 248 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -257,7 +257,7 @@ pub const DeclState = struct { |
| 257 | 257 | dbg_info_buffer.appendAssumeCapacity(0); |
| 258 | 258 | } else { |
| 259 | 259 | try dbg_info_buffer.ensureUnusedCapacity(5); |
| 260 | | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.ptr_type)); |
| 260 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevCode.ptr_type)); |
| 261 | 261 | // DW.AT.type, DW.FORM.ref4 |
| 262 | 262 | const index = dbg_info_buffer.items.len; |
| 263 | 263 | try dbg_info_buffer.resize(index + 4); |
| ... | ... | @@ -266,7 +266,7 @@ pub const DeclState = struct { |
| 266 | 266 | }, |
| 267 | 267 | .Array => { |
| 268 | 268 | // DW.AT.array_type |
| 269 | | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.array_type)); |
| 269 | try dbg_info_buffer.append(@intFromEnum(AbbrevCode.array_type)); |
| 270 | 270 | // DW.AT.name, DW.FORM.string |
| 271 | 271 | try dbg_info_buffer.writer().print("{}\x00", .{ty.fmt(mod)}); |
| 272 | 272 | // DW.AT.type, DW.FORM.ref4 |
| ... | ... | @@ -274,7 +274,7 @@ pub const DeclState = struct { |
| 274 | 274 | try dbg_info_buffer.resize(index + 4); |
| 275 | 275 | try self.addTypeRelocGlobal(atom_index, ty.childType(mod), @intCast(index)); |
| 276 | 276 | // DW.AT.subrange_type |
| 277 | | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.array_dim)); |
| 277 | try dbg_info_buffer.append(@intFromEnum(AbbrevCode.array_dim)); |
| 278 | 278 | // DW.AT.type, DW.FORM.ref4 |
| 279 | 279 | index = dbg_info_buffer.items.len; |
| 280 | 280 | try dbg_info_buffer.resize(index + 4); |
| ... | ... | @@ -287,7 +287,7 @@ pub const DeclState = struct { |
| 287 | 287 | }, |
| 288 | 288 | .Struct => { |
| 289 | 289 | // DW.AT.structure_type |
| 290 | | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.struct_type)); |
| 290 | try dbg_info_buffer.append(@intFromEnum(AbbrevCode.struct_type)); |
| 291 | 291 | // DW.AT.byte_size, DW.FORM.udata |
| 292 | 292 | try leb128.writeULEB128(dbg_info_buffer.writer(), ty.abiSize(mod)); |
| 293 | 293 | |
| ... | ... | @@ -299,7 +299,7 @@ pub const DeclState = struct { |
| 299 | 299 | |
| 300 | 300 | for (fields.types.get(ip), 0..) |field_ty, field_index| { |
| 301 | 301 | // DW.AT.member |
| 302 | | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.struct_member)); |
| 302 | try dbg_info_buffer.append(@intFromEnum(AbbrevCode.struct_member)); |
| 303 | 303 | // DW.AT.name, DW.FORM.string |
| 304 | 304 | try dbg_info_buffer.writer().print("{d}\x00", .{field_index}); |
| 305 | 305 | // DW.AT.type, DW.FORM.ref4 |
| ... | ... | @@ -325,7 +325,7 @@ pub const DeclState = struct { |
| 325 | 325 | for (struct_type.field_types.get(ip), struct_type.offsets.get(ip), 0..) |field_ty, field_off, field_index| { |
| 326 | 326 | if (!Type.fromInterned(field_ty).hasRuntimeBits(mod)) continue; |
| 327 | 327 | // DW.AT.member |
| 328 | | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.struct_member)); |
| 328 | try dbg_info_buffer.append(@intFromEnum(AbbrevCode.struct_member)); |
| 329 | 329 | // DW.AT.name, DW.FORM.string |
| 330 | 330 | try dbg_info_buffer.writer().print("{d}\x00", .{field_index}); |
| 331 | 331 | // DW.AT.type, DW.FORM.ref4 |
| ... | ... | @@ -345,7 +345,7 @@ pub const DeclState = struct { |
| 345 | 345 | const field_name = ip.stringToSlice(field_name_ip); |
| 346 | 346 | // DW.AT.member |
| 347 | 347 | try dbg_info_buffer.ensureUnusedCapacity(field_name.len + 2); |
| 348 | | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.struct_member)); |
| 348 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevCode.struct_member)); |
| 349 | 349 | // DW.AT.name, DW.FORM.string |
| 350 | 350 | dbg_info_buffer.appendSliceAssumeCapacity(field_name); |
| 351 | 351 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -367,7 +367,7 @@ pub const DeclState = struct { |
| 367 | 367 | }, |
| 368 | 368 | .Enum => { |
| 369 | 369 | // DW.AT.enumeration_type |
| 370 | | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.enum_type)); |
| 370 | try dbg_info_buffer.append(@intFromEnum(AbbrevCode.enum_type)); |
| 371 | 371 | // DW.AT.byte_size, DW.FORM.udata |
| 372 | 372 | try leb128.writeULEB128(dbg_info_buffer.writer(), ty.abiSize(mod)); |
| 373 | 373 | // DW.AT.name, DW.FORM.string |
| ... | ... | @@ -379,7 +379,7 @@ pub const DeclState = struct { |
| 379 | 379 | const field_name = ip.stringToSlice(field_name_index); |
| 380 | 380 | // DW.AT.enumerator |
| 381 | 381 | try dbg_info_buffer.ensureUnusedCapacity(field_name.len + 2 + @sizeOf(u64)); |
| 382 | | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.enum_variant)); |
| 382 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevCode.enum_variant)); |
| 383 | 383 | // DW.AT.name, DW.FORM.string |
| 384 | 384 | dbg_info_buffer.appendSliceAssumeCapacity(field_name); |
| 385 | 385 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -409,7 +409,7 @@ pub const DeclState = struct { |
| 409 | 409 | const is_tagged = layout.tag_size > 0; |
| 410 | 410 | if (is_tagged) { |
| 411 | 411 | // DW.AT.structure_type |
| 412 | | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.struct_type)); |
| 412 | try dbg_info_buffer.append(@intFromEnum(AbbrevCode.struct_type)); |
| 413 | 413 | // DW.AT.byte_size, DW.FORM.udata |
| 414 | 414 | try leb128.writeULEB128(dbg_info_buffer.writer(), layout.abi_size); |
| 415 | 415 | // DW.AT.name, DW.FORM.string |
| ... | ... | @@ -418,7 +418,7 @@ pub const DeclState = struct { |
| 418 | 418 | |
| 419 | 419 | // DW.AT.member |
| 420 | 420 | try dbg_info_buffer.ensureUnusedCapacity(9); |
| 421 | | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.struct_member)); |
| 421 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevCode.struct_member)); |
| 422 | 422 | // DW.AT.name, DW.FORM.string |
| 423 | 423 | dbg_info_buffer.appendSliceAssumeCapacity("payload"); |
| 424 | 424 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -431,7 +431,7 @@ pub const DeclState = struct { |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | // DW.AT.union_type |
| 434 | | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.union_type)); |
| 434 | try dbg_info_buffer.append(@intFromEnum(AbbrevCode.union_type)); |
| 435 | 435 | // DW.AT.byte_size, DW.FORM.udata, |
| 436 | 436 | try leb128.writeULEB128(dbg_info_buffer.writer(), layout.payload_size); |
| 437 | 437 | // DW.AT.name, DW.FORM.string |
| ... | ... | @@ -445,7 +445,7 @@ pub const DeclState = struct { |
| 445 | 445 | for (union_obj.field_types.get(ip), union_obj.field_names.get(ip)) |field_ty, field_name| { |
| 446 | 446 | if (!Type.fromInterned(field_ty).hasRuntimeBits(mod)) continue; |
| 447 | 447 | // DW.AT.member |
| 448 | | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.struct_member)); |
| 448 | try dbg_info_buffer.append(@intFromEnum(AbbrevCode.struct_member)); |
| 449 | 449 | // DW.AT.name, DW.FORM.string |
| 450 | 450 | try dbg_info_buffer.appendSlice(ip.stringToSlice(field_name)); |
| 451 | 451 | try dbg_info_buffer.append(0); |
| ... | ... | @@ -462,7 +462,7 @@ pub const DeclState = struct { |
| 462 | 462 | if (is_tagged) { |
| 463 | 463 | // DW.AT.member |
| 464 | 464 | try dbg_info_buffer.ensureUnusedCapacity(5); |
| 465 | | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.struct_member)); |
| 465 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevCode.struct_member)); |
| 466 | 466 | // DW.AT.name, DW.FORM.string |
| 467 | 467 | dbg_info_buffer.appendSliceAssumeCapacity("tag"); |
| 468 | 468 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -488,7 +488,7 @@ pub const DeclState = struct { |
| 488 | 488 | const error_off = if (error_align.compare(.gte, payload_align)) 0 else payload_ty.abiSize(mod); |
| 489 | 489 | |
| 490 | 490 | // DW.AT.structure_type |
| 491 | | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.struct_type)); |
| 491 | try dbg_info_buffer.append(@intFromEnum(AbbrevCode.struct_type)); |
| 492 | 492 | // DW.AT.byte_size, DW.FORM.udata |
| 493 | 493 | try leb128.writeULEB128(dbg_info_buffer.writer(), abi_size); |
| 494 | 494 | // DW.AT.name, DW.FORM.string |
| ... | ... | @@ -498,7 +498,7 @@ pub const DeclState = struct { |
| 498 | 498 | if (!payload_ty.isNoReturn(mod)) { |
| 499 | 499 | // DW.AT.member |
| 500 | 500 | try dbg_info_buffer.ensureUnusedCapacity(7); |
| 501 | | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.struct_member)); |
| 501 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevCode.struct_member)); |
| 502 | 502 | // DW.AT.name, DW.FORM.string |
| 503 | 503 | dbg_info_buffer.appendSliceAssumeCapacity("value"); |
| 504 | 504 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -513,7 +513,7 @@ pub const DeclState = struct { |
| 513 | 513 | { |
| 514 | 514 | // DW.AT.member |
| 515 | 515 | try dbg_info_buffer.ensureUnusedCapacity(5); |
| 516 | | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.struct_member)); |
| 516 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevCode.struct_member)); |
| 517 | 517 | // DW.AT.name, DW.FORM.string |
| 518 | 518 | dbg_info_buffer.appendSliceAssumeCapacity("err"); |
| 519 | 519 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -530,7 +530,7 @@ pub const DeclState = struct { |
| 530 | 530 | }, |
| 531 | 531 | else => { |
| 532 | 532 | log.debug("TODO implement .debug_info for type '{}'", .{ty.fmt(self.mod)}); |
| 533 | | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.pad1)); |
| 533 | try dbg_info_buffer.append(@intFromEnum(AbbrevCode.zero_bit_type)); |
| 534 | 534 | }, |
| 535 | 535 | } |
| 536 | 536 | } |
| ... | ... | @@ -565,7 +565,7 @@ pub const DeclState = struct { |
| 565 | 565 | switch (loc) { |
| 566 | 566 | .register => |reg| { |
| 567 | 567 | try dbg_info.ensureUnusedCapacity(4); |
| 568 | | dbg_info.appendAssumeCapacity(@intFromEnum(AbbrevKind.parameter)); |
| 568 | dbg_info.appendAssumeCapacity(@intFromEnum(AbbrevCode.parameter)); |
| 569 | 569 | // DW.AT.location, DW.FORM.exprloc |
| 570 | 570 | var expr_len = std.io.countingWriter(std.io.null_writer); |
| 571 | 571 | if (reg < 32) { |
| ... | ... | @@ -587,7 +587,7 @@ pub const DeclState = struct { |
| 587 | 587 | const reg_bytes: u8 = @intCast(@divExact(reg_bits, 8)); |
| 588 | 588 | const abi_size = ty.abiSize(self.mod); |
| 589 | 589 | try dbg_info.ensureUnusedCapacity(10); |
| 590 | | dbg_info.appendAssumeCapacity(@intFromEnum(AbbrevKind.parameter)); |
| 590 | dbg_info.appendAssumeCapacity(@intFromEnum(AbbrevCode.parameter)); |
| 591 | 591 | // DW.AT.location, DW.FORM.exprloc |
| 592 | 592 | var expr_len = std.io.countingWriter(std.io.null_writer); |
| 593 | 593 | for (regs, 0..) |reg, reg_i| { |
| ... | ... | @@ -620,7 +620,7 @@ pub const DeclState = struct { |
| 620 | 620 | }, |
| 621 | 621 | .stack => |info| { |
| 622 | 622 | try dbg_info.ensureUnusedCapacity(9); |
| 623 | | dbg_info.appendAssumeCapacity(@intFromEnum(AbbrevKind.parameter)); |
| 623 | dbg_info.appendAssumeCapacity(@intFromEnum(AbbrevCode.parameter)); |
| 624 | 624 | // DW.AT.location, DW.FORM.exprloc |
| 625 | 625 | var expr_len = std.io.countingWriter(std.io.null_writer); |
| 626 | 626 | if (info.fp_register < 32) { |
| ... | ... | @@ -649,7 +649,7 @@ pub const DeclState = struct { |
| 649 | 649 | // where each argument is encoded as |
| 650 | 650 | // <opcode> i:uleb128 |
| 651 | 651 | dbg_info.appendSliceAssumeCapacity(&.{ |
| 652 | | @intFromEnum(AbbrevKind.parameter), |
| 652 | @intFromEnum(AbbrevCode.parameter), |
| 653 | 653 | DW.OP.WASM_location, |
| 654 | 654 | DW.OP.WASM_local, |
| 655 | 655 | }); |
| ... | ... | @@ -676,7 +676,7 @@ pub const DeclState = struct { |
| 676 | 676 | const dbg_info = &self.dbg_info; |
| 677 | 677 | const atom_index = self.di_atom_decls.get(owner_decl).?; |
| 678 | 678 | const name_with_null = name.ptr[0 .. name.len + 1]; |
| 679 | | try dbg_info.append(@intFromEnum(AbbrevKind.variable)); |
| 679 | try dbg_info.append(@intFromEnum(AbbrevCode.variable)); |
| 680 | 680 | const gpa = self.dwarf.allocator; |
| 681 | 681 | const mod = self.mod; |
| 682 | 682 | const target = mod.getTarget(); |
| ... | ... | @@ -991,8 +991,10 @@ pub const ExprlocRelocation = struct { |
| 991 | 991 | |
| 992 | 992 | pub const PtrWidth = enum { p32, p64 }; |
| 993 | 993 | |
| 994 | | pub const AbbrevKind = enum(u8) { |
| 995 | | compile_unit = 1, |
| 994 | pub const AbbrevCode = enum(u8) { |
| 995 | null, |
| 996 | padding, |
| 997 | compile_unit, |
| 996 | 998 | subprogram, |
| 997 | 999 | subprogram_retvoid, |
| 998 | 1000 | base_type, |
| ... | ... | @@ -1002,7 +1004,7 @@ pub const AbbrevKind = enum(u8) { |
| 1002 | 1004 | enum_type, |
| 1003 | 1005 | enum_variant, |
| 1004 | 1006 | union_type, |
| 1005 | | pad1, |
| 1007 | zero_bit_type, |
| 1006 | 1008 | parameter, |
| 1007 | 1009 | variable, |
| 1008 | 1010 | array_type, |
| ... | ... | @@ -1162,7 +1164,7 @@ pub fn initDeclState(self: *Dwarf, mod: *Module, decl_index: InternPool.DeclInde |
| 1162 | 1164 | const fn_ret_type = decl.ty.fnReturnType(mod); |
| 1163 | 1165 | const fn_ret_has_bits = fn_ret_type.hasRuntimeBits(mod); |
| 1164 | 1166 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum( |
| 1165 | | @as(AbbrevKind, if (fn_ret_has_bits) .subprogram else .subprogram_retvoid), |
| 1167 | @as(AbbrevCode, if (fn_ret_has_bits) .subprogram else .subprogram_retvoid), |
| 1166 | 1168 | )); |
| 1167 | 1169 | // These get overwritten after generating the machine code. These values are |
| 1168 | 1170 | // "relocations" and have to be in this fixed place so that functions can be |
| ... | ... | @@ -1806,7 +1808,14 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { |
| 1806 | 1808 | // we can simply append these bytes. |
| 1807 | 1809 | // zig fmt: off |
| 1808 | 1810 | const abbrev_buf = [_]u8{ |
| 1809 | | @intFromEnum(AbbrevKind.compile_unit), |
| 1811 | @intFromEnum(AbbrevCode.padding), |
| 1812 | @as(u8, 0x80) | @as(u7, @truncate(DW.TAG.ZIG_padding >> 0)), |
| 1813 | @as(u8, 0x80) | @as(u7, @truncate(DW.TAG.ZIG_padding >> 7)), |
| 1814 | @as(u8, 0x00) | @as(u7, @intCast(DW.TAG.ZIG_padding >> 14)), |
| 1815 | DW.CHILDREN.no, |
| 1816 | 0, 0, |
| 1817 | |
| 1818 | @intFromEnum(AbbrevCode.compile_unit), |
| 1810 | 1819 | DW.TAG.compile_unit, |
| 1811 | 1820 | DW.CHILDREN.yes, |
| 1812 | 1821 | DW.AT.stmt_list, DW.FORM.sec_offset, |
| ... | ... | @@ -1818,7 +1827,7 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { |
| 1818 | 1827 | DW.AT.language, DW.FORM.data2, |
| 1819 | 1828 | 0, 0, |
| 1820 | 1829 | |
| 1821 | | @intFromEnum(AbbrevKind.subprogram), |
| 1830 | @intFromEnum(AbbrevCode.subprogram), |
| 1822 | 1831 | DW.TAG.subprogram, |
| 1823 | 1832 | DW.CHILDREN.yes, |
| 1824 | 1833 | DW.AT.low_pc, DW.FORM.addr, |
| ... | ... | @@ -1828,7 +1837,7 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { |
| 1828 | 1837 | DW.AT.linkage_name, DW.FORM.string, |
| 1829 | 1838 | 0, 0, |
| 1830 | 1839 | |
| 1831 | | @intFromEnum(AbbrevKind.subprogram_retvoid), |
| 1840 | @intFromEnum(AbbrevCode.subprogram_retvoid), |
| 1832 | 1841 | DW.TAG.subprogram, |
| 1833 | 1842 | DW.CHILDREN.yes, |
| 1834 | 1843 | DW.AT.low_pc, DW.FORM.addr, |
| ... | ... | @@ -1837,25 +1846,25 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { |
| 1837 | 1846 | DW.AT.linkage_name, DW.FORM.string, |
| 1838 | 1847 | 0, 0, |
| 1839 | 1848 | |
| 1840 | | @intFromEnum(AbbrevKind.base_type), |
| 1849 | @intFromEnum(AbbrevCode.base_type), |
| 1841 | 1850 | DW.TAG.base_type, DW.CHILDREN.no, |
| 1842 | 1851 | DW.AT.encoding, DW.FORM.data1, |
| 1843 | 1852 | DW.AT.byte_size, DW.FORM.udata, |
| 1844 | 1853 | DW.AT.name, DW.FORM.string, |
| 1845 | 1854 | 0, 0, |
| 1846 | 1855 | |
| 1847 | | @intFromEnum(AbbrevKind.ptr_type), |
| 1856 | @intFromEnum(AbbrevCode.ptr_type), |
| 1848 | 1857 | DW.TAG.pointer_type, DW.CHILDREN.no, |
| 1849 | 1858 | DW.AT.type, DW.FORM.ref4, |
| 1850 | 1859 | 0, 0, |
| 1851 | 1860 | |
| 1852 | | @intFromEnum(AbbrevKind.struct_type), |
| 1861 | @intFromEnum(AbbrevCode.struct_type), |
| 1853 | 1862 | DW.TAG.structure_type, DW.CHILDREN.yes, |
| 1854 | 1863 | DW.AT.byte_size, DW.FORM.udata, |
| 1855 | 1864 | DW.AT.name, DW.FORM.string, |
| 1856 | 1865 | 0, 0, |
| 1857 | 1866 | |
| 1858 | | @intFromEnum(AbbrevKind.struct_member), |
| 1867 | @intFromEnum(AbbrevCode.struct_member), |
| 1859 | 1868 | DW.TAG.member, |
| 1860 | 1869 | DW.CHILDREN.no, |
| 1861 | 1870 | DW.AT.name, DW.FORM.string, |
| ... | ... | @@ -1863,31 +1872,31 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { |
| 1863 | 1872 | DW.AT.data_member_location, DW.FORM.udata, |
| 1864 | 1873 | 0, 0, |
| 1865 | 1874 | |
| 1866 | | @intFromEnum(AbbrevKind.enum_type), |
| 1875 | @intFromEnum(AbbrevCode.enum_type), |
| 1867 | 1876 | DW.TAG.enumeration_type, |
| 1868 | 1877 | DW.CHILDREN.yes, |
| 1869 | 1878 | DW.AT.byte_size, DW.FORM.udata, |
| 1870 | 1879 | DW.AT.name, DW.FORM.string, |
| 1871 | 1880 | 0, 0, |
| 1872 | 1881 | |
| 1873 | | @intFromEnum(AbbrevKind.enum_variant), |
| 1882 | @intFromEnum(AbbrevCode.enum_variant), |
| 1874 | 1883 | DW.TAG.enumerator, DW.CHILDREN.no, |
| 1875 | 1884 | DW.AT.name, DW.FORM.string, |
| 1876 | 1885 | DW.AT.const_value, DW.FORM.data8, |
| 1877 | 1886 | 0, 0, |
| 1878 | 1887 | |
| 1879 | | @intFromEnum(AbbrevKind.union_type), |
| 1888 | @intFromEnum(AbbrevCode.union_type), |
| 1880 | 1889 | DW.TAG.union_type, DW.CHILDREN.yes, |
| 1881 | 1890 | DW.AT.byte_size, DW.FORM.udata, |
| 1882 | 1891 | DW.AT.name, DW.FORM.string, |
| 1883 | 1892 | 0, 0, |
| 1884 | 1893 | |
| 1885 | | @intFromEnum(AbbrevKind.pad1), |
| 1894 | @intFromEnum(AbbrevCode.zero_bit_type), |
| 1886 | 1895 | DW.TAG.unspecified_type, |
| 1887 | 1896 | DW.CHILDREN.no, |
| 1888 | 1897 | 0, 0, |
| 1889 | 1898 | |
| 1890 | | @intFromEnum(AbbrevKind.parameter), |
| 1899 | @intFromEnum(AbbrevCode.parameter), |
| 1891 | 1900 | DW.TAG.formal_parameter, |
| 1892 | 1901 | DW.CHILDREN.no, |
| 1893 | 1902 | DW.AT.location, DW.FORM.exprloc, |
| ... | ... | @@ -1895,7 +1904,7 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { |
| 1895 | 1904 | DW.AT.name, DW.FORM.string, |
| 1896 | 1905 | 0, 0, |
| 1897 | 1906 | |
| 1898 | | @intFromEnum(AbbrevKind.variable), |
| 1907 | @intFromEnum(AbbrevCode.variable), |
| 1899 | 1908 | DW.TAG.variable, |
| 1900 | 1909 | DW.CHILDREN.no, |
| 1901 | 1910 | DW.AT.location, DW.FORM.exprloc, |
| ... | ... | @@ -1903,14 +1912,14 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { |
| 1903 | 1912 | DW.AT.name, DW.FORM.string, |
| 1904 | 1913 | 0, 0, |
| 1905 | 1914 | |
| 1906 | | @intFromEnum(AbbrevKind.array_type), |
| 1915 | @intFromEnum(AbbrevCode.array_type), |
| 1907 | 1916 | DW.TAG.array_type, |
| 1908 | 1917 | DW.CHILDREN.yes, |
| 1909 | 1918 | DW.AT.name, DW.FORM.string, |
| 1910 | 1919 | DW.AT.type, DW.FORM.ref4, |
| 1911 | 1920 | 0, 0, |
| 1912 | 1921 | |
| 1913 | | @intFromEnum(AbbrevKind.array_dim), |
| 1922 | @intFromEnum(AbbrevCode.array_dim), |
| 1914 | 1923 | DW.TAG.subrange_type, |
| 1915 | 1924 | DW.CHILDREN.no, |
| 1916 | 1925 | DW.AT.type, DW.FORM.ref4, |
| ... | ... | @@ -2007,7 +2016,7 @@ pub fn writeDbgInfoHeader(self: *Dwarf, zcu: *Module, low_pc: u64, high_pc: u64) |
| 2007 | 2016 | const comp_dir_strp = try self.strtab.insert(self.allocator, compile_unit_dir); |
| 2008 | 2017 | const producer_strp = try self.strtab.insert(self.allocator, link.producer_string); |
| 2009 | 2018 | |
| 2010 | | di_buf.appendAssumeCapacity(@intFromEnum(AbbrevKind.compile_unit)); |
| 2019 | di_buf.appendAssumeCapacity(@intFromEnum(AbbrevCode.compile_unit)); |
| 2011 | 2020 | self.writeOffsetAssumeCapacity(&di_buf, 0); // DW.AT.stmt_list, DW.FORM.sec_offset |
| 2012 | 2021 | self.writeAddrAssumeCapacity(&di_buf, low_pc); |
| 2013 | 2022 | self.writeAddrAssumeCapacity(&di_buf, high_pc); |
| ... | ... | @@ -2226,7 +2235,7 @@ fn pwriteDbgInfoNops( |
| 2226 | 2235 | const tracy = trace(@src()); |
| 2227 | 2236 | defer tracy.end(); |
| 2228 | 2237 | |
| 2229 | | const page_of_nops = [1]u8{@intFromEnum(AbbrevKind.pad1)} ** 4096; |
| 2238 | const page_of_nops = [1]u8{@intFromEnum(AbbrevCode.padding)} ** 4096; |
| 2230 | 2239 | var vecs: [32]std.os.iovec_const = undefined; |
| 2231 | 2240 | var vec_index: usize = 0; |
| 2232 | 2241 | { |
| ... | ... | @@ -2298,9 +2307,9 @@ fn writeDbgInfoNopsToArrayList( |
| 2298 | 2307 | buffer.items.len, |
| 2299 | 2308 | offset + content.len + next_padding_size + 1, |
| 2300 | 2309 | )); |
| 2301 | | @memset(buffer.items[offset - prev_padding_size .. offset], @intFromEnum(AbbrevKind.pad1)); |
| 2310 | @memset(buffer.items[offset - prev_padding_size .. offset], @intFromEnum(AbbrevCode.padding)); |
| 2302 | 2311 | @memcpy(buffer.items[offset..][0..content.len], content); |
| 2303 | | @memset(buffer.items[offset + content.len ..][0..next_padding_size], @intFromEnum(AbbrevKind.pad1)); |
| 2312 | @memset(buffer.items[offset + content.len ..][0..next_padding_size], @intFromEnum(AbbrevCode.padding)); |
| 2304 | 2313 | |
| 2305 | 2314 | if (trailing_zero) { |
| 2306 | 2315 | buffer.items[offset + content.len + next_padding_size] = 0; |
| ... | ... | @@ -2842,7 +2851,7 @@ fn addDbgInfoErrorSetNames( |
| 2842 | 2851 | const target_endian = target.cpu.arch.endian(); |
| 2843 | 2852 | |
| 2844 | 2853 | // DW.AT.enumeration_type |
| 2845 | | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.enum_type)); |
| 2854 | try dbg_info_buffer.append(@intFromEnum(AbbrevCode.enum_type)); |
| 2846 | 2855 | // DW.AT.byte_size, DW.FORM.udata |
| 2847 | 2856 | const abi_size = Type.anyerror.abiSize(mod); |
| 2848 | 2857 | try leb128.writeULEB128(dbg_info_buffer.writer(), abi_size); |
| ... | ... | @@ -2853,7 +2862,7 @@ fn addDbgInfoErrorSetNames( |
| 2853 | 2862 | // DW.AT.enumerator |
| 2854 | 2863 | const no_error = "(no error)"; |
| 2855 | 2864 | try dbg_info_buffer.ensureUnusedCapacity(no_error.len + 2 + @sizeOf(u64)); |
| 2856 | | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.enum_variant)); |
| 2865 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevCode.enum_variant)); |
| 2857 | 2866 | // DW.AT.name, DW.FORM.string |
| 2858 | 2867 | dbg_info_buffer.appendSliceAssumeCapacity(no_error); |
| 2859 | 2868 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | ... | @@ -2865,7 +2874,7 @@ fn addDbgInfoErrorSetNames( |
| 2865 | 2874 | const error_name = mod.intern_pool.stringToSlice(error_name_ip); |
| 2866 | 2875 | // DW.AT.enumerator |
| 2867 | 2876 | try dbg_info_buffer.ensureUnusedCapacity(error_name.len + 2 + @sizeOf(u64)); |
| 2868 | | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.enum_variant)); |
| 2877 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevCode.enum_variant)); |
| 2869 | 2878 | // DW.AT.name, DW.FORM.string |
| 2870 | 2879 | dbg_info_buffer.appendSliceAssumeCapacity(error_name); |
| 2871 | 2880 | dbg_info_buffer.appendAssumeCapacity(0); |