| ... | @@ -497,33 +497,33 @@ pub const Cfa = union(enum) { | ... | @@ -497,33 +497,33 @@ pub const Cfa = union(enum) { |
| 497 | const RegOff = struct { reg: u32, off: i64 }; | 497 | const RegOff = struct { reg: u32, off: i64 }; |
| 498 | const RegExpr = struct { reg: u32, expr: Loc }; | 498 | const RegExpr = struct { reg: u32, expr: Loc }; |
| 499 | | 499 | |
| 500 | fn write(cfa: Cfa, wip_nav: *WipNav) link.EmitError!void { | 500 | fn write(cfa: Cfa, wip_func: *WipFunc) link.EmitError!void { |
| 501 | const df_nw = &wip_nav.fde_writer; | 501 | const df_nw = &wip_func.fde_writer; |
| 502 | const df_w = &df_nw.interface; | 502 | const df_w = &df_nw.interface; |
| 503 | switch (cfa) { | 503 | switch (cfa) { |
| 504 | .nop => try df_w.writeByte(DW.CFA.nop), | 504 | .nop => try df_w.writeByte(DW.CFA.nop), |
| 505 | .advance_loc => |loc| { | 505 | .advance_loc => |loc| { |
| 506 | const delta = | 506 | const delta = |
| 507 | @divExact(loc - wip_nav.cfi.loc, wip_nav.dwarf.frame.header.code_alignment_factor); | 507 | @divExact(loc - wip_func.cfi.loc, wip_func.dwarf.frame.header.code_alignment_factor); |
| 508 | if (delta == 0) {} else if (std.math.cast(u6, delta)) |small_delta| | 508 | if (delta == 0) {} else if (std.math.cast(u6, delta)) |small_delta| |
| 509 | try df_w.writeByte(@as(u8, DW.CFA.advance_loc) + small_delta) | 509 | try df_w.writeByte(@as(u8, DW.CFA.advance_loc) + small_delta) |
| 510 | else if (std.math.cast(u8, delta)) |ubyte_delta| | 510 | else if (std.math.cast(u8, delta)) |ubyte_delta| |
| 511 | try df_w.writeAll(&.{ DW.CFA.advance_loc1, ubyte_delta }) | 511 | try df_w.writeAll(&.{ DW.CFA.advance_loc1, ubyte_delta }) |
| 512 | else if (std.math.cast(u16, delta)) |uhalf_delta| { | 512 | else if (std.math.cast(u16, delta)) |uhalf_delta| { |
| 513 | try df_w.writeByte(DW.CFA.advance_loc2); | 513 | try df_w.writeByte(DW.CFA.advance_loc2); |
| 514 | try df_w.writeInt(u16, uhalf_delta, wip_nav.dwarf.endian); | 514 | try df_w.writeInt(u16, uhalf_delta, wip_func.dwarf.endian); |
| 515 | } else if (std.math.cast(u32, delta)) |uword_delta| { | 515 | } else if (std.math.cast(u32, delta)) |uword_delta| { |
| 516 | try df_w.writeByte(DW.CFA.advance_loc4); | 516 | try df_w.writeByte(DW.CFA.advance_loc4); |
| 517 | try df_w.writeInt(u32, uword_delta, wip_nav.dwarf.endian); | 517 | try df_w.writeInt(u32, uword_delta, wip_func.dwarf.endian); |
| 518 | } | 518 | } |
| 519 | wip_nav.cfi.loc = loc; | 519 | wip_func.cfi.loc = loc; |
| 520 | }, | 520 | }, |
| 521 | .offset, .rel_offset => |reg_off| { | 521 | .offset, .rel_offset => |reg_off| { |
| 522 | const factored_off = @divExact(reg_off.off - switch (cfa) { | 522 | const factored_off = @divExact(reg_off.off - switch (cfa) { |
| 523 | else => unreachable, | 523 | else => unreachable, |
| 524 | .offset => 0, | 524 | .offset => 0, |
| 525 | .rel_offset => wip_nav.cfi.cfa.off, | 525 | .rel_offset => wip_func.cfi.cfa.off, |
| 526 | }, wip_nav.dwarf.frame.header.data_alignment_factor); | 526 | }, wip_func.dwarf.frame.header.data_alignment_factor); |
| 527 | if (std.math.cast(u63, factored_off)) |unsigned_off| { | 527 | if (std.math.cast(u63, factored_off)) |unsigned_off| { |
| 528 | if (std.math.cast(u6, reg_off.reg)) |small_reg| { | 528 | if (std.math.cast(u6, reg_off.reg)) |small_reg| { |
| 529 | try df_w.writeByte(@as(u8, DW.CFA.offset) + small_reg); | 529 | try df_w.writeByte(@as(u8, DW.CFA.offset) + small_reg); |
| ... | @@ -565,21 +565,21 @@ pub const Cfa = union(enum) { | ... | @@ -565,21 +565,21 @@ pub const Cfa = union(enum) { |
| 565 | const reg_off: RegOff = switch (cfa) { | 565 | const reg_off: RegOff = switch (cfa) { |
| 566 | else => unreachable, | 566 | else => unreachable, |
| 567 | .def_cfa => |reg_off| reg_off, | 567 | .def_cfa => |reg_off| reg_off, |
| 568 | .def_cfa_register => |reg| .{ .reg = reg, .off = wip_nav.cfi.cfa.off }, | 568 | .def_cfa_register => |reg| .{ .reg = reg, .off = wip_func.cfi.cfa.off }, |
| 569 | .def_cfa_offset => |off| .{ .reg = wip_nav.cfi.cfa.reg, .off = off }, | 569 | .def_cfa_offset => |off| .{ .reg = wip_func.cfi.cfa.reg, .off = off }, |
| 570 | .adjust_cfa_offset => |off| .{ | 570 | .adjust_cfa_offset => |off| .{ |
| 571 | .reg = wip_nav.cfi.cfa.reg, | 571 | .reg = wip_func.cfi.cfa.reg, |
| 572 | .off = wip_nav.cfi.cfa.off + off, | 572 | .off = wip_func.cfi.cfa.off + off, |
| 573 | }, | 573 | }, |
| 574 | }; | 574 | }; |
| 575 | const changed_reg = reg_off.reg != wip_nav.cfi.cfa.reg; | 575 | const changed_reg = reg_off.reg != wip_func.cfi.cfa.reg; |
| 576 | const unsigned_off = std.math.cast(u63, reg_off.off); | 576 | const unsigned_off = std.math.cast(u63, reg_off.off); |
| 577 | if (reg_off.off == wip_nav.cfi.cfa.off) { | 577 | if (reg_off.off == wip_func.cfi.cfa.off) { |
| 578 | if (changed_reg) { | 578 | if (changed_reg) { |
| 579 | try df_w.writeByte(DW.CFA.def_cfa_register); | 579 | try df_w.writeByte(DW.CFA.def_cfa_register); |
| 580 | try df_w.writeUleb128(reg_off.reg); | 580 | try df_w.writeUleb128(reg_off.reg); |
| 581 | } | 581 | } |
| 582 | } else if (switch (wip_nav.dwarf.frame.header.data_alignment_factor) { | 582 | } else if (switch (wip_func.dwarf.frame.header.data_alignment_factor) { |
| 583 | 0 => unreachable, | 583 | 0 => unreachable, |
| 584 | 1 => unsigned_off != null, | 584 | 1 => unsigned_off != null, |
| 585 | else => |data_alignment_factor| @rem(reg_off.off, data_alignment_factor) != 0, | 585 | else => |data_alignment_factor| @rem(reg_off.off, data_alignment_factor) != 0, |
| ... | @@ -591,23 +591,23 @@ pub const Cfa = union(enum) { | ... | @@ -591,23 +591,23 @@ pub const Cfa = union(enum) { |
| 591 | try df_w.writeByte(if (changed_reg) DW.CFA.def_cfa_sf else DW.CFA.def_cfa_offset_sf); | 591 | try df_w.writeByte(if (changed_reg) DW.CFA.def_cfa_sf else DW.CFA.def_cfa_offset_sf); |
| 592 | if (changed_reg) try df_w.writeUleb128(reg_off.reg); | 592 | if (changed_reg) try df_w.writeUleb128(reg_off.reg); |
| 593 | try df_w.writeSleb128( | 593 | try df_w.writeSleb128( |
| 594 | @divExact(reg_off.off, wip_nav.dwarf.frame.header.data_alignment_factor), | 594 | @divExact(reg_off.off, wip_func.dwarf.frame.header.data_alignment_factor), |
| 595 | ); | 595 | ); |
| 596 | } | 596 | } |
| 597 | wip_nav.cfi.cfa = reg_off; | 597 | wip_func.cfi.cfa = reg_off; |
| 598 | }, | 598 | }, |
| 599 | .def_cfa_expression => |expr| { | 599 | .def_cfa_expression => |expr| { |
| 600 | try df_w.writeByte(DW.CFA.def_cfa_expression); | 600 | try df_w.writeByte(DW.CFA.def_cfa_expression); |
| 601 | try wip_nav.dwarf.exprLoc(df_nw, expr); | 601 | try wip_func.dwarf.exprLoc(df_nw, expr); |
| 602 | }, | 602 | }, |
| 603 | .expression => |reg_expr| { | 603 | .expression => |reg_expr| { |
| 604 | try df_w.writeByte(DW.CFA.expression); | 604 | try df_w.writeByte(DW.CFA.expression); |
| 605 | try df_w.writeUleb128(reg_expr.reg); | 605 | try df_w.writeUleb128(reg_expr.reg); |
| 606 | try wip_nav.dwarf.exprLoc(df_nw, reg_expr.expr); | 606 | try wip_func.dwarf.exprLoc(df_nw, reg_expr.expr); |
| 607 | }, | 607 | }, |
| 608 | .val_offset => |reg_off| { | 608 | .val_offset => |reg_off| { |
| 609 | const factored_off = | 609 | const factored_off = |
| 610 | @divExact(reg_off.off, wip_nav.dwarf.frame.header.data_alignment_factor); | 610 | @divExact(reg_off.off, wip_func.dwarf.frame.header.data_alignment_factor); |
| 611 | if (std.math.cast(u63, factored_off)) |unsigned_off| { | 611 | if (std.math.cast(u63, factored_off)) |unsigned_off| { |
| 612 | try df_w.writeByte(DW.CFA.val_offset); | 612 | try df_w.writeByte(DW.CFA.val_offset); |
| 613 | try df_w.writeUleb128(reg_off.reg); | 613 | try df_w.writeUleb128(reg_off.reg); |
| ... | @@ -621,14 +621,14 @@ pub const Cfa = union(enum) { | ... | @@ -621,14 +621,14 @@ pub const Cfa = union(enum) { |
| 621 | .val_expression => |reg_expr| { | 621 | .val_expression => |reg_expr| { |
| 622 | try df_w.writeByte(DW.CFA.val_expression); | 622 | try df_w.writeByte(DW.CFA.val_expression); |
| 623 | try df_w.writeUleb128(reg_expr.reg); | 623 | try df_w.writeUleb128(reg_expr.reg); |
| 624 | try wip_nav.dwarf.exprLoc(df_nw, reg_expr.expr); | 624 | try wip_func.dwarf.exprLoc(df_nw, reg_expr.expr); |
| 625 | }, | 625 | }, |
| 626 | .escape => |bytes| try df_w.writeAll(bytes), | 626 | .escape => |bytes| try df_w.writeAll(bytes), |
| 627 | } | 627 | } |
| 628 | } | 628 | } |
| 629 | }; | 629 | }; |
| 630 | | 630 | |
| 631 | pub const WipNav = struct { | 631 | pub const WipFunc = struct { |
| 632 | dwarf: *Dwarf, | 632 | dwarf: *Dwarf, |
| 633 | unit: Unit.Index, | 633 | unit: Unit.Index, |
| 634 | func: InternPool.Index, | 634 | func: InternPool.Index, |
| ... | @@ -642,7 +642,7 @@ pub const WipNav = struct { | ... | @@ -642,7 +642,7 @@ pub const WipNav = struct { |
| 642 | frame_func_length: struct { offset: usize, size: AddressSize }, | 642 | frame_func_length: struct { offset: usize, size: AddressSize }, |
| 643 | | 643 | |
| 644 | pub const Debug = struct { | 644 | pub const Debug = struct { |
| 645 | wip_nav: WipNav, | 645 | wip_func: WipFunc, |
| 646 | pt: Zcu.PerThread, | 646 | pt: Zcu.PerThread, |
| 647 | empty: bool, | 647 | empty: bool, |
| 648 | blocks: std.ArrayList(struct { | 648 | blocks: std.ArrayList(struct { |
| ... | @@ -659,27 +659,26 @@ pub const WipNav = struct { | ... | @@ -659,27 +659,26 @@ pub const WipNav = struct { |
| 659 | debug.line_writer.deinit(); | 659 | debug.line_writer.deinit(); |
| 660 | debug.info_writer.deinit(); | 660 | debug.info_writer.deinit(); |
| 661 | debug.blocks.deinit(gpa); | 661 | debug.blocks.deinit(gpa); |
| 662 | debug.wip_nav.deinit(); | 662 | debug.wip_func.deinit(); |
| 663 | debug.* = undefined; | 663 | debug.* = undefined; |
| 664 | } | 664 | } |
| 665 | | 665 | |
| 666 | pub fn genDebugFrame(debug: *Debug, loc: u32, cfa: Cfa) link.Error!void { | 666 | pub fn genDebugFrame(debug: *Debug, loc: u32, cfa: Cfa) link.Error!void { |
| 667 | return debug.wip_nav.genDebugFrame(loc, cfa); | 667 | return debug.wip_func.genDebugFrame(loc, cfa); |
| 668 | } | 668 | } |
| 669 | | 669 | |
| 670 | pub fn startFuncDebugInfo(debug: *Debug) link.Error!void { | 670 | pub fn startDebugInfo(debug: *Debug) link.Error!void { |
| 671 | assert(debug.wip_nav.func != .none); | 671 | debug.startDebugInfoInner() catch |err| switch (err) { |
| 672 | debug.startFuncDebugInfoInner() catch |err| switch (err) { | | |
| 673 | error.WriteFailed => return debug.wip_nav.dwarf.reportWriteError(&debug.info_writer), | | |
| 674 | else => |e| return e, | 672 | else => |e| return e, |
| | 673 | error.WriteFailed => return debug.wip_func.dwarf.reportWriteError(&debug.info_writer), |
| 675 | }; | 674 | }; |
| 676 | } | 675 | } |
| 677 | fn startFuncDebugInfoInner(debug: *Debug) link.EmitError!void { | 676 | fn startDebugInfoInner(debug: *Debug) link.EmitError!void { |
| 678 | const dwarf = debug.wip_nav.dwarf; | 677 | const dwarf = debug.wip_func.dwarf; |
| 679 | const pt = debug.pt; | 678 | const pt = debug.pt; |
| 680 | const zcu = pt.zcu; | 679 | const zcu = pt.zcu; |
| 681 | const ip = &zcu.intern_pool; | 680 | const ip = &zcu.intern_pool; |
| 682 | const func = zcu.funcInfo(debug.wip_nav.func); | 681 | const func = zcu.funcInfo(debug.wip_func.func); |
| 683 | const nav = ip.getNav(func.owner_nav); | 682 | const nav = ip.getNav(func.owner_nav); |
| 684 | const func_type = ip.indexToKey(func.ty).func_type; | 683 | const func_type = ip.indexToKey(func.ty).func_type; |
| 685 | const inst_info = nav.srcInst(ip).resolveFull(ip).?; | 684 | const inst_info = nav.srcInst(ip).resolveFull(ip).?; |
| ... | @@ -702,7 +701,7 @@ pub const WipNav = struct { | ... | @@ -702,7 +701,7 @@ pub const WipNav = struct { |
| 702 | .@"extern", .@"export" => nav.name, | 701 | .@"extern", .@"export" => nav.name, |
| 703 | }.toSlice(ip)); | 702 | }.toSlice(ip)); |
| 704 | try dwarf.refType(pt, di_nw, .fromInterned(func_type.return_type)); | 703 | try dwarf.refType(pt, di_nw, .fromInterned(func_type.return_type)); |
| 705 | try dwarf.addrSym(di_nw, debug.wip_nav.func_si, 0); | 704 | try dwarf.addrSym(di_nw, debug.wip_func.func_si, 0); |
| 706 | debug.info_func_length_offset = di_w.end; | 705 | debug.info_func_length_offset = di_w.end; |
| 707 | try di_w.writeInt(u32, undefined, dwarf.endian); | 706 | try di_w.writeInt(u32, undefined, dwarf.endian); |
| 708 | try di_w.writeUleb128( | 707 | try di_w.writeUleb128( |
| ... | @@ -713,17 +712,16 @@ pub const WipNav = struct { | ... | @@ -713,17 +712,16 @@ pub const WipNav = struct { |
| 713 | } | 712 | } |
| 714 | | 713 | |
| 715 | pub fn startDebugLine(debug: *Debug) link.Error!void { | 714 | pub fn startDebugLine(debug: *Debug) link.Error!void { |
| 716 | assert(debug.wip_nav.func != .none); | | |
| 717 | debug.startDebugLineInner() catch |err| switch (err) { | 715 | debug.startDebugLineInner() catch |err| switch (err) { |
| 718 | error.WriteFailed => return debug.wip_nav.dwarf.reportWriteError(&debug.line_writer), | | |
| 719 | else => |e| return e, | 716 | else => |e| return e, |
| | 717 | error.WriteFailed => return debug.wip_func.dwarf.reportWriteError(&debug.line_writer), |
| 720 | }; | 718 | }; |
| 721 | } | 719 | } |
| 722 | fn startDebugLineInner(debug: *Debug) link.EmitError!void { | 720 | fn startDebugLineInner(debug: *Debug) link.EmitError!void { |
| 723 | const dwarf = debug.wip_nav.dwarf; | 721 | const dwarf = debug.wip_func.dwarf; |
| 724 | const zcu = debug.pt.zcu; | 722 | const zcu = debug.pt.zcu; |
| 725 | const ip = &zcu.intern_pool; | 723 | const ip = &zcu.intern_pool; |
| 726 | const func = zcu.funcInfo(debug.wip_nav.func); | 724 | const func = zcu.funcInfo(debug.wip_func.func); |
| 727 | const inst_info = ip.getNav(func.owner_nav).srcInst(ip).resolveFull(ip).?; | 725 | const inst_info = ip.getNav(func.owner_nav).srcInst(ip).resolveFull(ip).?; |
| 728 | const zf = zcu.fileByIndex(inst_info.file); | 726 | const zf = zcu.fileByIndex(inst_info.file); |
| 729 | const decl = zf.zir.?.getDeclaration(inst_info.inst); | 727 | const decl = zf.zir.?.getDeclaration(inst_info.inst); |
| ... | @@ -742,7 +740,7 @@ pub const WipNav = struct { | ... | @@ -742,7 +740,7 @@ pub const WipNav = struct { |
| 742 | } else { | 740 | } else { |
| 743 | try dl_w.writeUleb128(1 + @backingInt(dwarf.address_size)); | 741 | try dl_w.writeUleb128(1 + @backingInt(dwarf.address_size)); |
| 744 | try dl_w.writeByte(DW.LNE.set_address); | 742 | try dl_w.writeByte(DW.LNE.set_address); |
| 745 | try dwarf.addrSym(dl_nw, debug.wip_nav.func_si, 0); | 743 | try dwarf.addrSym(dl_nw, debug.wip_func.func_si, 0); |
| 746 | | 744 | |
| 747 | const ui = dwarf.getUnit(zf.mod.?); | 745 | const ui = dwarf.getUnit(zf.mod.?); |
| 748 | _, const fi = try ui.get(dwarf).getFile(zcu.gpa, ui, inst_info.file); | 746 | _, const fi = try ui.get(dwarf).getFile(zcu.gpa, ui, inst_info.file); |
| ... | @@ -756,20 +754,19 @@ pub const WipNav = struct { | ... | @@ -756,20 +754,19 @@ pub const WipNav = struct { |
| 756 | } | 754 | } |
| 757 | } | 755 | } |
| 758 | | 756 | |
| 759 | pub fn finishFunc(debug: *Debug, func_length: u64) link.Error!void { | 757 | pub fn finish(debug: *Debug, func_length: u64) link.Error!void { |
| 760 | assert(debug.wip_nav.func != .none); | | |
| 761 | const di_nw = &debug.info_writer; | 758 | const di_nw = &debug.info_writer; |
| 762 | debug.finishDebugInfo(func_length) catch |err| switch (err) { | 759 | debug.finishDebugInfo(func_length) catch |err| switch (err) { |
| 763 | error.WriteFailed => return debug.wip_nav.dwarf.reportWriteError(di_nw), | | |
| 764 | else => |e| return e, | 760 | else => |e| return e, |
| | 761 | error.WriteFailed => return debug.wip_func.dwarf.reportWriteError(di_nw), |
| 765 | }; | 762 | }; |
| 766 | debug.finishDebugLine() catch |err| switch (err) { | 763 | debug.finishDebugLine() catch |err| switch (err) { |
| 767 | error.WriteFailed => return debug.wip_nav.dwarf.reportWriteError(di_nw), | | |
| 768 | else => |e| return e, | 764 | else => |e| return e, |
| | 765 | error.WriteFailed => return debug.wip_func.dwarf.reportWriteError(di_nw), |
| 769 | }; | 766 | }; |
| 770 | } | 767 | } |
| 771 | fn finishDebugInfo(debug: *Debug, func_length: u64) link.EmitError!void { | 768 | fn finishDebugInfo(debug: *Debug, func_length: u64) link.EmitError!void { |
| 772 | const dwarf = debug.wip_nav.dwarf; | 769 | const dwarf = debug.wip_func.dwarf; |
| 773 | const di_nw = &debug.info_writer; | 770 | const di_nw = &debug.info_writer; |
| 774 | const di_w = &di_nw.interface; | 771 | const di_w = &di_nw.interface; |
| 775 | std.mem.writeInt( | 772 | std.mem.writeInt( |
| ... | @@ -799,8 +796,8 @@ pub const WipNav = struct { | ... | @@ -799,8 +796,8 @@ pub const WipNav = struct { |
| 799 | loc: Loc, | 796 | loc: Loc, |
| 800 | ) link.Error!void { | 797 | ) link.Error!void { |
| 801 | return debug.genLocalVarDebugInfoInner(tag, opt_name, ty, loc) catch |err| switch (err) { | 798 | return debug.genLocalVarDebugInfoInner(tag, opt_name, ty, loc) catch |err| switch (err) { |
| 802 | error.WriteFailed => return debug.wip_nav.dwarf.reportWriteError(&debug.info_writer), | | |
| 803 | else => |e| e, | 799 | else => |e| e, |
| | 800 | error.WriteFailed => return debug.wip_func.dwarf.reportWriteError(&debug.info_writer), |
| 804 | }; | 801 | }; |
| 805 | } | 802 | } |
| 806 | fn genLocalVarDebugInfoInner( | 803 | fn genLocalVarDebugInfoInner( |
| ... | @@ -810,8 +807,7 @@ pub const WipNav = struct { | ... | @@ -810,8 +807,7 @@ pub const WipNav = struct { |
| 810 | ty: Type, | 807 | ty: Type, |
| 811 | loc: Loc, | 808 | loc: Loc, |
| 812 | ) link.EmitError!void { | 809 | ) link.EmitError!void { |
| 813 | assert(debug.wip_nav.func != .none); | 810 | const dwarf = debug.wip_func.dwarf; |
| 814 | const dwarf = debug.wip_nav.dwarf; | | |
| 815 | const di_nw = &debug.info_writer; | 811 | const di_nw = &debug.info_writer; |
| 816 | try dwarf.abbrevCode(di_nw, switch (tag) { | 812 | try dwarf.abbrevCode(di_nw, switch (tag) { |
| 817 | .arg => if (opt_name) |_| .arg else .unnamed_arg, | 813 | .arg => if (opt_name) |_| .arg else .unnamed_arg, |
| ... | @@ -831,8 +827,8 @@ pub const WipNav = struct { | ... | @@ -831,8 +827,8 @@ pub const WipNav = struct { |
| 831 | val: Value, | 827 | val: Value, |
| 832 | ) link.Error!void { | 828 | ) link.Error!void { |
| 833 | return debug.genLocalConstDebugInfoInner(tag, opt_name, val) catch |err| switch (err) { | 829 | return debug.genLocalConstDebugInfoInner(tag, opt_name, val) catch |err| switch (err) { |
| 834 | error.WriteFailed => return debug.wip_nav.dwarf.reportWriteError(&debug.info_writer), | | |
| 835 | else => |e| e, | 830 | else => |e| e, |
| | 831 | error.WriteFailed => return debug.wip_func.dwarf.reportWriteError(&debug.info_writer), |
| 836 | }; | 832 | }; |
| 837 | } | 833 | } |
| 838 | fn genLocalConstDebugInfoInner( | 834 | fn genLocalConstDebugInfoInner( |
| ... | @@ -841,8 +837,7 @@ pub const WipNav = struct { | ... | @@ -841,8 +837,7 @@ pub const WipNav = struct { |
| 841 | opt_name: ?[]const u8, | 837 | opt_name: ?[]const u8, |
| 842 | val: Value, | 838 | val: Value, |
| 843 | ) link.EmitError!void { | 839 | ) link.EmitError!void { |
| 844 | assert(debug.wip_nav.func != .none); | 840 | const dwarf = debug.wip_func.dwarf; |
| 845 | const dwarf = debug.wip_nav.dwarf; | | |
| 846 | const pt = debug.pt; | 841 | const pt = debug.pt; |
| 847 | const zcu = debug.pt.zcu; | 842 | const zcu = debug.pt.zcu; |
| 848 | const ty = val.typeOf(zcu); | 843 | const ty = val.typeOf(zcu); |
| ... | @@ -879,13 +874,12 @@ pub const WipNav = struct { | ... | @@ -879,13 +874,12 @@ pub const WipNav = struct { |
| 879 | | 874 | |
| 880 | pub fn genVarArgsDebugInfo(debug: *Debug) link.Error!void { | 875 | pub fn genVarArgsDebugInfo(debug: *Debug) link.Error!void { |
| 881 | return debug.genVarArgsDebugInfoInner() catch |err| switch (err) { | 876 | return debug.genVarArgsDebugInfoInner() catch |err| switch (err) { |
| 882 | error.WriteFailed => return debug.wip_nav.dwarf.reportWriteError(&debug.info_writer), | | |
| 883 | else => |e| e, | 877 | else => |e| e, |
| | 878 | error.WriteFailed => return debug.wip_func.dwarf.reportWriteError(&debug.info_writer), |
| 884 | }; | 879 | }; |
| 885 | } | 880 | } |
| 886 | fn genVarArgsDebugInfoInner(debug: *Debug) link.EmitError!void { | 881 | fn genVarArgsDebugInfoInner(debug: *Debug) link.EmitError!void { |
| 887 | assert(debug.wip_nav.func != .none); | 882 | try debug.wip_func.dwarf.abbrevCode(&debug.info_writer, .is_var_args); |
| 888 | try debug.wip_nav.dwarf.abbrevCode(&debug.info_writer, .is_var_args); | | |
| 889 | debug.empty = false; | 883 | debug.empty = false; |
| 890 | } | 884 | } |
| 891 | | 885 | |
| ... | @@ -896,7 +890,7 @@ pub const WipNav = struct { | ... | @@ -896,7 +890,7 @@ pub const WipNav = struct { |
| 896 | end: bool, | 890 | end: bool, |
| 897 | ) link.Error!void { | 891 | ) link.Error!void { |
| 898 | return debug.advanceLineAndPcInner(delta_line, delta_pc, end) catch |err| switch (err) { | 892 | return debug.advanceLineAndPcInner(delta_line, delta_pc, end) catch |err| switch (err) { |
| 899 | error.WriteFailed => return debug.wip_nav.dwarf.reportWriteError(&debug.line_writer), | 893 | error.WriteFailed => return debug.wip_func.dwarf.reportWriteError(&debug.line_writer), |
| 900 | }; | 894 | }; |
| 901 | } | 895 | } |
| 902 | fn advanceLineAndPcInner( | 896 | fn advanceLineAndPcInner( |
| ... | @@ -907,7 +901,7 @@ pub const WipNav = struct { | ... | @@ -907,7 +901,7 @@ pub const WipNav = struct { |
| 907 | ) std.Io.Writer.Error!void { | 901 | ) std.Io.Writer.Error!void { |
| 908 | const dl_w = &debug.line_writer.interface; | 902 | const dl_w = &debug.line_writer.interface; |
| 909 | | 903 | |
| 910 | const header = debug.wip_nav.dwarf.debug_line.header; | 904 | const header = debug.wip_func.dwarf.debug_line.header; |
| 911 | assert(header.maximum_operations_per_instruction == 1); | 905 | assert(header.maximum_operations_per_instruction == 1); |
| 912 | const delta_op: u64 = 0; | 906 | const delta_op: u64 = 0; |
| 913 | | 907 | |
| ... | @@ -951,7 +945,7 @@ pub const WipNav = struct { | ... | @@ -951,7 +945,7 @@ pub const WipNav = struct { |
| 951 | | 945 | |
| 952 | pub fn setColumn(debug: *Debug, column: u32) link.Error!void { | 946 | pub fn setColumn(debug: *Debug, column: u32) link.Error!void { |
| 953 | return debug.setColumnInner(column) catch |err| switch (err) { | 947 | return debug.setColumnInner(column) catch |err| switch (err) { |
| 954 | error.WriteFailed => return debug.wip_nav.dwarf.reportWriteError(&debug.line_writer), | 948 | error.WriteFailed => return debug.wip_func.dwarf.reportWriteError(&debug.line_writer), |
| 955 | }; | 949 | }; |
| 956 | } | 950 | } |
| 957 | fn setColumnInner(debug: *Debug, column: u32) std.Io.Writer.Error!void { | 951 | fn setColumnInner(debug: *Debug, column: u32) std.Io.Writer.Error!void { |
| ... | @@ -962,7 +956,7 @@ pub const WipNav = struct { | ... | @@ -962,7 +956,7 @@ pub const WipNav = struct { |
| 962 | | 956 | |
| 963 | pub fn negateStmt(debug: *Debug) link.Error!void { | 957 | pub fn negateStmt(debug: *Debug) link.Error!void { |
| 964 | return debug.negateStmtInner() catch |err| switch (err) { | 958 | return debug.negateStmtInner() catch |err| switch (err) { |
| 965 | error.WriteFailed => return debug.wip_nav.dwarf.reportWriteError(&debug.line_writer), | 959 | error.WriteFailed => return debug.wip_func.dwarf.reportWriteError(&debug.line_writer), |
| 966 | }; | 960 | }; |
| 967 | } | 961 | } |
| 968 | fn negateStmtInner(debug: *Debug) std.Io.Writer.Error!void { | 962 | fn negateStmtInner(debug: *Debug) std.Io.Writer.Error!void { |
| ... | @@ -971,7 +965,7 @@ pub const WipNav = struct { | ... | @@ -971,7 +965,7 @@ pub const WipNav = struct { |
| 971 | | 965 | |
| 972 | pub fn setPrologueEnd(debug: *Debug) link.Error!void { | 966 | pub fn setPrologueEnd(debug: *Debug) link.Error!void { |
| 973 | return debug.setPrologueEndInner() catch |err| switch (err) { | 967 | return debug.setPrologueEndInner() catch |err| switch (err) { |
| 974 | error.WriteFailed => return debug.wip_nav.dwarf.reportWriteError(&debug.line_writer), | 968 | error.WriteFailed => return debug.wip_func.dwarf.reportWriteError(&debug.line_writer), |
| 975 | }; | 969 | }; |
| 976 | } | 970 | } |
| 977 | fn setPrologueEndInner(debug: *Debug) std.Io.Writer.Error!void { | 971 | fn setPrologueEndInner(debug: *Debug) std.Io.Writer.Error!void { |
| ... | @@ -980,7 +974,7 @@ pub const WipNav = struct { | ... | @@ -980,7 +974,7 @@ pub const WipNav = struct { |
| 980 | | 974 | |
| 981 | pub fn setEpilogueBegin(debug: *Debug) link.Error!void { | 975 | pub fn setEpilogueBegin(debug: *Debug) link.Error!void { |
| 982 | return debug.setEpilogueBeginInner() catch |err| switch (err) { | 976 | return debug.setEpilogueBeginInner() catch |err| switch (err) { |
| 983 | error.WriteFailed => return debug.wip_nav.dwarf.reportWriteError(&debug.line_writer), | 977 | error.WriteFailed => return debug.wip_func.dwarf.reportWriteError(&debug.line_writer), |
| 984 | }; | 978 | }; |
| 985 | } | 979 | } |
| 986 | fn setEpilogueBeginInner(debug: *Debug) std.Io.Writer.Error!void { | 980 | fn setEpilogueBeginInner(debug: *Debug) std.Io.Writer.Error!void { |
| ... | @@ -989,12 +983,12 @@ pub const WipNav = struct { | ... | @@ -989,12 +983,12 @@ pub const WipNav = struct { |
| 989 | | 983 | |
| 990 | pub fn enterBlock(debug: *Debug, code_off: usize) link.Error!void { | 984 | pub fn enterBlock(debug: *Debug, code_off: usize) link.Error!void { |
| 991 | return debug.enterBlockInner(code_off) catch |err| switch (err) { | 985 | return debug.enterBlockInner(code_off) catch |err| switch (err) { |
| 992 | error.WriteFailed => return debug.wip_nav.dwarf.reportWriteError(&debug.info_writer), | | |
| 993 | else => |e| e, | 986 | else => |e| e, |
| | 987 | error.WriteFailed => return debug.wip_func.dwarf.reportWriteError(&debug.info_writer), |
| 994 | }; | 988 | }; |
| 995 | } | 989 | } |
| 996 | fn enterBlockInner(debug: *Debug, code_off: usize) link.EmitError!void { | 990 | fn enterBlockInner(debug: *Debug, code_off: usize) link.EmitError!void { |
| 997 | const dwarf = debug.wip_nav.dwarf; | 991 | const dwarf = debug.wip_func.dwarf; |
| 998 | const block = try debug.blocks.addOne(dwarf.lf.comp.gpa); | 992 | const block = try debug.blocks.addOne(dwarf.lf.comp.gpa); |
| 999 | | 993 | |
| 1000 | const di_nw = &debug.info_writer; | 994 | const di_nw = &debug.info_writer; |
| ... | @@ -1002,7 +996,7 @@ pub const WipNav = struct { | ... | @@ -1002,7 +996,7 @@ pub const WipNav = struct { |
| 1002 | block.abbrev_code = @intCast(di_w.end); | 996 | block.abbrev_code = @intCast(di_w.end); |
| 1003 | try dwarf.abbrevCode(di_nw, .block); | 997 | try dwarf.abbrevCode(di_nw, .block); |
| 1004 | block.low_pc_off = code_off; | 998 | block.low_pc_off = code_off; |
| 1005 | try dwarf.addrSym(di_nw, debug.wip_nav.func_si, code_off); | 999 | try dwarf.addrSym(di_nw, debug.wip_func.func_si, code_off); |
| 1006 | block.high_pc = @intCast(di_w.end); | 1000 | block.high_pc = @intCast(di_w.end); |
| 1007 | try di_w.writeInt(u32, 0, dwarf.endian); | 1001 | try di_w.writeInt(u32, 0, dwarf.endian); |
| 1008 | debug.empty = true; | 1002 | debug.empty = true; |
| ... | @@ -1010,12 +1004,12 @@ pub const WipNav = struct { | ... | @@ -1010,12 +1004,12 @@ pub const WipNav = struct { |
| 1010 | | 1004 | |
| 1011 | pub fn leaveBlock(debug: *Debug, code_off: usize) link.Error!void { | 1005 | pub fn leaveBlock(debug: *Debug, code_off: usize) link.Error!void { |
| 1012 | return debug.leaveBlockInner(code_off) catch |err| switch (err) { | 1006 | return debug.leaveBlockInner(code_off) catch |err| switch (err) { |
| 1013 | error.WriteFailed => return debug.wip_nav.dwarf.reportWriteError(&debug.info_writer), | | |
| 1014 | else => |e| e, | 1007 | else => |e| e, |
| | 1008 | error.WriteFailed => return debug.wip_func.dwarf.reportWriteError(&debug.info_writer), |
| 1015 | }; | 1009 | }; |
| 1016 | } | 1010 | } |
| 1017 | fn leaveBlockInner(debug: *Debug, code_off: usize) link.EmitError!void { | 1011 | fn leaveBlockInner(debug: *Debug, code_off: usize) link.EmitError!void { |
| 1018 | const dwarf = debug.wip_nav.dwarf; | 1012 | const dwarf = debug.wip_func.dwarf; |
| 1019 | const block = debug.blocks.pop().?; | 1013 | const block = debug.blocks.pop().?; |
| 1020 | | 1014 | |
| 1021 | const di_nw = &debug.info_writer; | 1015 | const di_nw = &debug.info_writer; |
| ... | @@ -1043,8 +1037,8 @@ pub const WipNav = struct { | ... | @@ -1043,8 +1037,8 @@ pub const WipNav = struct { |
| 1043 | column: u32, | 1037 | column: u32, |
| 1044 | ) link.Error!void { | 1038 | ) link.Error!void { |
| 1045 | return debug.enterInlineFuncInner(func, code_off, line, column) catch |err| switch (err) { | 1039 | return debug.enterInlineFuncInner(func, code_off, line, column) catch |err| switch (err) { |
| 1046 | error.WriteFailed => return debug.wip_nav.dwarf.reportWriteError(&debug.info_writer), | | |
| 1047 | else => |e| e, | 1040 | else => |e| e, |
| | 1041 | error.WriteFailed => return debug.wip_func.dwarf.reportWriteError(&debug.info_writer), |
| 1048 | }; | 1042 | }; |
| 1049 | } | 1043 | } |
| 1050 | fn enterInlineFuncInner( | 1044 | fn enterInlineFuncInner( |
| ... | @@ -1054,22 +1048,23 @@ pub const WipNav = struct { | ... | @@ -1054,22 +1048,23 @@ pub const WipNav = struct { |
| 1054 | line: u32, | 1048 | line: u32, |
| 1055 | column: u32, | 1049 | column: u32, |
| 1056 | ) link.EmitError!void { | 1050 | ) link.EmitError!void { |
| 1057 | const dwarf = debug.wip_nav.dwarf; | 1051 | const dwarf = debug.wip_func.dwarf; |
| 1058 | const zcu = debug.pt.zcu; | 1052 | const pt = debug.pt; |
| | 1053 | const zcu = pt.zcu; |
| 1059 | const block = try debug.blocks.addOne(zcu.gpa); | 1054 | const block = try debug.blocks.addOne(zcu.gpa); |
| 1060 | | 1055 | |
| 1061 | const di_nw = &debug.info_writer; | 1056 | const di_nw = &debug.info_writer; |
| 1062 | const di_w = &di_nw.interface; | 1057 | const di_w = &di_nw.interface; |
| 1063 | block.abbrev_code = @intCast(di_w.end); | 1058 | block.abbrev_code = @intCast(di_w.end); |
| 1064 | try dwarf.abbrevCode(di_nw, .inlined_func); | 1059 | try dwarf.abbrevCode(di_nw, .inlined_func); |
| 1065 | try debug.refFunc(func); | 1060 | try dwarf.refConst(pt, di_nw, .fromInterned(func)); |
| 1066 | try di_w.writeUleb128((if (zcu.comp.config.incremental) | 1061 | try di_w.writeUleb128((if (zcu.comp.config.incremental) |
| 1067 | 0 | 1062 | 0 |
| 1068 | else | 1063 | else |
| 1069 | zcu.navSrcLine(zcu.funcInfo(debug.wip_nav.func).owner_nav) + 1) + line); | 1064 | zcu.navSrcLine(zcu.funcInfo(debug.wip_func.func).owner_nav) + 1) + line); |
| 1070 | try di_w.writeUleb128(column + 1); | 1065 | try di_w.writeUleb128(column + 1); |
| 1071 | block.low_pc_off = code_off; | 1066 | block.low_pc_off = code_off; |
| 1072 | try dwarf.addrSym(di_nw, debug.wip_nav.func_si, code_off); | 1067 | try dwarf.addrSym(di_nw, debug.wip_func.func_si, code_off); |
| 1073 | block.high_pc = @intCast(di_w.end); | 1068 | block.high_pc = @intCast(di_w.end); |
| 1074 | try di_w.writeInt(u32, 0, dwarf.endian); | 1069 | try di_w.writeInt(u32, 0, dwarf.endian); |
| 1075 | try debug.setInlineFunc(func); | 1070 | try debug.setInlineFunc(func); |
| ... | @@ -1078,8 +1073,8 @@ pub const WipNav = struct { | ... | @@ -1078,8 +1073,8 @@ pub const WipNav = struct { |
| 1078 | | 1073 | |
| 1079 | pub fn leaveInlineFunc(debug: *Debug, func: InternPool.Index, code_off: usize) link.Error!void { | 1074 | pub fn leaveInlineFunc(debug: *Debug, func: InternPool.Index, code_off: usize) link.Error!void { |
| 1080 | return debug.leaveInlineFuncInner(func, code_off) catch |err| switch (err) { | 1075 | return debug.leaveInlineFuncInner(func, code_off) catch |err| switch (err) { |
| 1081 | error.WriteFailed => return debug.wip_nav.dwarf.reportWriteError(&debug.info_writer), | | |
| 1082 | else => |e| e, | 1076 | else => |e| e, |
| | 1077 | error.WriteFailed => return debug.wip_func.dwarf.reportWriteError(&debug.info_writer), |
| 1083 | }; | 1078 | }; |
| 1084 | } | 1079 | } |
| 1085 | fn leaveInlineFuncInner( | 1080 | fn leaveInlineFuncInner( |
| ... | @@ -1087,7 +1082,7 @@ pub const WipNav = struct { | ... | @@ -1087,7 +1082,7 @@ pub const WipNav = struct { |
| 1087 | func: InternPool.Index, | 1082 | func: InternPool.Index, |
| 1088 | code_off: usize, | 1083 | code_off: usize, |
| 1089 | ) link.EmitError!void { | 1084 | ) link.EmitError!void { |
| 1090 | const dwarf = debug.wip_nav.dwarf; | 1085 | const dwarf = debug.wip_func.dwarf; |
| 1091 | const block = debug.blocks.pop().?; | 1086 | const block = debug.blocks.pop().?; |
| 1092 | | 1087 | |
| 1093 | const di_nw = &debug.info_writer; | 1088 | const di_nw = &debug.info_writer; |
| ... | @@ -1110,15 +1105,15 @@ pub const WipNav = struct { | ... | @@ -1110,15 +1105,15 @@ pub const WipNav = struct { |
| 1110 | | 1105 | |
| 1111 | pub fn setInlineFunc(debug: *Debug, func: InternPool.Index) link.Error!void { | 1106 | pub fn setInlineFunc(debug: *Debug, func: InternPool.Index) link.Error!void { |
| 1112 | return debug.setInlineFuncInner(func) catch |err| switch (err) { | 1107 | return debug.setInlineFuncInner(func) catch |err| switch (err) { |
| 1113 | error.WriteFailed => return debug.wip_nav.dwarf.reportWriteError(&debug.line_writer), | | |
| 1114 | else => |e| e, | 1108 | else => |e| e, |
| | 1109 | error.WriteFailed => return debug.wip_func.dwarf.reportWriteError(&debug.line_writer), |
| 1115 | }; | 1110 | }; |
| 1116 | } | 1111 | } |
| 1117 | fn setInlineFuncInner(debug: *Debug, func: InternPool.Index) link.EmitError!void { | 1112 | fn setInlineFuncInner(debug: *Debug, func: InternPool.Index) link.EmitError!void { |
| 1118 | const zcu = debug.pt.zcu; | 1113 | const zcu = debug.pt.zcu; |
| 1119 | const ip = &zcu.intern_pool; | 1114 | const ip = &zcu.intern_pool; |
| 1120 | const dwarf = debug.wip_nav.dwarf; | 1115 | const dwarf = debug.wip_func.dwarf; |
| 1121 | if (debug.wip_nav.func == func) return; | 1116 | if (debug.wip_func.func == func) return; |
| 1122 | | 1117 | |
| 1123 | const dl_nw = &debug.line_writer; | 1118 | const dl_nw = &debug.line_writer; |
| 1124 | const dl_w = &dl_nw.interface; | 1119 | const dl_w = &dl_nw.interface; |
| ... | @@ -1132,7 +1127,7 @@ pub const WipNav = struct { | ... | @@ -1132,7 +1127,7 @@ pub const WipNav = struct { |
| 1132 | return; | 1127 | return; |
| 1133 | } | 1128 | } |
| 1134 | | 1129 | |
| 1135 | const old_owner_nav = zcu.funcInfo(debug.wip_nav.func).owner_nav; | 1130 | const old_owner_nav = zcu.funcInfo(debug.wip_func.func).owner_nav; |
| 1136 | const old_inst_info = ip.getNav(old_owner_nav).srcInst(ip).resolveFull(ip).?; | 1131 | const old_inst_info = ip.getNav(old_owner_nav).srcInst(ip).resolveFull(ip).?; |
| 1137 | const old_zf = zcu.fileByIndex(old_inst_info.file); | 1132 | const old_zf = zcu.fileByIndex(old_inst_info.file); |
| 1138 | const new_inst_info = ip.getNav(new_owner_nav).srcInst(ip).resolveFull(ip).?; | 1133 | const new_inst_info = ip.getNav(new_owner_nav).srcInst(ip).resolveFull(ip).?; |
| ... | @@ -1140,7 +1135,7 @@ pub const WipNav = struct { | ... | @@ -1140,7 +1135,7 @@ pub const WipNav = struct { |
| 1140 | if (old_inst_info.file != new_inst_info.file) { | 1135 | if (old_inst_info.file != new_inst_info.file) { |
| 1141 | const new_ui = dwarf.getUnit(new_zf.mod.?); | 1136 | const new_ui = dwarf.getUnit(new_zf.mod.?); |
| 1142 | _, const new_fi = | 1137 | _, const new_fi = |
| 1143 | try debug.wip_nav.unit.get(dwarf).getFile(zcu.gpa, new_ui, new_inst_info.file); | 1138 | try debug.wip_func.unit.get(dwarf).getFile(zcu.gpa, new_ui, new_inst_info.file); |
| 1144 | | 1139 | |
| 1145 | try dl_w.writeByte(DW.LNS.set_file); | 1140 | try dl_w.writeByte(DW.LNS.set_file); |
| 1146 | try dl_w.writeUleb128(@backingInt(new_fi)); | 1141 | try dl_w.writeUleb128(@backingInt(new_fi)); |
| ... | @@ -1153,38 +1148,27 @@ pub const WipNav = struct { | ... | @@ -1153,38 +1148,27 @@ pub const WipNav = struct { |
| 1153 | try dl_w.writeSleb128(new_src_line - old_src_line); | 1148 | try dl_w.writeSleb128(new_src_line - old_src_line); |
| 1154 | } | 1149 | } |
| 1155 | | 1150 | |
| 1156 | debug.wip_nav.func = func; | 1151 | debug.wip_func.func = func; |
| 1157 | } | | |
| 1158 | | | |
| 1159 | fn refFunc(debug: *Debug, func: InternPool.Index) link.EmitError!void { | | |
| 1160 | const dwarf = debug.wip_nav.dwarf; | | |
| 1161 | const fi = try dwarf.getFunc(debug.pt.zcu.funcInfo(func).owner_nav); | | |
| 1162 | try debug.wip_nav.dwarf.secOffset( | | |
| 1163 | &debug.info_writer, | | |
| 1164 | fi.get(dwarf).debug_info_ni.unwrap().?, | | |
| 1165 | 0, | | |
| 1166 | ); | | |
| 1167 | } | 1152 | } |
| 1168 | }; | 1153 | }; |
| 1169 | | 1154 | |
| 1170 | pub fn deinit(wip_nav: *WipNav) void { | 1155 | pub fn deinit(wip_func: *WipFunc) void { |
| 1171 | wip_nav.fde_writer.deinit(); | 1156 | wip_func.fde_writer.deinit(); |
| 1172 | wip_nav.* = undefined; | 1157 | wip_func.* = undefined; |
| 1173 | } | 1158 | } |
| 1174 | | 1159 | |
| 1175 | pub fn genDebugFrameHeader(wip_nav: *WipNav) link.Error!void { | 1160 | pub fn genDebugFrameHeader(wip_func: *WipFunc) link.Error!void { |
| 1176 | wip_nav.genDebugFrameHeaderInner() catch |err| switch (err) { | 1161 | wip_func.genDebugFrameHeaderInner() catch |err| switch (err) { |
| 1177 | error.WriteFailed => return wip_nav.dwarf.reportWriteError(&wip_nav.fde_writer), | | |
| 1178 | else => |e| return e, | 1162 | else => |e| return e, |
| | 1163 | error.WriteFailed => return wip_func.dwarf.reportWriteError(&wip_func.fde_writer), |
| 1179 | }; | 1164 | }; |
| 1180 | } | 1165 | } |
| 1181 | fn genDebugFrameHeaderInner(wip_nav: *WipNav) link.EmitError!void { | 1166 | fn genDebugFrameHeaderInner(wip_func: *WipFunc) link.EmitError!void { |
| 1182 | assert(wip_nav.func != .none); | 1167 | const dwarf = wip_func.dwarf; |
| 1183 | const dwarf = wip_nav.dwarf; | 1168 | const df_nw = &wip_func.fde_writer; |
| 1184 | const df_nw = &wip_nav.fde_writer; | | |
| 1185 | const df_w = &df_nw.interface; | 1169 | const df_w = &df_nw.interface; |
| 1186 | try dwarf.genUnitLength(df_w); | 1170 | try dwarf.genUnitLength(df_w); |
| 1187 | switch (wip_nav.frame_format) { | 1171 | switch (wip_func.frame_format) { |
| 1188 | .eh_frame => { | 1172 | .eh_frame => { |
| 1189 | try df_w.writeInt(u32, undefined, dwarf.endian); | 1173 | try df_w.writeInt(u32, undefined, dwarf.endian); |
| 1190 | { | 1174 | { |
| ... | @@ -1193,51 +1177,50 @@ pub const WipNav = struct { | ... | @@ -1193,51 +1177,50 @@ pub const WipNav = struct { |
| 1193 | if (dwarf.lf.cast(.elf2)) |elf| try elf.addReloc( | 1177 | if (dwarf.lf.cast(.elf2)) |elf| try elf.addReloc( |
| 1194 | @bitCast(df_nw.ni), | 1178 | @bitCast(df_nw.ni), |
| 1195 | offset, | 1179 | offset, |
| 1196 | wip_nav.func_si, | 1180 | wip_func.func_si, |
| 1197 | 0, | 1181 | 0, |
| 1198 | .rel32(elf), | 1182 | .rel32(elf), |
| 1199 | ) else unreachable; | 1183 | ) else unreachable; |
| 1200 | } | 1184 | } |
| 1201 | wip_nav.frame_func_length = .{ .offset = df_w.end, .size = .@"32" }; | 1185 | wip_func.frame_func_length = .{ .offset = df_w.end, .size = .@"32" }; |
| 1202 | try df_w.writeInt(u32, undefined, dwarf.endian); | 1186 | try df_w.writeInt(u32, undefined, dwarf.endian); |
| 1203 | try df_w.writeUleb128(0); | 1187 | try df_w.writeUleb128(0); |
| 1204 | }, | 1188 | }, |
| 1205 | .debug_frame => { | 1189 | .debug_frame => { |
| 1206 | try dwarf.secOffset(df_nw, wip_nav.unit.get(dwarf).cie_ni.unwrap().?, 0); | 1190 | try dwarf.secOffset(df_nw, wip_func.unit.get(dwarf).cie_ni.unwrap().?, 0); |
| 1207 | try dwarf.addrSym(df_nw, wip_nav.func_si, 0); | 1191 | try dwarf.addrSym(df_nw, wip_func.func_si, 0); |
| 1208 | wip_nav.frame_func_length = .{ .offset = df_w.end, .size = dwarf.address_size }; | 1192 | wip_func.frame_func_length = .{ .offset = df_w.end, .size = dwarf.address_size }; |
| 1209 | try dwarf.addrPlaceholder(df_w); | 1193 | try dwarf.addrPlaceholder(df_w); |
| 1210 | }, | 1194 | }, |
| 1211 | } | 1195 | } |
| 1212 | } | 1196 | } |
| 1213 | | 1197 | |
| 1214 | pub fn genDebugFrame(wip_nav: *WipNav, loc: u32, cfa: Cfa) link.Error!void { | 1198 | pub fn genDebugFrame(wip_func: *WipFunc, loc: u32, cfa: Cfa) link.Error!void { |
| 1215 | return wip_nav.genDebugFrameInner(loc, cfa) catch |err| switch (err) { | 1199 | return wip_func.genDebugFrameInner(loc, cfa) catch |err| switch (err) { |
| 1216 | error.WriteFailed => return wip_nav.dwarf.reportWriteError(&wip_nav.fde_writer), | | |
| 1217 | else => |e| return e, | 1200 | else => |e| return e, |
| | 1201 | error.WriteFailed => return wip_func.dwarf.reportWriteError(&wip_func.fde_writer), |
| 1218 | }; | 1202 | }; |
| 1219 | } | 1203 | } |
| 1220 | fn genDebugFrameInner(wip_nav: *WipNav, loc: u32, cfa: Cfa) link.EmitError!void { | 1204 | fn genDebugFrameInner(wip_func: *WipFunc, loc: u32, cfa: Cfa) link.EmitError!void { |
| 1221 | assert(wip_nav.func != .none); | | |
| 1222 | const loc_cfa: Cfa = .{ .advance_loc = loc }; | 1205 | const loc_cfa: Cfa = .{ .advance_loc = loc }; |
| 1223 | try loc_cfa.write(wip_nav); | 1206 | try loc_cfa.write(wip_func); |
| 1224 | try cfa.write(wip_nav); | 1207 | try cfa.write(wip_func); |
| 1225 | } | 1208 | } |
| 1226 | | 1209 | |
| 1227 | pub fn finishDebugFrameFde(wip_nav: *WipNav, func_length: u64) void { | 1210 | pub fn finishDebugFrameFde(wip_func: *WipFunc, func_length: u64) void { |
| 1228 | const dwarf = wip_nav.dwarf; | 1211 | const dwarf = wip_func.dwarf; |
| 1229 | const df_w = &wip_nav.fde_writer.interface; | 1212 | const df_w = &wip_func.fde_writer.interface; |
| 1230 | switch (wip_nav.frame_func_length.size) { | 1213 | switch (wip_func.frame_func_length.size) { |
| 1231 | _ => unreachable, | 1214 | _ => unreachable, |
| 1232 | .@"32" => std.mem.writeInt( | 1215 | .@"32" => std.mem.writeInt( |
| 1233 | u32, | 1216 | u32, |
| 1234 | df_w.buffered()[wip_nav.frame_func_length.offset..][0..4], | 1217 | df_w.buffered()[wip_func.frame_func_length.offset..][0..4], |
| 1235 | @intCast(func_length), | 1218 | @intCast(func_length), |
| 1236 | dwarf.endian, | 1219 | dwarf.endian, |
| 1237 | ), | 1220 | ), |
| 1238 | .@"64" => std.mem.writeInt( | 1221 | .@"64" => std.mem.writeInt( |
| 1239 | u64, | 1222 | u64, |
| 1240 | df_w.buffered()[wip_nav.frame_func_length.offset..][0..8], | 1223 | df_w.buffered()[wip_func.frame_func_length.offset..][0..8], |
| 1241 | func_length, | 1224 | func_length, |
| 1242 | dwarf.endian, | 1225 | dwarf.endian, |
| 1243 | ), | 1226 | ), |
| ... | @@ -1966,6 +1949,197 @@ pub fn genDebugRnglists( | ... | @@ -1966,6 +1949,197 @@ pub fn genDebugRnglists( |
| 1966 | try dr_w.writeByte(DW.RLE.end_of_list); | 1949 | try dr_w.writeByte(DW.RLE.end_of_list); |
| 1967 | } | 1950 | } |
| 1968 | | 1951 | |
| | 1952 | pub fn updateExtern( |
| | 1953 | dwarf: *Dwarf, |
| | 1954 | pt: Zcu.PerThread, |
| | 1955 | di_nw: *link.MappedFile.Node.Writer, |
| | 1956 | arch: std.Target.Cpu.Arch, |
| | 1957 | si: link.File.SymbolId, |
| | 1958 | global: InternPool.Nav.Index, |
| | 1959 | ) link.Error!void { |
| | 1960 | dwarf.updateExternInner(pt, di_nw, arch, si, global) catch |err| switch (err) { |
| | 1961 | else => |e| return e, |
| | 1962 | error.WriteFailed => return dwarf.reportWriteError(di_nw), |
| | 1963 | }; |
| | 1964 | } |
| | 1965 | fn updateExternInner( |
| | 1966 | dwarf: *Dwarf, |
| | 1967 | pt: Zcu.PerThread, |
| | 1968 | di_nw: *link.MappedFile.Node.Writer, |
| | 1969 | arch: std.Target.Cpu.Arch, |
| | 1970 | si: link.File.SymbolId, |
| | 1971 | global: InternPool.Nav.Index, |
| | 1972 | ) link.EmitError!void { |
| | 1973 | const zcu = pt.zcu; |
| | 1974 | const ip = &zcu.intern_pool; |
| | 1975 | const nav = ip.getNav(global); |
| | 1976 | log.debug("updateExtern({f})", .{nav.fqn.fmt(ip)}); |
| | 1977 | const nav_align, const nav_const, const nav_threadlocal, const nav_extern = nav_resolved: { |
| | 1978 | const nav_resolved = nav.resolved.?; |
| | 1979 | break :nav_resolved .{ |
| | 1980 | nav_resolved.@"align", |
| | 1981 | nav_resolved.@"const", |
| | 1982 | nav_resolved.@"threadlocal", |
| | 1983 | ip.indexToKey(nav_resolved.value).@"extern", |
| | 1984 | }; |
| | 1985 | }; |
| | 1986 | const inst_info = nav.srcInst(ip).resolveFull(ip).?; |
| | 1987 | const decl = switch (nav_extern.source) { |
| | 1988 | .builtin => undefined, |
| | 1989 | .syntax => zcu.fileByIndex(inst_info.file).zir.?.getDeclaration(inst_info.inst), |
| | 1990 | }; |
| | 1991 | const maybe_func_type = switch (ip.indexToKey(nav_extern.ty)) { |
| | 1992 | .func_type => |func_type| func_type, |
| | 1993 | else => null, |
| | 1994 | }; |
| | 1995 | const is_empty = if (maybe_func_type) |func_type| func_type.param_types.len == 0 and |
| | 1996 | !func_type.is_var_args else undefined; |
| | 1997 | const di_w = &di_nw.interface; |
| | 1998 | switch (nav_extern.source) { |
| | 1999 | .builtin => { |
| | 2000 | try dwarf.abbrevCode(di_nw, if (maybe_func_type) |_| |
| | 2001 | if (is_empty) .builtin_extern_empty_func else .builtin_extern_func |
| | 2002 | else |
| | 2003 | .builtin_extern_var); |
| | 2004 | try dwarf.refType(pt, di_nw, .fromInterned(zcu.fileRootType(inst_info.file))); |
| | 2005 | }, |
| | 2006 | .syntax => if (maybe_func_type) |_| { |
| | 2007 | try dwarf.abbrevCode( |
| | 2008 | di_nw, |
| | 2009 | if (is_empty) .decl_extern_empty_func else .decl_extern_func, |
| | 2010 | ); |
| | 2011 | try dwarf.refType(pt, di_nw, .fromInterned(zcu.fileRootType(inst_info.file))); |
| | 2012 | try di_w.writeInt(u32, decl.src_line + 1, dwarf.endian); |
| | 2013 | try di_w.writeUleb128(decl.src_column + 1); |
| | 2014 | try di_w.writeByte(if (decl.is_pub) DW.ACCESS.public else DW.ACCESS.private); |
| | 2015 | try dwarf.strp(&dwarf.debug_str, di_nw, nav.name.toSlice(ip)); |
| | 2016 | } else { |
| | 2017 | try dwarf.abbrevCode(di_nw, .decl_var); |
| | 2018 | try dwarf.refType(pt, di_nw, .fromInterned(zcu.fileRootType(inst_info.file))); |
| | 2019 | try di_w.writeInt(u32, decl.src_line + 1, dwarf.endian); |
| | 2020 | try di_w.writeUleb128(decl.src_column + 1); |
| | 2021 | try di_w.writeByte(if (decl.is_pub) DW.ACCESS.public else DW.ACCESS.private); |
| | 2022 | try dwarf.strp(&dwarf.debug_str, di_nw, nav.name.toSlice(ip)); |
| | 2023 | }, |
| | 2024 | } |
| | 2025 | try dwarf.strp(&dwarf.debug_str, di_nw, nav_extern.name.toSlice(ip)); |
| | 2026 | if (maybe_func_type) |func_type| { |
| | 2027 | try dwarf.refType(pt, di_nw, .fromInterned(func_type.return_type)); |
| | 2028 | try dwarf.addrSym(di_nw, si, 0); |
| | 2029 | try di_w.writeByte(@intFromBool(Type.fromInterned(func_type.return_type).isNoReturn(zcu))); |
| | 2030 | for (func_type.param_types.get(ip)) |param_type| { |
| | 2031 | try dwarf.abbrevCode(di_nw, .extern_param); |
| | 2032 | try dwarf.refType(pt, di_nw, .fromInterned(param_type)); |
| | 2033 | } |
| | 2034 | if (func_type.is_var_args) try dwarf.abbrevCode(di_nw, .is_var_args); |
| | 2035 | if (!is_empty) try di_w.writeUleb128(@backingInt(AbbrevCode.null)); |
| | 2036 | } else { |
| | 2037 | const addr: Loc = .{ .addr_reloc = si }; |
| | 2038 | const loc: Loc = if (nav_threadlocal) switch (arch) { |
| | 2039 | .x86_64 => .{ .form_tls_address = &addr }, |
| | 2040 | else => unreachable, |
| | 2041 | } else addr; |
| | 2042 | const type_offset = di_w.end; |
| | 2043 | if (nav_const) |
| | 2044 | try dwarf.secOffsetPlaceholder(di_w) |
| | 2045 | else |
| | 2046 | try dwarf.refType(pt, di_nw, .fromInterned(nav_extern.ty)); |
| | 2047 | try dwarf.exprLoc(di_nw, loc); |
| | 2048 | try di_w.writeUleb128(nav_align.toByteUnits() orelse |
| | 2049 | Type.fromInterned(nav_extern.ty).abiAlignment(zcu).toByteUnits().?); |
| | 2050 | switch (nav_extern.source) { |
| | 2051 | .builtin => {}, |
| | 2052 | .syntax => try di_w.writeByte(@intFromBool(decl.linkage != .normal)), |
| | 2053 | } |
| | 2054 | if (nav_const) { |
| | 2055 | try dwarf.secOffsetFinish(di_nw, type_offset, di_nw.ni, di_w.end); |
| | 2056 | try dwarf.abbrevCode(di_nw, .is_const); |
| | 2057 | try dwarf.refType(pt, di_nw, .fromInterned(nav_extern.ty)); |
| | 2058 | } |
| | 2059 | } |
| | 2060 | try dwarf.genDebugInfoPadding(di_w, di_w.unusedCapacityLen()); |
| | 2061 | } |
| | 2062 | |
| | 2063 | pub fn updateGlobal( |
| | 2064 | dwarf: *Dwarf, |
| | 2065 | pt: Zcu.PerThread, |
| | 2066 | di_nw: *link.MappedFile.Node.Writer, |
| | 2067 | arch: std.Target.Cpu.Arch, |
| | 2068 | si: link.File.SymbolId, |
| | 2069 | global: InternPool.Nav.Index, |
| | 2070 | ) link.Error!void { |
| | 2071 | const ip = &pt.zcu.intern_pool; |
| | 2072 | log.debug("updateGlobal({f})", .{ip.getNav(global).fqn.fmt(ip)}); |
| | 2073 | dwarf.updateGlobalInner(pt, di_nw, arch, si, global) catch |err| switch (err) { |
| | 2074 | else => |e| return e, |
| | 2075 | error.WriteFailed => return dwarf.reportWriteError(di_nw), |
| | 2076 | }; |
| | 2077 | } |
| | 2078 | fn updateGlobalInner( |
| | 2079 | dwarf: *Dwarf, |
| | 2080 | pt: Zcu.PerThread, |
| | 2081 | di_nw: *link.MappedFile.Node.Writer, |
| | 2082 | arch: std.Target.Cpu.Arch, |
| | 2083 | si: link.File.SymbolId, |
| | 2084 | global: InternPool.Nav.Index, |
| | 2085 | ) link.EmitError!void { |
| | 2086 | const zcu = pt.zcu; |
| | 2087 | const ip = &zcu.intern_pool; |
| | 2088 | const nav = ip.getNav(global); |
| | 2089 | const nav_ty: Type, const nav_align, const nav_const, const nav_threadlocal = nav_resolved: { |
| | 2090 | const nav_resolved = nav.resolved.?; |
| | 2091 | break :nav_resolved .{ |
| | 2092 | .fromInterned(nav_resolved.type), |
| | 2093 | nav_resolved.@"align", |
| | 2094 | nav_resolved.@"const", |
| | 2095 | nav_resolved.@"threadlocal", |
| | 2096 | }; |
| | 2097 | }; |
| | 2098 | const inst_info = nav.srcInst(ip).resolveFull(ip).?; |
| | 2099 | const decl = zcu.fileByIndex(inst_info.file).zir.?.getDeclaration(inst_info.inst); |
| | 2100 | switch (decl.kind) { |
| | 2101 | .unnamed_test, .@"test", .decltest, .@"comptime" => unreachable, |
| | 2102 | .@"const" => assert(nav_const), |
| | 2103 | .@"var" => assert(!nav_const), |
| | 2104 | } |
| | 2105 | const parent_ty: Type = .fromInterned(ip.namespacePtr(nav.analysis.?.namespace).owner_type); |
| | 2106 | const di_w = &di_nw.interface; |
| | 2107 | if (parent_ty.getCaptures(zcu).len > 0) { |
| | 2108 | try dwarf.abbrevCode(di_nw, .decl_instance_var); |
| | 2109 | try dwarf.refType(pt, di_nw, parent_ty); |
| | 2110 | try dwarf.secOffset(di_nw, try dwarf.getGlobalDecl(pt, global), 0); |
| | 2111 | } else { |
| | 2112 | const parent_ni = try dwarf.getConstDecl(pt, parent_ty.toIntern()); |
| | 2113 | try dwarf.abbrevCode(di_nw, .decl_var); |
| | 2114 | try dwarf.secOffset(di_nw, parent_ni, 0); |
| | 2115 | try di_w.writeInt(u32, decl.src_line + 1, dwarf.endian); |
| | 2116 | try di_w.writeUleb128(decl.src_column + 1); |
| | 2117 | try di_w.writeByte(if (decl.is_pub) DW.ACCESS.public else DW.ACCESS.private); |
| | 2118 | try dwarf.strp(&dwarf.debug_str, di_nw, nav.name.toSlice(ip)); |
| | 2119 | } |
| | 2120 | try dwarf.strp(&dwarf.debug_str, di_nw, switch (decl.linkage) { |
| | 2121 | .normal => nav.fqn, |
| | 2122 | .@"extern" => unreachable, |
| | 2123 | .@"export" => nav.name, |
| | 2124 | }.toSlice(ip)); |
| | 2125 | const addr: Loc = .{ .addr_reloc = si }; |
| | 2126 | const loc: Loc = if (nav_threadlocal) switch (arch) { |
| | 2127 | .x86_64 => .{ .form_tls_address = &addr }, |
| | 2128 | else => unreachable, |
| | 2129 | } else addr; |
| | 2130 | const type_offset = di_w.end; |
| | 2131 | if (nav_const) try dwarf.secOffsetPlaceholder(di_w) else try dwarf.refType(pt, di_nw, nav_ty); |
| | 2132 | try dwarf.exprLoc(di_nw, loc); |
| | 2133 | try di_w.writeUleb128(nav_align.toByteUnits() orelse nav_ty.abiAlignment(zcu).toByteUnits().?); |
| | 2134 | try di_w.writeByte(@intFromBool(decl.linkage != .normal)); |
| | 2135 | if (nav_const) { |
| | 2136 | try dwarf.secOffsetFinish(di_nw, type_offset, di_nw.ni, di_w.end); |
| | 2137 | try dwarf.abbrevCode(di_nw, .is_const); |
| | 2138 | try dwarf.refType(pt, di_nw, nav_ty); |
| | 2139 | } |
| | 2140 | try dwarf.genDebugInfoPadding(di_w, di_w.unusedCapacityLen()); |
| | 2141 | } |
| | 2142 | |
| 1969 | pub fn updateComptimeGlobal( | 2143 | pub fn updateComptimeGlobal( |
| 1970 | dwarf: *Dwarf, | 2144 | dwarf: *Dwarf, |
| 1971 | pt: Zcu.PerThread, | 2145 | pt: Zcu.PerThread, |
| ... | @@ -2010,30 +2184,30 @@ pub fn updateComptimeGlobal( | ... | @@ -2010,30 +2184,30 @@ pub fn updateComptimeGlobal( |
| 2010 | .aggregate, | 2184 | .aggregate, |
| 2011 | .un, | 2185 | .un, |
| 2012 | .bitpack, | 2186 | .bitpack, |
| 2013 | => try dwarf.genGlobal(pt, global, &decl), | 2187 | => try dwarf.genComptimeGlobal(pt, global, &decl), |
| 2014 | .struct_type => { | 2188 | .struct_type => { |
| 2015 | const loaded_struct = ip.loadStructType(nav_val.toIntern()); | 2189 | const loaded_struct = ip.loadStructType(nav_val.toIntern()); |
| 2016 | if (global.toOptional() == loaded_struct.name_nav) { | 2190 | if (global.toOptional() == loaded_struct.name_nav) { |
| 2017 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()); | 2191 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()); |
| 2018 | } else try dwarf.genGlobal(pt, global, &decl); | 2192 | } else try dwarf.genComptimeGlobal(pt, global, &decl); |
| 2019 | }, | 2193 | }, |
| 2020 | .enum_type => { | 2194 | .enum_type => { |
| 2021 | const loaded_enum = ip.loadEnumType(nav_val.toIntern()); | 2195 | const loaded_enum = ip.loadEnumType(nav_val.toIntern()); |
| 2022 | if (global.toOptional() == loaded_enum.name_nav) { | 2196 | if (global.toOptional() == loaded_enum.name_nav) { |
| 2023 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()); | 2197 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()); |
| 2024 | } else try dwarf.genGlobal(pt, global, &decl); | 2198 | } else try dwarf.genComptimeGlobal(pt, global, &decl); |
| 2025 | }, | 2199 | }, |
| 2026 | .union_type => { | 2200 | .union_type => { |
| 2027 | const loaded_union = ip.loadUnionType(nav_val.toIntern()); | 2201 | const loaded_union = ip.loadUnionType(nav_val.toIntern()); |
| 2028 | if (global.toOptional() == loaded_union.name_nav) { | 2202 | if (global.toOptional() == loaded_union.name_nav) { |
| 2029 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()); | 2203 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()); |
| 2030 | } else try dwarf.genGlobal(pt, global, &decl); | 2204 | } else try dwarf.genComptimeGlobal(pt, global, &decl); |
| 2031 | }, | 2205 | }, |
| 2032 | .opaque_type => { | 2206 | .opaque_type => { |
| 2033 | const loaded_opaque = ip.loadOpaqueType(nav_val.toIntern()); | 2207 | const loaded_opaque = ip.loadOpaqueType(nav_val.toIntern()); |
| 2034 | if (global.toOptional() == loaded_opaque.name_nav) { | 2208 | if (global.toOptional() == loaded_opaque.name_nav) { |
| 2035 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()); | 2209 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()); |
| 2036 | } else try dwarf.genGlobal(pt, global, &decl); | 2210 | } else try dwarf.genComptimeGlobal(pt, global, &decl); |
| 2037 | }, | 2211 | }, |
| 2038 | .@"extern" => unreachable, | 2212 | .@"extern" => unreachable, |
| 2039 | .func => |func| if (func.owner_nav == global and func.generic_owner == .none) { | 2213 | .func => |func| if (func.owner_nav == global and func.generic_owner == .none) { |
| ... | @@ -2042,26 +2216,28 @@ pub fn updateComptimeGlobal( | ... | @@ -2042,26 +2216,28 @@ pub fn updateComptimeGlobal( |
| 2042 | .memoized_call => unreachable, // not a value | 2216 | .memoized_call => unreachable, // not a value |
| 2043 | } | 2217 | } |
| 2044 | } | 2218 | } |
| 2045 | fn genGlobal( | 2219 | fn genComptimeGlobal( |
| 2046 | dwarf: *Dwarf, | 2220 | dwarf: *Dwarf, |
| 2047 | pt: Zcu.PerThread, | 2221 | pt: Zcu.PerThread, |
| 2048 | global: InternPool.Nav.Index, | 2222 | global: InternPool.Nav.Index, |
| 2049 | decl: *const std.zig.Zir.Inst.Declaration.Unwrapped, | 2223 | decl: *const std.zig.Zir.Inst.Declaration.Unwrapped, |
| 2050 | ) link.Error!void { | 2224 | ) link.Error!void { |
| | 2225 | const gpa = pt.zcu.gpa; |
| 2051 | const gi = try dwarf.getGlobal(global); | 2226 | const gi = try dwarf.getGlobal(global); |
| 2052 | const debug_info_ni = gi.get(dwarf).debug_info_ni.unwrap().?; | 2227 | const debug_info_ni = gi.get(dwarf).debug_info_ni.unwrap().?; |
| 2053 | var di_nw: link.MappedFile.Node.Writer = undefined; | 2228 | var di_nw: link.MappedFile.Node.Writer = undefined; |
| 2054 | if (dwarf.lf.cast(.elf2)) |elf| { | 2229 | if (dwarf.lf.cast(.elf2)) |elf| { |
| 2055 | debug_info_ni.writer(pt.zcu.gpa, &elf.mf, &di_nw); | 2230 | try debug_info_ni.moved(gpa, &elf.mf); |
| | 2231 | debug_info_ni.writer(gpa, &elf.mf, &di_nw); |
| 2056 | elf.resetNodeRelocs(debug_info_ni); | 2232 | elf.resetNodeRelocs(debug_info_ni); |
| 2057 | } else unreachable; | 2233 | } else unreachable; |
| 2058 | defer di_nw.deinit(); | 2234 | defer di_nw.deinit(); |
| 2059 | dwarf.genGlobalInner(pt, &di_nw, global, decl) catch |err| switch (err) { | 2235 | dwarf.genComptimeGlobalInner(pt, &di_nw, global, decl) catch |err| switch (err) { |
| 2060 | error.WriteFailed => return dwarf.reportWriteError(&di_nw), | | |
| 2061 | else => |e| return e, | 2236 | else => |e| return e, |
| | 2237 | error.WriteFailed => return dwarf.reportWriteError(&di_nw), |
| 2062 | }; | 2238 | }; |
| 2063 | } | 2239 | } |
| 2064 | fn genGlobalInner( | 2240 | fn genComptimeGlobalInner( |
| 2065 | dwarf: *Dwarf, | 2241 | dwarf: *Dwarf, |
| 2066 | pt: Zcu.PerThread, | 2242 | pt: Zcu.PerThread, |
| 2067 | di_nw: *link.MappedFile.Node.Writer, | 2243 | di_nw: *link.MappedFile.Node.Writer, |
| ... | @@ -2071,40 +2247,40 @@ fn genGlobalInner( | ... | @@ -2071,40 +2247,40 @@ fn genGlobalInner( |
| 2071 | const zcu = pt.zcu; | 2247 | const zcu = pt.zcu; |
| 2072 | const ip = &zcu.intern_pool; | 2248 | const ip = &zcu.intern_pool; |
| 2073 | const nav = ip.getNav(global); | 2249 | const nav = ip.getNav(global); |
| 2074 | const nav_const, const nav_ty: Type, const nav_align, const nav_val: Value = nav_resolved: { | 2250 | const nav_ty: Type, const nav_align, const nav_const, const nav_val: Value = nav_resolved: { |
| 2075 | const nav_resolved = nav.resolved.?; | 2251 | const nav_resolved = nav.resolved.?; |
| 2076 | break :nav_resolved .{ | 2252 | break :nav_resolved .{ |
| 2077 | nav_resolved.@"const", | | |
| 2078 | .fromInterned(nav_resolved.type), | 2253 | .fromInterned(nav_resolved.type), |
| 2079 | nav_resolved.@"align", | 2254 | nav_resolved.@"align", |
| | 2255 | nav_resolved.@"const", |
| 2080 | .fromInterned(nav_resolved.value), | 2256 | .fromInterned(nav_resolved.value), |
| 2081 | }; | 2257 | }; |
| 2082 | }; | 2258 | }; |
| 2083 | const nav_class = nav_ty.classify(zcu); | 2259 | const nav_class = nav_ty.classify(zcu); |
| 2084 | const parent_ty = ip.namespacePtr(nav.analysis.?.namespace).owner_type; | 2260 | const parent_ty: Type = .fromInterned(ip.namespacePtr(nav.analysis.?.namespace).owner_type); |
| 2085 | const di_w = &di_nw.interface; | 2261 | const di_w = &di_nw.interface; |
| 2086 | if (Type.fromInterned(parent_ty).getCaptures(zcu).len > 0) { | 2262 | if (parent_ty.getCaptures(zcu).len > 0) { |
| 2087 | try dwarf.abbrevCode(di_nw, switch (nav_ty.toIntern()) { | 2263 | try dwarf.abbrevCode(di_nw, switch (nav_ty.toIntern()) { |
| 2088 | .type_type => .decl_instance_type, | 2264 | .type_type => .decl_instance_type, |
| 2089 | else => if (nav_const) switch (nav_class) { | 2265 | else => switch (nav_class) { |
| 2090 | .no_possible_value, .one_possible_value => .decl_instance_const, | 2266 | .no_possible_value, .one_possible_value => .decl_instance_const, |
| 2091 | .runtime => .decl_instance_const_fully_runtime, | 2267 | .runtime => .decl_instance_const_fully_runtime, |
| 2092 | .partially_comptime => .decl_instance_const_partially_comptime, | 2268 | .partially_comptime => .decl_instance_const_partially_comptime, |
| 2093 | .fully_comptime => .decl_instance_const_fully_comptime, | 2269 | .fully_comptime => .decl_instance_const_fully_comptime, |
| 2094 | } else .decl_instance_var, | 2270 | }, |
| 2095 | }); | 2271 | }); |
| 2096 | try dwarf.refType(pt, di_nw, .fromInterned(parent_ty)); | 2272 | try dwarf.refType(pt, di_nw, parent_ty); |
| 2097 | try dwarf.secOffset(di_nw, try dwarf.getGlobalDecl(pt, global), 0); | 2273 | try dwarf.secOffset(di_nw, try dwarf.getGlobalDecl(pt, global), 0); |
| 2098 | } else { | 2274 | } else { |
| 2099 | const parent_ni = try dwarf.getConstDecl(pt, parent_ty); | 2275 | const parent_ni = try dwarf.getConstDecl(pt, parent_ty.toIntern()); |
| 2100 | try dwarf.abbrevCode(di_nw, switch (nav_ty.toIntern()) { | 2276 | try dwarf.abbrevCode(di_nw, switch (nav_ty.toIntern()) { |
| 2101 | .type_type => .decl_type, | 2277 | .type_type => .decl_type, |
| 2102 | else => if (nav_const) switch (nav_class) { | 2278 | else => switch (nav_class) { |
| 2103 | .no_possible_value, .one_possible_value => .decl_const, | 2279 | .no_possible_value, .one_possible_value => .decl_const, |
| 2104 | .runtime => .decl_const_fully_runtime, | 2280 | .runtime => .decl_const_fully_runtime, |
| 2105 | .partially_comptime => .decl_const_partially_comptime, | 2281 | .partially_comptime => .decl_const_partially_comptime, |
| 2106 | .fully_comptime => .decl_const_fully_comptime, | 2282 | .fully_comptime => .decl_const_fully_comptime, |
| 2107 | } else .decl_var, | 2283 | }, |
| 2108 | }); | 2284 | }); |
| 2109 | try dwarf.secOffset(di_nw, parent_ni, 0); | 2285 | try dwarf.secOffset(di_nw, parent_ni, 0); |
| 2110 | try di_w.writeInt(u32, decl.src_line + 1, dwarf.endian); | 2286 | try di_w.writeInt(u32, decl.src_line + 1, dwarf.endian); |
| ... | @@ -2120,16 +2296,16 @@ fn genGlobalInner( | ... | @@ -2120,16 +2296,16 @@ fn genGlobalInner( |
| 2120 | .@"extern", .@"export" => nav.name, | 2296 | .@"extern", .@"export" => nav.name, |
| 2121 | }.toSlice(ip)); | 2297 | }.toSlice(ip)); |
| 2122 | const type_offset = di_w.end; | 2298 | const type_offset = di_w.end; |
| 2123 | if (nav_const) try dwarf.secOffsetPlaceholder(di_w) else { | 2299 | if (nav_const) |
| | 2300 | try dwarf.secOffsetPlaceholder(di_w) |
| | 2301 | else |
| 2124 | try dwarf.refType(pt, di_nw, nav_ty); | 2302 | try dwarf.refType(pt, di_nw, nav_ty); |
| 2125 | try dwarf.blockConst(pt, di_nw, nav_val); | | |
| 2126 | } | | |
| 2127 | try di_w.writeUleb128(nav_align.toByteUnits() orelse | 2303 | try di_w.writeUleb128(nav_align.toByteUnits() orelse |
| 2128 | nav_ty.abiAlignment(zcu).toByteUnits().?); | 2304 | nav_ty.abiAlignment(zcu).toByteUnits().?); |
| 2129 | try di_w.writeByte(@intFromBool(decl.linkage != .normal)); | 2305 | try di_w.writeByte(@intFromBool(decl.linkage != .normal)); |
| | 2306 | if (nav_class.hasRuntimeBits()) try dwarf.blockConst(pt, di_nw, nav_val); |
| | 2307 | if (nav_class.comptimeOnly()) try dwarf.refConst(pt, di_nw, nav_val); |
| 2130 | if (nav_const) { | 2308 | if (nav_const) { |
| 2131 | if (nav_class.hasRuntimeBits()) try dwarf.blockConst(pt, di_nw, nav_val); | | |
| 2132 | if (nav_class.comptimeOnly()) try dwarf.refConst(pt, di_nw, nav_val); | | |
| 2133 | try dwarf.secOffsetFinish(di_nw, type_offset, di_nw.ni, di_w.end); | 2309 | try dwarf.secOffsetFinish(di_nw, type_offset, di_nw.ni, di_w.end); |
| 2134 | try dwarf.abbrevCode(di_nw, .is_const); | 2310 | try dwarf.abbrevCode(di_nw, .is_const); |
| 2135 | try dwarf.refType(pt, di_nw, nav_ty); | 2311 | try dwarf.refType(pt, di_nw, nav_ty); |
| ... | @@ -2229,36 +2405,34 @@ fn updateConstInner( | ... | @@ -2229,36 +2405,34 @@ fn updateConstInner( |
| 2229 | const name = try zcu.gpa.print("{f}", .{Type.fromInterned(val).fmt(pt)}); | 2405 | const name = try zcu.gpa.print("{f}", .{Type.fromInterned(val).fmt(pt)}); |
| 2230 | defer zcu.gpa.free(name); | 2406 | defer zcu.gpa.free(name); |
| 2231 | try dwarf.abbrevCode(di_nw, switch (ptr_type.sentinel) { | 2407 | try dwarf.abbrevCode(di_nw, switch (ptr_type.sentinel) { |
| 2232 | .none => switch (ptr_type.flags.alignment) { | 2408 | .none => .ptr_type, |
| 2233 | .none => .ptr_type, | 2409 | else => .ptr_sentinel_type, |
| 2234 | else => .ptr_aligned_type, | | |
| 2235 | }, | | |
| 2236 | else => switch (ptr_type.flags.alignment) { | | |
| 2237 | .none => .ptr_sentinel_type, | | |
| 2238 | else => .ptr_aligned_sentinel_type, | | |
| 2239 | }, | | |
| 2240 | }); | 2410 | }); |
| 2241 | try dwarf.strp(&dwarf.debug_str, di_nw, name); | 2411 | try dwarf.strp(&dwarf.debug_str, di_nw, name); |
| 2242 | switch (ptr_type.sentinel) { | 2412 | switch (ptr_type.sentinel) { |
| 2243 | .none => {}, | 2413 | .none => {}, |
| 2244 | else => |sentinel| try dwarf.blockConst(pt, di_nw, .fromInterned(sentinel)), | 2414 | else => |sentinel| try dwarf.blockConst(pt, di_nw, .fromInterned(sentinel)), |
| 2245 | } | 2415 | } |
| 2246 | if (ptr_type.flags.alignment.toByteUnits()) |a| try di_w.writeUleb128(a); | | |
| 2247 | try di_w.writeByte(@backingInt(ptr_type.flags.address_space)); | 2416 | try di_w.writeByte(@backingInt(ptr_type.flags.address_space)); |
| 2248 | if (ptr_type.flags.is_const or ptr_type.flags.is_volatile) try dwarf.secOffset( | 2417 | if (ptr_type.flags.alignment.toByteUnits()) |a| { |
| 2249 | di_nw, | 2418 | const type_offset = di_w.end; |
| 2250 | di_nw.ni, | 2419 | try dwarf.secOffsetPlaceholder(di_w); |
| 2251 | di_w.end + dwarf.secOffsetSize(), | 2420 | try dwarf.secOffsetFinish(di_nw, type_offset, di_nw.ni, di_w.end); |
| 2252 | ); | 2421 | try dwarf.abbrevCode(di_nw, .is_aligned); |
| | 2422 | try di_w.writeUleb128(a); |
| | 2423 | } |
| 2253 | if (ptr_type.flags.is_const) { | 2424 | if (ptr_type.flags.is_const) { |
| | 2425 | const type_offset = di_w.end; |
| | 2426 | try dwarf.secOffsetPlaceholder(di_w); |
| | 2427 | try dwarf.secOffsetFinish(di_nw, type_offset, di_nw.ni, di_w.end); |
| 2254 | try dwarf.abbrevCode(di_nw, .is_const); | 2428 | try dwarf.abbrevCode(di_nw, .is_const); |
| 2255 | if (ptr_type.flags.is_volatile) try dwarf.secOffset( | | |
| 2256 | di_nw, | | |
| 2257 | di_nw.ni, | | |
| 2258 | di_w.end + dwarf.secOffsetSize(), | | |
| 2259 | ); | | |
| 2260 | } | 2429 | } |
| 2261 | if (ptr_type.flags.is_volatile) try dwarf.abbrevCode(di_nw, .is_volatile); | 2430 | if (ptr_type.flags.is_volatile) { |
| | 2431 | const type_offset = di_w.end; |
| | 2432 | try dwarf.secOffsetPlaceholder(di_w); |
| | 2433 | try dwarf.secOffsetFinish(di_nw, type_offset, di_nw.ni, di_w.end); |
| | 2434 | try dwarf.abbrevCode(di_nw, .is_volatile); |
| | 2435 | } |
| 2262 | try dwarf.refType(pt, di_nw, .fromInterned(ptr_type.child)); | 2436 | try dwarf.refType(pt, di_nw, .fromInterned(ptr_type.child)); |
| 2263 | }, | 2437 | }, |
| 2264 | .slice => { | 2438 | .slice => { |
| ... | @@ -2328,8 +2502,10 @@ fn updateConstInner( | ... | @@ -2328,8 +2502,10 @@ fn updateConstInner( |
| 2328 | }, | 2502 | }, |
| 2329 | .unpacked, .error_set, .pointer => { | 2503 | .unpacked, .error_set, .pointer => { |
| 2330 | try dwarf.abbrevCode(di_nw, .tagged_union); | 2504 | try dwarf.abbrevCode(di_nw, .tagged_union); |
| 2331 | try dwarf.secOffset(di_nw, di_nw.ni, di_w.end + dwarf.secOffsetSize()); | 2505 | const discr_offset = di_w.end; |
| | 2506 | try dwarf.secOffsetPlaceholder(di_w); |
| 2332 | { | 2507 | { |
| | 2508 | try dwarf.secOffsetFinish(di_nw, discr_offset, di_nw.ni, di_w.end); |
| 2333 | try dwarf.abbrevCode(di_nw, .generated_field); | 2509 | try dwarf.abbrevCode(di_nw, .generated_field); |
| 2334 | try dwarf.strp(&dwarf.debug_str, di_nw, "has_value"); | 2510 | try dwarf.strp(&dwarf.debug_str, di_nw, "has_value"); |
| 2335 | switch (opt_repr) { | 2511 | switch (opt_repr) { |
| ... | @@ -2342,7 +2518,10 @@ fn updateConstInner( | ... | @@ -2342,7 +2518,10 @@ fn updateConstInner( |
| 2342 | 0); | 2518 | 0); |
| 2343 | }, | 2519 | }, |
| 2344 | .error_set => { | 2520 | .error_set => { |
| 2345 | try dwarf.refType(pt, di_nw, try pt.intType(.unsigned, zcu.errorSetBits())); | 2521 | try dwarf.refType(pt, di_nw, try pt.intType( |
| | 2522 | .unsigned, |
| | 2523 | zcu.errorSetBits(), |
| | 2524 | )); |
| 2346 | try di_w.writeUleb128(0); | 2525 | try di_w.writeUleb128(0); |
| 2347 | }, | 2526 | }, |
| 2348 | .pointer => { | 2527 | .pointer => { |
| ... | @@ -2404,8 +2583,10 @@ fn updateConstInner( | ... | @@ -2404,8 +2583,10 @@ fn updateConstInner( |
| 2404 | } | 2583 | } |
| 2405 | { | 2584 | { |
| 2406 | try dwarf.abbrevCode(di_nw, .tagged_union); | 2585 | try dwarf.abbrevCode(di_nw, .tagged_union); |
| 2407 | try dwarf.secOffset(di_nw, di_nw.ni, di_w.end + dwarf.secOffsetSize()); | 2586 | const discr_offset = di_w.end; |
| | 2587 | try dwarf.secOffsetPlaceholder(di_w); |
| 2408 | { | 2588 | { |
| | 2589 | try dwarf.secOffsetFinish(di_nw, discr_offset, di_nw.ni, di_w.end); |
| 2409 | try dwarf.abbrevCode(di_nw, .generated_field); | 2590 | try dwarf.abbrevCode(di_nw, .generated_field); |
| 2410 | try dwarf.strp(&dwarf.debug_str, di_nw, "is_error"); | 2591 | try dwarf.strp(&dwarf.debug_str, di_nw, "is_error"); |
| 2411 | try dwarf.refType(pt, di_nw, try pt.intType(.unsigned, zcu.errorSetBits())); | 2592 | try dwarf.refType(pt, di_nw, try pt.intType(.unsigned, zcu.errorSetBits())); |
| ... | @@ -2771,8 +2952,10 @@ fn updateConstInner( | ... | @@ -2771,8 +2952,10 @@ fn updateConstInner( |
| 2771 | try dwarf.genCaptures(pt, di_nw, loaded_union.captures); | 2952 | try dwarf.genCaptures(pt, di_nw, loaded_union.captures); |
| 2772 | if (loaded_union.has_runtime_tag) { | 2953 | if (loaded_union.has_runtime_tag) { |
| 2773 | try dwarf.abbrevCode(di_nw, .tagged_union); | 2954 | try dwarf.abbrevCode(di_nw, .tagged_union); |
| 2774 | try dwarf.secOffset(di_nw, di_nw.ni, di_w.end + dwarf.secOffsetSize()); | 2955 | const discr_offset = di_w.end; |
| | 2956 | try dwarf.secOffsetPlaceholder(di_w); |
| 2775 | { | 2957 | { |
| | 2958 | try dwarf.secOffsetFinish(di_nw, discr_offset, di_nw.ni, di_w.end); |
| 2776 | try dwarf.abbrevCode(di_nw, .generated_field); | 2959 | try dwarf.abbrevCode(di_nw, .generated_field); |
| 2777 | try dwarf.strp(&dwarf.debug_str, di_nw, "tag"); | 2960 | try dwarf.strp(&dwarf.debug_str, di_nw, "tag"); |
| 2778 | try dwarf.refType(pt, di_nw, .fromInterned(loaded_union.enum_tag_type)); | 2961 | try dwarf.refType(pt, di_nw, .fromInterned(loaded_union.enum_tag_type)); |
| ... | @@ -4084,8 +4267,11 @@ fn refAbbrevCode( | ... | @@ -4084,8 +4267,11 @@ fn refAbbrevCode( |
| 4084 | @branchHint(.likely); | 4267 | @branchHint(.likely); |
| 4085 | return backing_int; | 4268 | return backing_int; |
| 4086 | } | 4269 | } |
| | 4270 | const gpa = dwarf.lf.comp.gpa; |
| | 4271 | const debug_abbrev_ni = dwarf.debug_abbrev.ni.unwrap().?; |
| | 4272 | try debug_abbrev_ni.moved(gpa, mf); |
| 4087 | var da_nw: link.MappedFile.Node.Writer = undefined; | 4273 | var da_nw: link.MappedFile.Node.Writer = undefined; |
| 4088 | dwarf.debug_abbrev.ni.unwrap().?.writer(dwarf.lf.comp.gpa, mf, &da_nw); | 4274 | debug_abbrev_ni.writer(gpa, mf, &da_nw); |
| 4089 | defer da_nw.deinit(); | 4275 | defer da_nw.deinit(); |
| 4090 | dwarf.genDebugAbbrev(&da_nw, abbrev_code) catch |err| switch (err) { | 4276 | dwarf.genDebugAbbrev(&da_nw, abbrev_code) catch |err| switch (err) { |
| 4091 | else => |e| return e, | 4277 | else => |e| return e, |
| ... | @@ -4294,10 +4480,10 @@ fn exprLoc(dwarf: *Dwarf, nw: *link.MappedFile.Node.Writer, loc: Loc) link.EmitE | ... | @@ -4294,10 +4480,10 @@ fn exprLoc(dwarf: *Dwarf, nw: *link.MappedFile.Node.Writer, loc: Loc) link.EmitE |
| 4294 | fn strp(dwarf: *Dwarf, s: *Str, nw: *link.MappedFile.Node.Writer, str: []const u8) link.EmitError!void { | 4480 | fn strp(dwarf: *Dwarf, s: *Str, nw: *link.MappedFile.Node.Writer, str: []const u8) link.EmitError!void { |
| 4295 | const comp = dwarf.lf.comp; | 4481 | const comp = dwarf.lf.comp; |
| 4296 | try dwarf.secOffset(nw, s.ni.unwrap().?, s.get(comp.gpa, nw.mf, str) catch |err| switch (err) { | 4482 | try dwarf.secOffset(nw, s.ni.unwrap().?, s.get(comp.gpa, nw.mf, str) catch |err| switch (err) { |
| | 4483 | else => |e| return e, |
| 4297 | error.MappedFileIo => return comp.link_diags.fail("failed to write output file: {t}", .{ | 4484 | error.MappedFileIo => return comp.link_diags.fail("failed to write output file: {t}", .{ |
| 4298 | nw.mf.io_err.?, | 4485 | nw.mf.io_err.?, |
| 4299 | }), | 4486 | }), |
| 4300 | else => |e| return e, | | |
| 4301 | }); | 4487 | }); |
| 4302 | } | 4488 | } |
| 4303 | | 4489 | |
| ... | @@ -4433,8 +4619,6 @@ pub const AbbrevCode = enum { | ... | @@ -4433,8 +4619,6 @@ pub const AbbrevCode = enum { |
| 4433 | decl_instance_func, | 4619 | decl_instance_func, |
| 4434 | decl_instance_empty_func_generic, | 4620 | decl_instance_empty_func_generic, |
| 4435 | decl_instance_func_generic, | 4621 | decl_instance_func_generic, |
| 4436 | decl_instance_extern_empty_func, | | |
| 4437 | decl_instance_extern_func, | | |
| 4438 | // the rest are unrestricted other than empty variants must not be longer | 4622 | // the rest are unrestricted other than empty variants must not be longer |
| 4439 | // than the non-empty variant, and so should appear first | 4623 | // than the non-empty variant, and so should appear first |
| 4440 | compile_unit, | 4624 | compile_unit, |
| ... | @@ -4462,8 +4646,7 @@ pub const AbbrevCode = enum { | ... | @@ -4462,8 +4646,7 @@ pub const AbbrevCode = enum { |
| 4462 | inferred_error_set_type, | 4646 | inferred_error_set_type, |
| 4463 | ptr_type, | 4647 | ptr_type, |
| 4464 | ptr_sentinel_type, | 4648 | ptr_sentinel_type, |
| 4465 | ptr_aligned_type, | 4649 | is_aligned, |
| 4466 | ptr_aligned_sentinel_type, | | |
| 4467 | is_const, | 4650 | is_const, |
| 4468 | is_volatile, | 4651 | is_volatile, |
| 4469 | array_type, | 4652 | array_type, |
| ... | @@ -4522,7 +4705,7 @@ pub const AbbrevCode = enum { | ... | @@ -4522,7 +4705,7 @@ pub const AbbrevCode = enum { |
| 4522 | comptime_value_elem_runtime, | 4705 | comptime_value_elem_runtime, |
| 4523 | comptime_value_elem_comptime, | 4706 | comptime_value_elem_comptime, |
| 4524 | | 4707 | |
| 4525 | const decl_size = uleb128Size(@backingInt(AbbrevCode.decl_instance_extern_func)); | 4708 | const decl_size = uleb128Size(@backingInt(AbbrevCode.decl_func_generic)); |
| 4526 | comptime { | 4709 | comptime { |
| 4527 | assert(uleb128Size(@backingInt(AbbrevCode.pad_1)) == 1); | 4710 | assert(uleb128Size(@backingInt(AbbrevCode.pad_1)) == 1); |
| 4528 | assert(uleb128Size(@backingInt(AbbrevCode.pad_n)) == 1); | 4711 | assert(uleb128Size(@backingInt(AbbrevCode.pad_n)) == 1); |
| ... | @@ -5142,27 +5325,6 @@ pub const AbbrevCode = enum { | ... | @@ -5142,27 +5325,6 @@ pub const AbbrevCode = enum { |
| 5142 | .{ .type, .ref_addr }, | 5325 | .{ .type, .ref_addr }, |
| 5143 | }, | 5326 | }, |
| 5144 | }, | 5327 | }, |
| 5145 | .decl_instance_extern_empty_func = .{ | | |
| 5146 | .tag = .subprogram, | | |
| 5147 | .attrs = decl_instance_attrs ++ .{ | | |
| 5148 | .{ .linkage_name, .strp }, | | |
| 5149 | .{ .type, .ref_addr }, | | |
| 5150 | .{ .low_pc, .addr }, | | |
| 5151 | .{ .external, .flag_present }, | | |
| 5152 | .{ .noreturn, .flag }, | | |
| 5153 | }, | | |
| 5154 | }, | | |
| 5155 | .decl_instance_extern_func = .{ | | |
| 5156 | .tag = .subprogram, | | |
| 5157 | .children = true, | | |
| 5158 | .attrs = decl_instance_attrs ++ .{ | | |
| 5159 | .{ .linkage_name, .strp }, | | |
| 5160 | .{ .type, .ref_addr }, | | |
| 5161 | .{ .low_pc, .addr }, | | |
| 5162 | .{ .external, .flag_present }, | | |
| 5163 | .{ .noreturn, .flag }, | | |
| 5164 | }, | | |
| 5165 | }, | | |
| 5166 | .compile_unit = .{ | 5328 | .compile_unit = .{ |
| 5167 | .tag = .compile_unit, | 5329 | .tag = .compile_unit, |
| 5168 | .children = true, | 5330 | .children = true, |
| ... | @@ -5375,22 +5537,10 @@ pub const AbbrevCode = enum { | ... | @@ -5375,22 +5537,10 @@ pub const AbbrevCode = enum { |
| 5375 | .{ .type, .ref_addr }, | 5537 | .{ .type, .ref_addr }, |
| 5376 | }, | 5538 | }, |
| 5377 | }, | 5539 | }, |
| 5378 | .ptr_aligned_type = .{ | 5540 | .is_aligned = .{ |
| 5379 | .tag = .pointer_type, | 5541 | .tag = .typedef, |
| 5380 | .attrs = &.{ | | |
| 5381 | .{ .name, .strp }, | | |
| 5382 | .{ .alignment, .udata }, | | |
| 5383 | .{ .address_class, .data1 }, | | |
| 5384 | .{ .type, .ref_addr }, | | |
| 5385 | }, | | |
| 5386 | }, | | |
| 5387 | .ptr_aligned_sentinel_type = .{ | | |
| 5388 | .tag = .pointer_type, | | |
| 5389 | .attrs = &.{ | 5542 | .attrs = &.{ |
| 5390 | .{ .name, .strp }, | | |
| 5391 | .{ .ZIG_sentinel, .block }, | | |
| 5392 | .{ .alignment, .udata }, | 5543 | .{ .alignment, .udata }, |
| 5393 | .{ .address_class, .data1 }, | | |
| 5394 | .{ .type, .ref_addr }, | 5544 | .{ .type, .ref_addr }, |
| 5395 | }, | 5545 | }, |
| 5396 | }, | 5546 | }, |
| ... | @@ -5594,6 +5744,7 @@ pub const AbbrevCode = enum { | ... | @@ -5594,6 +5744,7 @@ pub const AbbrevCode = enum { |
| 5594 | .{ .linkage_name, .strp }, | 5744 | .{ .linkage_name, .strp }, |
| 5595 | .{ .type, .ref_addr }, | 5745 | .{ .type, .ref_addr }, |
| 5596 | .{ .location, .exprloc }, | 5746 | .{ .location, .exprloc }, |
| | 5747 | .{ .alignment, .udata }, |
| 5597 | .{ .external, .flag_present }, | 5748 | .{ .external, .flag_present }, |
| 5598 | }, | 5749 | }, |
| 5599 | }, | 5750 | }, |