| author | |
| committer | |
| log | 0a9088bd0684a517961b35bff458962174099677 |
| tree | 28b328eb7362d1dd8e3e52c7d5f44fe3a153f5fb |
| parent | 2be003a3b37f32b2c187064b975fc10f335d5ac1 |
3 files changed, 26 insertions(+), 20 deletions(-)
src/arch/x86_64/Emit.zig+16-2| ... | @@ -1019,7 +1019,14 @@ fn genArgDbgInfo(emit: *Emit, inst: Air.Inst.Index, mcv: MCValue, max_stack: u32 | ... | @@ -1019,7 +1019,14 @@ fn genArgDbgInfo(emit: *Emit, inst: Air.Inst.Index, mcv: MCValue, max_stack: u32 |
| 1019 | switch (emit.debug_output) { | 1019 | switch (emit.debug_output) { |
| 1020 | .dwarf => |dbg_out| { | 1020 | .dwarf => |dbg_out| { |
| 1021 | try dbg_out.dbg_info.ensureUnusedCapacity(3); | 1021 | try dbg_out.dbg_info.ensureUnusedCapacity(3); |
| 1022 | dbg_out.dbg_info.appendAssumeCapacity(link.File.Elf.abbrev_parameter); | 1022 | |
| 1023 | // TODO this will go away once we pull DWARF into a cross-platform module. | ||
| 1024 | if (emit.bin_file.cast(link.File.MachO)) |_| { | ||
| 1025 | dbg_out.dbg_info.appendAssumeCapacity(link.File.MachO.DebugSymbols.abbrev_parameter); | ||
| 1026 | } else if (emit.bin_file.cast(link.File.Elf)) |_| { | ||
| 1027 | dbg_out.dbg_info.appendAssumeCapacity(link.File.Elf.abbrev_parameter); | ||
| 1028 | } else return emit.fail("TODO DWARF in non-MachO and non-ELF backend", .{}); | ||
| 1029 | |||
| 1023 | dbg_out.dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc | 1030 | dbg_out.dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc |
| 1024 | 1, // ULEB128 dwarf expression length | 1031 | 1, // ULEB128 dwarf expression length |
| 1025 | reg.dwarfLocOp(), | 1032 | reg.dwarfLocOp(), |
| ... | @@ -1042,7 +1049,14 @@ fn genArgDbgInfo(emit: *Emit, inst: Air.Inst.Index, mcv: MCValue, max_stack: u32 | ... | @@ -1042,7 +1049,14 @@ fn genArgDbgInfo(emit: *Emit, inst: Air.Inst.Index, mcv: MCValue, max_stack: u32 |
| 1042 | // for example when -fomit-frame-pointer is set. | 1049 | // for example when -fomit-frame-pointer is set. |
| 1043 | const disp = @intCast(i32, max_stack) - off + 16; | 1050 | const disp = @intCast(i32, max_stack) - off + 16; |
| 1044 | try dbg_out.dbg_info.ensureUnusedCapacity(8); | 1051 | try dbg_out.dbg_info.ensureUnusedCapacity(8); |
| 1045 | dbg_out.dbg_info.appendAssumeCapacity(link.File.Elf.abbrev_parameter); | 1052 | |
| 1053 | // TODO this will go away once we pull DWARF into a cross-platform module. | ||
| 1054 | if (emit.bin_file.cast(link.File.MachO)) |_| { | ||
| 1055 | dbg_out.dbg_info.appendAssumeCapacity(link.File.MachO.DebugSymbols.abbrev_parameter); | ||
| 1056 | } else if (emit.bin_file.cast(link.File.Elf)) |_| { | ||
| 1057 | dbg_out.dbg_info.appendAssumeCapacity(link.File.Elf.abbrev_parameter); | ||
| 1058 | } else return emit.fail("TODO DWARF in non-MachO and non-ELF backend", .{}); | ||
| 1059 | |||
| 1046 | const fixup = dbg_out.dbg_info.items.len; | 1060 | const fixup = dbg_out.dbg_info.items.len; |
| 1047 | dbg_out.dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc | 1061 | dbg_out.dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc |
| 1048 | 1, // we will backpatch it after we encode the displacement in LEB128 | 1062 | 1, // we will backpatch it after we encode the displacement in LEB128 |
src/link/MachO.zig+1-1| ... | @@ -27,7 +27,6 @@ const Atom = @import("MachO/Atom.zig"); | ... | @@ -27,7 +27,6 @@ const Atom = @import("MachO/Atom.zig"); |
| 27 | const Cache = @import("../Cache.zig"); | 27 | const Cache = @import("../Cache.zig"); |
| 28 | const CodeSignature = @import("MachO/CodeSignature.zig"); | 28 | const CodeSignature = @import("MachO/CodeSignature.zig"); |
| 29 | const Compilation = @import("../Compilation.zig"); | 29 | const Compilation = @import("../Compilation.zig"); |
| 30 | const DebugSymbols = @import("MachO/DebugSymbols.zig"); | ||
| 31 | const Dylib = @import("MachO/Dylib.zig"); | 30 | const Dylib = @import("MachO/Dylib.zig"); |
| 32 | const File = link.File; | 31 | const File = link.File; |
| 33 | const Object = @import("MachO/Object.zig"); | 32 | const Object = @import("MachO/Object.zig"); |
| ... | @@ -43,6 +42,7 @@ const TypedValue = @import("../TypedValue.zig"); | ... | @@ -43,6 +42,7 @@ const TypedValue = @import("../TypedValue.zig"); |
| 43 | const Value = @import("../value.zig").Value; | 42 | const Value = @import("../value.zig").Value; |
| 44 | 43 | ||
| 45 | pub const TextBlock = Atom; | 44 | pub const TextBlock = Atom; |
| 45 | pub const DebugSymbols = @import("MachO/DebugSymbols.zig"); | ||
| 46 | 46 | ||
| 47 | pub const base_tag: File.Tag = File.Tag.macho; | 47 | pub const base_tag: File.Tag = File.Tag.macho; |
| 48 | 48 |
src/link/MachO/DebugSymbols.zig+9-17| ... | @@ -78,16 +78,15 @@ debug_aranges_section_dirty: bool = false, | ... | @@ -78,16 +78,15 @@ debug_aranges_section_dirty: bool = false, |
| 78 | debug_info_header_dirty: bool = false, | 78 | debug_info_header_dirty: bool = false, |
| 79 | debug_line_header_dirty: bool = false, | 79 | debug_line_header_dirty: bool = false, |
| 80 | 80 | ||
| 81 | const abbrev_compile_unit = 1; | 81 | pub const abbrev_compile_unit = 1; |
| 82 | const abbrev_subprogram = 2; | 82 | pub const abbrev_subprogram = 2; |
| 83 | const abbrev_subprogram_retvoid = 3; | 83 | pub const abbrev_subprogram_retvoid = 3; |
| 84 | const abbrev_base_type = 4; | 84 | pub const abbrev_base_type = 4; |
| 85 | const abbrev_ptr_type = 5; | 85 | pub const abbrev_ptr_type = 5; |
| 86 | const abbrev_struct_type = 6; | 86 | pub const abbrev_struct_type = 6; |
| 87 | const abbrev_anon_struct_type = 7; | 87 | pub const abbrev_struct_member = 7; |
| 88 | const abbrev_struct_member = 8; | 88 | pub const abbrev_pad1 = 8; |
| 89 | const abbrev_pad1 = 9; | 89 | pub const abbrev_parameter = 9; |
| 90 | const abbrev_parameter = 10; | ||
| 91 | 90 | ||
| 92 | /// The reloc offset for the virtual address of a function in its Line Number Program. | 91 | /// The reloc offset for the virtual address of a function in its Line Number Program. |
| 93 | /// Size is a virtual address integer. | 92 | /// Size is a virtual address integer. |
| ... | @@ -353,13 +352,6 @@ pub fn flushModule(self: *DebugSymbols, allocator: Allocator, options: link.Opti | ... | @@ -353,13 +352,6 @@ pub fn flushModule(self: *DebugSymbols, allocator: Allocator, options: link.Opti |
| 353 | DW.FORM.string, | 352 | DW.FORM.string, |
| 354 | 0, | 353 | 0, |
| 355 | 0, // table sentinel | 354 | 0, // table sentinel |
| 356 | abbrev_anon_struct_type, | ||
| 357 | DW.TAG.structure_type, | ||
| 358 | DW.CHILDREN.yes, // header | ||
| 359 | DW.AT.byte_size, | ||
| 360 | DW.FORM.sdata, | ||
| 361 | 0, | ||
| 362 | 0, // table sentinel | ||
| 363 | abbrev_struct_member, | 355 | abbrev_struct_member, |
| 364 | DW.TAG.member, | 356 | DW.TAG.member, |
| 365 | DW.CHILDREN.no, // header | 357 | DW.CHILDREN.no, // header |