authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-08-23 10:28:56+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-08-23 22:01:05+02:00
logcf9f6fd7f090b175858e7c0109215ddf0922655d
treed6e33fd8237e3c27e613dc0f45dc79abb90407cc
parentc8d04fea157444f88485bd69b42f58b5c8f12b1e

macho: fix compile errors in std.debug


2 files changed, 31 insertions(+), 8 deletions(-)

lib/std/debug.zig+28-7
...@@ -1512,6 +1512,7 @@ pub const ModuleDebugInfo = switch (native_os) {...@@ -1512,6 +1512,7 @@ pub const ModuleDebugInfo = switch (native_os) {
1512 var opt_debug_info: ?macho.section_64 = null;1512 var opt_debug_info: ?macho.section_64 = null;
1513 var opt_debug_abbrev: ?macho.section_64 = null;1513 var opt_debug_abbrev: ?macho.section_64 = null;
1514 var opt_debug_str: ?macho.section_64 = null;1514 var opt_debug_str: ?macho.section_64 = null;
1515 var opt_debug_str_offsets: ?macho.section_64 = null;
1515 var opt_debug_line_str: ?macho.section_64 = null;1516 var opt_debug_line_str: ?macho.section_64 = null;
1516 var opt_debug_ranges: ?macho.section_64 = null;1517 var opt_debug_ranges: ?macho.section_64 = null;
1517 var opt_debug_loclists: ?macho.section_64 = null;1518 var opt_debug_loclists: ?macho.section_64 = null;
...@@ -1530,6 +1531,8 @@ pub const ModuleDebugInfo = switch (native_os) {...@@ -1530,6 +1531,8 @@ pub const ModuleDebugInfo = switch (native_os) {
1530 opt_debug_abbrev = sect;1531 opt_debug_abbrev = sect;
1531 } else if (mem.eql(u8, name, "__debug_str")) {1532 } else if (mem.eql(u8, name, "__debug_str")) {
1532 opt_debug_str = sect;1533 opt_debug_str = sect;
1534 } else if (mem.eql(u8, name, "__debug_str_offsets")) {
1535 opt_debug_str_offsets = sect;
1533 } else if (mem.eql(u8, name, "__debug_line_str")) {1536 } else if (mem.eql(u8, name, "__debug_line_str")) {
1534 opt_debug_line_str = sect;1537 opt_debug_line_str = sect;
1535 } else if (mem.eql(u8, name, "__debug_ranges")) {1538 } else if (mem.eql(u8, name, "__debug_ranges")) {
...@@ -1561,7 +1564,10 @@ pub const ModuleDebugInfo = switch (native_os) {...@@ -1561,7 +1564,10 @@ pub const ModuleDebugInfo = switch (native_os) {
1561 .debug_info = try chopSlice(mapped_mem, debug_info.offset, debug_info.size),1564 .debug_info = try chopSlice(mapped_mem, debug_info.offset, debug_info.size),
1562 .debug_abbrev = try chopSlice(mapped_mem, debug_abbrev.offset, debug_abbrev.size),1565 .debug_abbrev = try chopSlice(mapped_mem, debug_abbrev.offset, debug_abbrev.size),
1563 .debug_str = try chopSlice(mapped_mem, debug_str.offset, debug_str.size),1566 .debug_str = try chopSlice(mapped_mem, debug_str.offset, debug_str.size),
1564 .debug_str_offsets = null,1567 .debug_str_offsets = if (opt_debug_str_offsets) |debug_str_offsets|
1568 try chopSlice(mapped_mem, debug_str_offsets.offset, debug_str_offsets.size)
1569 else
1570 null,
1565 .debug_line = try chopSlice(mapped_mem, debug_line.offset, debug_line.size),1571 .debug_line = try chopSlice(mapped_mem, debug_line.offset, debug_line.size),
1566 .debug_line_str = if (opt_debug_line_str) |debug_line_str|1572 .debug_line_str = if (opt_debug_line_str) |debug_line_str|
1567 try chopSlice(mapped_mem, debug_line_str.offset, debug_line_str.size)1573 try chopSlice(mapped_mem, debug_line_str.offset, debug_line_str.size)
...@@ -1571,11 +1577,26 @@ pub const ModuleDebugInfo = switch (native_os) {...@@ -1571,11 +1577,26 @@ pub const ModuleDebugInfo = switch (native_os) {
1571 try chopSlice(mapped_mem, debug_ranges.offset, debug_ranges.size)1577 try chopSlice(mapped_mem, debug_ranges.offset, debug_ranges.size)
1572 else1578 else
1573 null,1579 null,
1574 .debug_loclists = opt_debug_loclists,1580 .debug_loclists = if (opt_debug_loclists) |debug_loclists|
1575 .debug_rnglists = opt_debug_rnglists,1581 try chopSlice(mapped_mem, debug_loclists.offset, debug_loclists.size)
1576 .debug_addr = opt_debug_addr,1582 else
1577 .debug_names = opt_debug_names,1583 null,
1578 .debug_frame = opt_debug_frame,1584 .debug_rnglists = if (opt_debug_rnglists) |debug_rnglists|
1585 try chopSlice(mapped_mem, debug_rnglists.offset, debug_rnglists.size)
1586 else
1587 null,
1588 .debug_addr = if (opt_debug_addr) |debug_addr|
1589 try chopSlice(mapped_mem, debug_addr.offset, debug_addr.size)
1590 else
1591 null,
1592 .debug_names = if (opt_debug_names) |debug_names|
1593 try chopSlice(mapped_mem, debug_names.offset, debug_names.size)
1594 else
1595 null,
1596 .debug_frame = if (opt_debug_frame) |debug_frame|
1597 try chopSlice(mapped_mem, debug_frame.offset, debug_frame.size)
1598 else
1599 null,
1579 };1600 };
15801601
1581 try DW.openDwarfDebugInfo(&di, allocator);1602 try DW.openDwarfDebugInfo(&di, allocator);
...@@ -1630,7 +1651,7 @@ pub const ModuleDebugInfo = switch (native_os) {...@@ -1630,7 +1651,7 @@ pub const ModuleDebugInfo = switch (native_os) {
1630 .compile_unit_name = compile_unit.die.getAttrString(1651 .compile_unit_name = compile_unit.die.getAttrString(
1631 o_file_di,1652 o_file_di,
1632 DW.AT.name,1653 DW.AT.name,
1633 self.di.debug_str,1654 o_file_di.debug_str,
1634 ) catch |err| switch (err) {1655 ) catch |err| switch (err) {
1635 error.MissingDebugInfo, error.InvalidDebugInfo => "???",1656 error.MissingDebugInfo, error.InvalidDebugInfo => "???",
1636 },1657 },
src/link/MachO/Object.zig+3-1
...@@ -580,7 +580,7 @@ pub fn parseDwarfInfo(self: Object) error{Overflow}!dwarf.DwarfInfo {...@@ -580,7 +580,7 @@ pub fn parseDwarfInfo(self: Object) error{Overflow}!dwarf.DwarfInfo {
580 .debug_info = &[0]u8{},580 .debug_info = &[0]u8{},
581 .debug_abbrev = &[0]u8{},581 .debug_abbrev = &[0]u8{},
582 .debug_str = &[0]u8{},582 .debug_str = &[0]u8{},
583 .debug_str_offsets = null,583 .debug_str_offsets = &[0]u8{},
584 .debug_line = &[0]u8{},584 .debug_line = &[0]u8{},
585 .debug_line_str = &[0]u8{},585 .debug_line_str = &[0]u8{},
586 .debug_ranges = &[0]u8{},586 .debug_ranges = &[0]u8{},
...@@ -600,6 +600,8 @@ pub fn parseDwarfInfo(self: Object) error{Overflow}!dwarf.DwarfInfo {...@@ -600,6 +600,8 @@ pub fn parseDwarfInfo(self: Object) error{Overflow}!dwarf.DwarfInfo {
600 di.debug_abbrev = try self.getSectionContents(sect);600 di.debug_abbrev = try self.getSectionContents(sect);
601 } else if (mem.eql(u8, sectname, "__debug_str")) {601 } else if (mem.eql(u8, sectname, "__debug_str")) {
602 di.debug_str = try self.getSectionContents(sect);602 di.debug_str = try self.getSectionContents(sect);
603 } else if (mem.eql(u8, sectname, "__debug_str_offsets")) {
604 di.debug_str_offsets = try self.getSectionContents(sect);
603 } else if (mem.eql(u8, sectname, "__debug_line")) {605 } else if (mem.eql(u8, sectname, "__debug_line")) {
604 di.debug_line = try self.getSectionContents(sect);606 di.debug_line = try self.getSectionContents(sect);
605 } else if (mem.eql(u8, sectname, "__debug_line_str")) {607 } else if (mem.eql(u8, sectname, "__debug_line_str")) {