| ... | ... | @@ -785,6 +785,7 @@ const Entry = struct { |
| 785 | 785 | } |
| 786 | 786 | |
| 787 | 787 | const Index = enum(u32) { |
| 788 | //got_proc, |
| 788 | 789 | _, |
| 789 | 790 | |
| 790 | 791 | const Optional = enum(u32) { |
| ... | ... | @@ -1040,7 +1041,7 @@ const Entry = struct { |
| 1040 | 1041 | const symbol = zo.symbol(reloc.target_sym); |
| 1041 | 1042 | try dwarf.resolveReloc( |
| 1042 | 1043 | entry_off + reloc.source_off, |
| 1043 | | @bitCast(symbol.address(.{}, elf_file) + @as(i64, @intCast(reloc.target_off)) - |
| 1044 | @bitCast(symbol.address(.{}, elf_file) + @as(i64, @intCast(@intFromEnum(reloc.target_off))) - |
| 1044 | 1045 | if (symbol.flags.is_tls) elf_file.dtpAddress() else 0), |
| 1045 | 1046 | @intFromEnum(dwarf.address_size), |
| 1046 | 1047 | ); |
| ... | ... | @@ -1051,7 +1052,7 @@ const Entry = struct { |
| 1051 | 1052 | const ref = zo.getSymbolRef(reloc.target_sym, macho_file); |
| 1052 | 1053 | try dwarf.resolveReloc( |
| 1053 | 1054 | entry_off + reloc.source_off, |
| 1054 | | ref.getSymbol(macho_file).?.getAddress(.{}, macho_file), |
| 1055 | ref.getSymbol(macho_file).?.getAddress(.{}, macho_file) + @as(i64, @intCast(@intFromEnum(reloc.target_off))), |
| 1055 | 1056 | @intFromEnum(dwarf.address_size), |
| 1056 | 1057 | ); |
| 1057 | 1058 | } |
| ... | ... | @@ -1080,18 +1081,39 @@ const CrossSectionReloc = struct { |
| 1080 | 1081 | const ExternalReloc = struct { |
| 1081 | 1082 | source_off: u32 = 0, |
| 1082 | 1083 | target_sym: u32, |
| 1083 | | target_off: u64 = 0, |
| 1084 | target_off: enum(u64) { |
| 1085 | none = 0, |
| 1086 | got = std.math.maxInt(i64) + 1, |
| 1087 | _, |
| 1088 | |
| 1089 | pub fn rel(off: u64) @This() { |
| 1090 | const res: @This() = @enumFromInt(off); |
| 1091 | switch (res) { |
| 1092 | .none => {}, |
| 1093 | _ => {}, |
| 1094 | .got => unreachable, // assertion failure |
| 1095 | } |
| 1096 | return res; |
| 1097 | } |
| 1098 | } = .none, |
| 1084 | 1099 | }; |
| 1085 | 1100 | |
| 1086 | 1101 | pub const Loc = union(enum) { |
| 1087 | 1102 | empty, |
| 1088 | | addr: union(enum) { sym: u32 }, |
| 1103 | addr_reloc: u32, |
| 1104 | got_reloc: u32, |
| 1105 | deref: *const Loc, |
| 1089 | 1106 | constu: u64, |
| 1090 | 1107 | consts: i64, |
| 1091 | 1108 | plus: Bin, |
| 1092 | 1109 | reg: u32, |
| 1093 | 1110 | breg: u32, |
| 1094 | 1111 | push_object_address, |
| 1112 | call: struct { |
| 1113 | args: []const Loc = &.{}, |
| 1114 | unit: Unit.Index, |
| 1115 | entry: Entry.Index, |
| 1116 | }, |
| 1095 | 1117 | form_tls_address: *const Loc, |
| 1096 | 1118 | implicit_value: []const u8, |
| 1097 | 1119 | stack_value: *const Loc, |
| ... | ... | @@ -1136,11 +1158,17 @@ pub const Loc = union(enum) { |
| 1136 | 1158 | const writer = adapter.writer(); |
| 1137 | 1159 | switch (loc) { |
| 1138 | 1160 | .empty => {}, |
| 1139 | | .addr => |addr| { |
| 1161 | .addr_reloc => |sym_index| { |
| 1140 | 1162 | try writer.writeByte(DW.OP.addr); |
| 1141 | | switch (addr) { |
| 1142 | | .sym => |sym_index| try adapter.addrSym(sym_index), |
| 1143 | | } |
| 1163 | try adapter.addrSym(sym_index); |
| 1164 | }, |
| 1165 | .deref => |addr| { |
| 1166 | try addr.write(adapter); |
| 1167 | try writer.writeByte(DW.OP.deref); |
| 1168 | }, |
| 1169 | .got_reloc => |sym_index| { |
| 1170 | try writer.writeByte(DW.OP.const4s); |
| 1171 | try adapter.gotSym(sym_index); |
| 1144 | 1172 | }, |
| 1145 | 1173 | .constu => |constu| if (std.math.cast(u5, constu)) |lit| { |
| 1146 | 1174 | try writer.writeByte(@as(u8, DW.OP.lit0) + lit); |
| ... | ... | @@ -1225,6 +1253,11 @@ pub const Loc = union(enum) { |
| 1225 | 1253 | try sleb128(writer, 0); |
| 1226 | 1254 | }, |
| 1227 | 1255 | .push_object_address => try writer.writeByte(DW.OP.push_object_address), |
| 1256 | .call => |call| { |
| 1257 | for (call.args) |arg| try arg.write(adapter); |
| 1258 | try writer.writeByte(DW.OP.call_ref); |
| 1259 | try adapter.infoEntry(call.unit, call.entry); |
| 1260 | }, |
| 1228 | 1261 | .form_tls_address => |addr| { |
| 1229 | 1262 | try addr.write(adapter); |
| 1230 | 1263 | try writer.writeByte(DW.OP.form_tls_address); |
| ... | ... | @@ -1385,12 +1418,12 @@ pub const Cfa = union(enum) { |
| 1385 | 1418 | }, |
| 1386 | 1419 | .def_cfa_expression => |expr| { |
| 1387 | 1420 | try writer.writeByte(DW.CFA.def_cfa_expression); |
| 1388 | | try wip_nav.frameExprloc(expr); |
| 1421 | try wip_nav.frameExprLoc(expr); |
| 1389 | 1422 | }, |
| 1390 | 1423 | .expression => |reg_expr| { |
| 1391 | 1424 | try writer.writeByte(DW.CFA.expression); |
| 1392 | 1425 | try uleb128(writer, reg_expr.reg); |
| 1393 | | try wip_nav.frameExprloc(reg_expr.expr); |
| 1426 | try wip_nav.frameExprLoc(reg_expr.expr); |
| 1394 | 1427 | }, |
| 1395 | 1428 | .val_offset => |reg_off| { |
| 1396 | 1429 | const factored_off = @divExact(reg_off.off, wip_nav.dwarf.debug_frame.header.data_alignment_factor); |
| ... | ... | @@ -1407,7 +1440,7 @@ pub const Cfa = union(enum) { |
| 1407 | 1440 | .val_expression => |reg_expr| { |
| 1408 | 1441 | try writer.writeByte(DW.CFA.val_expression); |
| 1409 | 1442 | try uleb128(writer, reg_expr.reg); |
| 1410 | | try wip_nav.frameExprloc(reg_expr.expr); |
| 1443 | try wip_nav.frameExprLoc(reg_expr.expr); |
| 1411 | 1444 | }, |
| 1412 | 1445 | .escape => |bytes| try writer.writeAll(bytes), |
| 1413 | 1446 | } |
| ... | ... | @@ -1471,7 +1504,7 @@ pub const WipNav = struct { |
| 1471 | 1504 | }); |
| 1472 | 1505 | try wip_nav.strp(name); |
| 1473 | 1506 | try wip_nav.refType(ty); |
| 1474 | | try wip_nav.infoExprloc(loc); |
| 1507 | try wip_nav.infoExprLoc(loc); |
| 1475 | 1508 | wip_nav.any_children = true; |
| 1476 | 1509 | } |
| 1477 | 1510 | |
| ... | ... | @@ -1733,6 +1766,9 @@ pub const WipNav = struct { |
| 1733 | 1766 | fn endian(_: ExprLocCounter) std.builtin.Endian { |
| 1734 | 1767 | return @import("builtin").cpu.arch.endian(); |
| 1735 | 1768 | } |
| 1769 | fn gotSym(counter: *ExprLocCounter, _: u32) error{}!void { |
| 1770 | counter.stream.bytes_written += 4; |
| 1771 | } |
| 1736 | 1772 | fn addrSym(counter: *ExprLocCounter, _: u32) error{}!void { |
| 1737 | 1773 | counter.stream.bytes_written += @intFromEnum(counter.address_size); |
| 1738 | 1774 | } |
| ... | ... | @@ -1741,7 +1777,7 @@ pub const WipNav = struct { |
| 1741 | 1777 | } |
| 1742 | 1778 | }; |
| 1743 | 1779 | |
| 1744 | | fn infoExprloc(wip_nav: *WipNav, loc: Loc) UpdateError!void { |
| 1780 | fn infoExprLoc(wip_nav: *WipNav, loc: Loc) UpdateError!void { |
| 1745 | 1781 | var counter: ExprLocCounter = .init(wip_nav.dwarf); |
| 1746 | 1782 | try loc.write(&counter); |
| 1747 | 1783 | |
| ... | ... | @@ -1753,6 +1789,14 @@ pub const WipNav = struct { |
| 1753 | 1789 | fn endian(ctx: @This()) std.builtin.Endian { |
| 1754 | 1790 | return ctx.wip_nav.dwarf.endian; |
| 1755 | 1791 | } |
| 1792 | fn gotSym(ctx: @This(), sym_index: u32) UpdateError!void { |
| 1793 | try ctx.wip_nav.infoExternalReloc(.{ |
| 1794 | .source_off = @intCast(ctx.wip_nav.debug_info.items.len), |
| 1795 | .target_sym = sym_index, |
| 1796 | .target_off = .got, |
| 1797 | }); |
| 1798 | try ctx.wip_nav.debug_info.appendNTimes(ctx.wip_nav.dwarf.gpa, 0, 4); |
| 1799 | } |
| 1756 | 1800 | fn addrSym(ctx: @This(), sym_index: u32) UpdateError!void { |
| 1757 | 1801 | try ctx.wip_nav.infoAddrSym(sym_index, 0); |
| 1758 | 1802 | } |
| ... | ... | @@ -1768,12 +1812,12 @@ pub const WipNav = struct { |
| 1768 | 1812 | try wip_nav.infoExternalReloc(.{ |
| 1769 | 1813 | .source_off = @intCast(wip_nav.debug_info.items.len), |
| 1770 | 1814 | .target_sym = sym_index, |
| 1771 | | .target_off = sym_off, |
| 1815 | .target_off = .rel(sym_off), |
| 1772 | 1816 | }); |
| 1773 | 1817 | try wip_nav.debug_info.appendNTimes(wip_nav.dwarf.gpa, 0, @intFromEnum(wip_nav.dwarf.address_size)); |
| 1774 | 1818 | } |
| 1775 | 1819 | |
| 1776 | | fn frameExprloc(wip_nav: *WipNav, loc: Loc) UpdateError!void { |
| 1820 | fn frameExprLoc(wip_nav: *WipNav, loc: Loc) UpdateError!void { |
| 1777 | 1821 | var counter: ExprLocCounter = .init(wip_nav.dwarf); |
| 1778 | 1822 | try loc.write(&counter); |
| 1779 | 1823 | |
| ... | ... | @@ -1785,6 +1829,14 @@ pub const WipNav = struct { |
| 1785 | 1829 | fn endian(ctx: @This()) std.builtin.Endian { |
| 1786 | 1830 | return ctx.wip_nav.dwarf.endian; |
| 1787 | 1831 | } |
| 1832 | fn gotSym(ctx: @This(), sym_index: u32) UpdateError!void { |
| 1833 | try ctx.wip_nav.frameExternalReloc(.{ |
| 1834 | .source_off = @intCast(ctx.wip_nav.debug_frame.items.len), |
| 1835 | .target_sym = sym_index, |
| 1836 | .target_off = .got, |
| 1837 | }); |
| 1838 | try ctx.wip_nav.debug_frame.appendNTimes(ctx.wip_nav.dwarf.gpa, 0, 4); |
| 1839 | } |
| 1788 | 1840 | fn addrSym(ctx: @This(), sym_index: u32) UpdateError!void { |
| 1789 | 1841 | try ctx.wip_nav.frameAddrSym(sym_index, 0); |
| 1790 | 1842 | } |
| ... | ... | @@ -1800,7 +1852,7 @@ pub const WipNav = struct { |
| 1800 | 1852 | try wip_nav.frameExternalReloc(.{ |
| 1801 | 1853 | .source_off = @intCast(wip_nav.debug_frame.items.len), |
| 1802 | 1854 | .target_sym = sym_index, |
| 1803 | | .target_off = sym_off, |
| 1855 | .target_off = .rel(sym_off), |
| 1804 | 1856 | }); |
| 1805 | 1857 | try wip_nav.debug_frame.appendNTimes(wip_nav.dwarf.gpa, 0, @intFromEnum(wip_nav.dwarf.address_size)); |
| 1806 | 1858 | } |
| ... | ... | @@ -2286,50 +2338,81 @@ fn getUnit(dwarf: *Dwarf, mod: *Module) !Unit.Index { |
| 2286 | 2338 | const mod_gop = try dwarf.mods.getOrPut(dwarf.gpa, mod); |
| 2287 | 2339 | const unit: Unit.Index = @enumFromInt(mod_gop.index); |
| 2288 | 2340 | if (!mod_gop.found_existing) { |
| 2289 | | errdefer _ = dwarf.mods.pop(); |
| 2290 | | mod_gop.value_ptr.* = .{ |
| 2291 | | .root_dir_path = undefined, |
| 2292 | | .dirs = .empty, |
| 2293 | | .files = .empty, |
| 2294 | | }; |
| 2295 | | errdefer mod_gop.value_ptr.dirs.deinit(dwarf.gpa); |
| 2296 | | try mod_gop.value_ptr.dirs.putNoClobber(dwarf.gpa, unit, {}); |
| 2297 | | assert(try dwarf.debug_aranges.section.addUnit( |
| 2298 | | DebugAranges.headerBytes(dwarf), |
| 2299 | | DebugAranges.trailerBytes(dwarf), |
| 2300 | | dwarf, |
| 2301 | | ) == unit); |
| 2302 | | errdefer dwarf.debug_aranges.section.popUnit(dwarf.gpa); |
| 2303 | | assert(try dwarf.debug_frame.section.addUnit( |
| 2304 | | DebugFrame.headerBytes(dwarf), |
| 2305 | | DebugFrame.trailerBytes(dwarf), |
| 2306 | | dwarf, |
| 2307 | | ) == unit); |
| 2308 | | errdefer dwarf.debug_frame.section.popUnit(dwarf.gpa); |
| 2309 | | assert(try dwarf.debug_info.section.addUnit( |
| 2310 | | DebugInfo.headerBytes(dwarf), |
| 2311 | | DebugInfo.trailer_bytes, |
| 2312 | | dwarf, |
| 2313 | | ) == unit); |
| 2314 | | errdefer dwarf.debug_info.section.popUnit(dwarf.gpa); |
| 2315 | | assert(try dwarf.debug_line.section.addUnit( |
| 2316 | | DebugLine.headerBytes(dwarf, 5, 25), |
| 2317 | | DebugLine.trailer_bytes, |
| 2318 | | dwarf, |
| 2319 | | ) == unit); |
| 2320 | | errdefer dwarf.debug_line.section.popUnit(dwarf.gpa); |
| 2321 | | assert(try dwarf.debug_loclists.section.addUnit( |
| 2322 | | DebugLocLists.headerBytes(dwarf), |
| 2323 | | DebugLocLists.trailer_bytes, |
| 2324 | | dwarf, |
| 2325 | | ) == unit); |
| 2326 | | errdefer dwarf.debug_loclists.section.popUnit(dwarf.gpa); |
| 2327 | | assert(try dwarf.debug_rnglists.section.addUnit( |
| 2328 | | DebugRngLists.headerBytes(dwarf), |
| 2329 | | DebugRngLists.trailer_bytes, |
| 2330 | | dwarf, |
| 2331 | | ) == unit); |
| 2332 | | errdefer dwarf.debug_rnglists.section.popUnit(dwarf.gpa); |
| 2341 | { |
| 2342 | errdefer _ = dwarf.mods.pop(); |
| 2343 | mod_gop.value_ptr.* = .{ |
| 2344 | .root_dir_path = undefined, |
| 2345 | .dirs = .empty, |
| 2346 | .files = .empty, |
| 2347 | }; |
| 2348 | errdefer mod_gop.value_ptr.dirs.deinit(dwarf.gpa); |
| 2349 | try mod_gop.value_ptr.dirs.putNoClobber(dwarf.gpa, unit, {}); |
| 2350 | assert(try dwarf.debug_aranges.section.addUnit( |
| 2351 | DebugAranges.headerBytes(dwarf), |
| 2352 | DebugAranges.trailerBytes(dwarf), |
| 2353 | dwarf, |
| 2354 | ) == unit); |
| 2355 | errdefer dwarf.debug_aranges.section.popUnit(dwarf.gpa); |
| 2356 | assert(try dwarf.debug_frame.section.addUnit( |
| 2357 | DebugFrame.headerBytes(dwarf), |
| 2358 | DebugFrame.trailerBytes(dwarf), |
| 2359 | dwarf, |
| 2360 | ) == unit); |
| 2361 | errdefer dwarf.debug_frame.section.popUnit(dwarf.gpa); |
| 2362 | assert(try dwarf.debug_info.section.addUnit( |
| 2363 | DebugInfo.headerBytes(dwarf), |
| 2364 | DebugInfo.trailer_bytes, |
| 2365 | dwarf, |
| 2366 | ) == unit); |
| 2367 | errdefer dwarf.debug_info.section.popUnit(dwarf.gpa); |
| 2368 | assert(try dwarf.debug_line.section.addUnit( |
| 2369 | DebugLine.headerBytes(dwarf, 5, 25), |
| 2370 | DebugLine.trailer_bytes, |
| 2371 | dwarf, |
| 2372 | ) == unit); |
| 2373 | errdefer dwarf.debug_line.section.popUnit(dwarf.gpa); |
| 2374 | assert(try dwarf.debug_loclists.section.addUnit( |
| 2375 | DebugLocLists.headerBytes(dwarf), |
| 2376 | DebugLocLists.trailer_bytes, |
| 2377 | dwarf, |
| 2378 | ) == unit); |
| 2379 | errdefer dwarf.debug_loclists.section.popUnit(dwarf.gpa); |
| 2380 | assert(try dwarf.debug_rnglists.section.addUnit( |
| 2381 | DebugRngLists.headerBytes(dwarf), |
| 2382 | DebugRngLists.trailer_bytes, |
| 2383 | dwarf, |
| 2384 | ) == unit); |
| 2385 | errdefer dwarf.debug_rnglists.section.popUnit(dwarf.gpa); |
| 2386 | } |
| 2387 | //if (dwarf.bin_file.cast(.elf)) |elf_file| { |
| 2388 | // if (unit == .main) assert(try dwarf.addCommonEntry(unit) == .got_proc); |
| 2389 | // if (mod.pic and dwarf.debug_info.section.getUnit(.main).getEntry(.got_proc).len == 0) { |
| 2390 | // var wip_nav: WipNav = .{ |
| 2391 | // .dwarf = dwarf, |
| 2392 | // .pt = undefined, |
| 2393 | // .unit = .main, |
| 2394 | // .entry = .got_proc, |
| 2395 | // .any_children = false, |
| 2396 | // .func = .none, |
| 2397 | // .func_sym_index = undefined, |
| 2398 | // .func_high_pc = undefined, |
| 2399 | // .blocks = undefined, |
| 2400 | // .cfi = undefined, |
| 2401 | // .debug_frame = .empty, |
| 2402 | // .debug_info = .empty, |
| 2403 | // .debug_line = .empty, |
| 2404 | // .debug_loclists = .empty, |
| 2405 | // .pending_lazy = .empty, |
| 2406 | // }; |
| 2407 | // defer wip_nav.deinit(); |
| 2408 | // try wip_nav.abbrevCode(.proc); |
| 2409 | // try wip_nav.infoExprLoc(.{ .deref = &.{ .plus = .{ |
| 2410 | // &.empty, |
| 2411 | // &.{ .addr_reloc = try elf_file.zigObjectPtr().?.getGlobalSymbol(elf_file, "_GLOBAL_OFFSET_TABLE_", null) }, |
| 2412 | // } } }); |
| 2413 | // try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.items); |
| 2414 | // } |
| 2415 | //} |
| 2333 | 2416 | } |
| 2334 | 2417 | return unit; |
| 2335 | 2418 | } |
| ... | ... | @@ -2384,7 +2467,8 @@ fn initWipNavInner( |
| 2384 | 2467 | else => {}, |
| 2385 | 2468 | } |
| 2386 | 2469 | |
| 2387 | | const unit = try dwarf.getUnit(file.mod.?); |
| 2470 | const mod = file.mod.?; |
| 2471 | const unit = try dwarf.getUnit(mod); |
| 2388 | 2472 | const nav_gop = try dwarf.navs.getOrPut(dwarf.gpa, nav_index); |
| 2389 | 2473 | errdefer _ = if (!nav_gop.found_existing) dwarf.navs.pop(); |
| 2390 | 2474 | if (nav_gop.found_existing) { |
| ... | ... | @@ -2425,13 +2509,22 @@ fn initWipNavInner( |
| 2425 | 2509 | }, &nav, inst_info.file, &decl); |
| 2426 | 2510 | try wip_nav.strp(nav.fqn.toSlice(ip)); |
| 2427 | 2511 | const ty: Type = nav_val.typeOf(zcu); |
| 2428 | | const addr: Loc = .{ .addr = .{ .sym = sym_index } }; |
| 2429 | | const loc: Loc = if (decl.is_threadlocal) .{ .form_tls_address = &addr } else addr; |
| 2512 | const addr: Loc = .{ .addr_reloc = sym_index }; |
| 2513 | const loc: Loc = loc: { |
| 2514 | if (dwarf.bin_file.cast(.elf)) |elf_file| if (decl.linkage == .@"extern" and mod.pic) |
| 2515 | // TODO: lldb doesn't support call :( |
| 2516 | //.{ .call = .{ .args = &.{.{ .got_reloc = sym_index }}, .unit = .main, .entry = .got_proc } } |
| 2517 | break :loc .{ .deref = &.{ .plus = .{ |
| 2518 | &.{ .addr_reloc = try elf_file.zigObjectPtr().?.getGlobalSymbol(elf_file, "_GLOBAL_OFFSET_TABLE_", null) }, |
| 2519 | &.{ .got_reloc = sym_index }, |
| 2520 | } } }; |
| 2521 | break :loc if (decl.is_threadlocal) .{ .form_tls_address = &addr } else addr; |
| 2522 | }; |
| 2430 | 2523 | switch (decl.kind) { |
| 2431 | 2524 | .unnamed_test, .@"test", .decltest, .@"comptime", .@"usingnamespace" => unreachable, |
| 2432 | 2525 | .@"const" => { |
| 2433 | 2526 | const const_ty_reloc_index = try wip_nav.refForward(); |
| 2434 | | try wip_nav.infoExprloc(loc); |
| 2527 | try wip_nav.infoExprLoc(loc); |
| 2435 | 2528 | try uleb128(diw, nav.status.fully_resolved.alignment.toByteUnits() orelse |
| 2436 | 2529 | ty.abiAlignment(zcu).toByteUnits().?); |
| 2437 | 2530 | try diw.writeByte(@intFromBool(decl.linkage != .normal)); |
| ... | ... | @@ -2441,7 +2534,7 @@ fn initWipNavInner( |
| 2441 | 2534 | }, |
| 2442 | 2535 | .@"var" => { |
| 2443 | 2536 | try wip_nav.refType(ty); |
| 2444 | | try wip_nav.infoExprloc(loc); |
| 2537 | try wip_nav.infoExprLoc(loc); |
| 2445 | 2538 | try uleb128(diw, nav.status.fully_resolved.alignment.toByteUnits() orelse |
| 2446 | 2539 | ty.abiAlignment(zcu).toByteUnits().?); |
| 2447 | 2540 | try diw.writeByte(@intFromBool(decl.linkage != .normal)); |
| ... | ... | @@ -2649,7 +2742,7 @@ pub fn finishWipNavFunc( |
| 2649 | 2742 | .{ |
| 2650 | 2743 | .source_off = 1 + @intFromEnum(dwarf.address_size), |
| 2651 | 2744 | .target_sym = wip_nav.func_sym_index, |
| 2652 | | .target_off = code_size, |
| 2745 | .target_off = .rel(code_size), |
| 2653 | 2746 | }, |
| 2654 | 2747 | }); |
| 2655 | 2748 | try dwarf.debug_rnglists.section.replaceEntry( |
| ... | ... | @@ -3838,7 +3931,7 @@ fn updateLazyValue( |
| 3838 | 3931 | byte_offset += base_ptr.byte_offset; |
| 3839 | 3932 | }; |
| 3840 | 3933 | try wip_nav.abbrevCode(.location_comptime_value); |
| 3841 | | try wip_nav.infoExprloc(.{ .implicit_pointer = .{ |
| 3934 | try wip_nav.infoExprLoc(.{ .implicit_pointer = .{ |
| 3842 | 3935 | .unit = base_unit, |
| 3843 | 3936 | .entry = base_entry, |
| 3844 | 3937 | .offset = byte_offset, |
| ... | ... | @@ -4360,7 +4453,7 @@ fn refAbbrevCode(dwarf: *Dwarf, abbrev_code: AbbrevCode) UpdateError!@typeInfo(A |
| 4360 | 4453 | assert(abbrev_code != .null); |
| 4361 | 4454 | const entry: Entry.Index = @enumFromInt(@intFromEnum(abbrev_code)); |
| 4362 | 4455 | if (dwarf.debug_abbrev.section.getUnit(DebugAbbrev.unit).getEntry(entry).len > 0) return @intFromEnum(abbrev_code); |
| 4363 | | var debug_abbrev = std.ArrayList(u8).init(dwarf.gpa); |
| 4456 | var debug_abbrev: std.ArrayList(u8) = .init(dwarf.gpa); |
| 4364 | 4457 | defer debug_abbrev.deinit(); |
| 4365 | 4458 | const daw = debug_abbrev.writer(); |
| 4366 | 4459 | const abbrev = AbbrevCode.abbrevs.get(abbrev_code); |
| ... | ... | @@ -4422,7 +4515,7 @@ pub fn flushModule(dwarf: *Dwarf, pt: Zcu.PerThread) FlushError!void { |
| 4422 | 4515 | mod_info.root_dir_path = try dwarf.debug_line_str.addString(dwarf, root_dir_path); |
| 4423 | 4516 | } |
| 4424 | 4517 | |
| 4425 | | var header = std.ArrayList(u8).init(dwarf.gpa); |
| 4518 | var header: std.ArrayList(u8) = .init(dwarf.gpa); |
| 4426 | 4519 | defer header.deinit(); |
| 4427 | 4520 | if (dwarf.debug_aranges.section.dirty) { |
| 4428 | 4521 | for (dwarf.debug_aranges.section.units.items, 0..) |*unit_ptr, unit_index| { |
| ... | ... | @@ -4888,6 +4981,7 @@ const AbbrevCode = enum { |
| 4888 | 4981 | comptime_value_field_comptime_state, |
| 4889 | 4982 | comptime_value_elem_runtime_bits, |
| 4890 | 4983 | comptime_value_elem_comptime_state, |
| 4984 | //proc, |
| 4891 | 4985 | |
| 4892 | 4986 | const decl_bytes = uleb128Bytes(@intFromEnum(AbbrevCode.decl_instance_func_generic)); |
| 4893 | 4987 | comptime { |
| ... | ... | @@ -5757,6 +5851,12 @@ const AbbrevCode = enum { |
| 5757 | 5851 | .{ .ZIG_comptime_value, .ref_addr }, |
| 5758 | 5852 | }, |
| 5759 | 5853 | }, |
| 5854 | //.proc = .{ |
| 5855 | // .tag = .dwarf_procedure, |
| 5856 | // .attrs = &.{ |
| 5857 | // .{ .location, .exprloc }, |
| 5858 | // }, |
| 5859 | //}, |
| 5760 | 5860 | .null = undefined, |
| 5761 | 5861 | }); |
| 5762 | 5862 | }; |