| 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 | 1019 | switch (emit.debug_output) { |
| 1020 | 1020 | .dwarf => |dbg_out| { |
| 1021 | 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 | 1030 | dbg_out.dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc |
| 1024 | 1031 | 1, // ULEB128 dwarf expression length |
| 1025 | 1032 | reg.dwarfLocOp(), |
| ... | ... | @@ -1042,7 +1049,14 @@ fn genArgDbgInfo(emit: *Emit, inst: Air.Inst.Index, mcv: MCValue, max_stack: u32 |
| 1042 | 1049 | // for example when -fomit-frame-pointer is set. |
| 1043 | 1050 | const disp = @intCast(i32, max_stack) - off + 16; |
| 1044 | 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 | 1060 | const fixup = dbg_out.dbg_info.items.len; |
| 1047 | 1061 | dbg_out.dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc |
| 1048 | 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 | 27 | const Cache = @import("../Cache.zig"); |
| 28 | 28 | const CodeSignature = @import("MachO/CodeSignature.zig"); |
| 29 | 29 | const Compilation = @import("../Compilation.zig"); |
| 30 | const DebugSymbols = @import("MachO/DebugSymbols.zig"); | |
| 31 | 30 | const Dylib = @import("MachO/Dylib.zig"); |
| 32 | 31 | const File = link.File; |
| 33 | 32 | const Object = @import("MachO/Object.zig"); |
| ... | ... | @@ -43,6 +42,7 @@ const TypedValue = @import("../TypedValue.zig"); |
| 43 | 42 | const Value = @import("../value.zig").Value; |
| 44 | 43 | |
| 45 | 44 | pub const TextBlock = Atom; |
| 45 | pub const DebugSymbols = @import("MachO/DebugSymbols.zig"); | |
| 46 | 46 | |
| 47 | 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 | 78 | debug_info_header_dirty: bool = false, |
| 79 | 79 | debug_line_header_dirty: bool = false, |
| 80 | 80 | |
| 81 | const abbrev_compile_unit = 1; | |
| 82 | const abbrev_subprogram = 2; | |
| 83 | const abbrev_subprogram_retvoid = 3; | |
| 84 | const abbrev_base_type = 4; | |
| 85 | const abbrev_ptr_type = 5; | |
| 86 | const abbrev_struct_type = 6; | |
| 87 | const abbrev_anon_struct_type = 7; | |
| 88 | const abbrev_struct_member = 8; | |
| 89 | const abbrev_pad1 = 9; | |
| 90 | const abbrev_parameter = 10; | |
| 81 | pub const abbrev_compile_unit = 1; | |
| 82 | pub const abbrev_subprogram = 2; | |
| 83 | pub const abbrev_subprogram_retvoid = 3; | |
| 84 | pub const abbrev_base_type = 4; | |
| 85 | pub const abbrev_ptr_type = 5; | |
| 86 | pub const abbrev_struct_type = 6; | |
| 87 | pub const abbrev_struct_member = 7; | |
| 88 | pub const abbrev_pad1 = 8; | |
| 89 | pub const abbrev_parameter = 9; | |
| 91 | 90 | |
| 92 | 91 | /// The reloc offset for the virtual address of a function in its Line Number Program. |
| 93 | 92 | /// Size is a virtual address integer. |
| ... | ... | @@ -353,13 +352,6 @@ pub fn flushModule(self: *DebugSymbols, allocator: Allocator, options: link.Opti |
| 353 | 352 | DW.FORM.string, |
| 354 | 353 | 0, |
| 355 | 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 | 355 | abbrev_struct_member, |
| 364 | 356 | DW.TAG.member, |
| 365 | 357 | DW.CHILDREN.no, // header |