diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2025-09-02 12:12:54 +0100 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2025-09-30 13:44:49 +0100 |
| commit | ed6ed62c42dfad18facde164785a62faa305cb6c (patch) | |
| tree | 9e44353b89263774cd7f55e026c4a91d53b70a82 /lib/std/debug/Dwarf.zig | |
| parent | b750e7cf9e2a1225b20ef7fdf53df9ef97cf8065 (diff) | |
| download | zig-ed6ed62c42dfad18facde164785a62faa305cb6c.tar.gz zig-ed6ed62c42dfad18facde164785a62faa305cb6c.zip | |
more stuff
Diffstat (limited to 'lib/std/debug/Dwarf.zig')
| -rw-r--r-- | lib/std/debug/Dwarf.zig | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/std/debug/Dwarf.zig b/lib/std/debug/Dwarf.zig index 8d1087b6ca..fd67860548 100644 --- a/lib/std/debug/Dwarf.zig +++ b/lib/std/debug/Dwarf.zig @@ -1449,6 +1449,7 @@ fn getStringGeneric(opt_str: ?[]const u8, offset: u64) ![:0]const u8 { return str[casted_offset..last :0]; } +// MLUGG TODO: i am dubious of this whole thing being here atp. look closely and see if it depends on being the self process pub const ElfModule = struct { unwind: Dwarf.Unwind, dwarf: Dwarf, @@ -1456,10 +1457,7 @@ pub const ElfModule = struct { external_mapped_memory: ?[]align(std.heap.page_size_min) const u8, pub const init: ElfModule = .{ - .unwind = .{ - .debug_frame = null, - .eh_frame = null, - }, + .unwind = .init, .dwarf = .{}, .mapped_memory = null, .external_mapped_memory = null, @@ -1508,6 +1506,8 @@ pub const ElfModule = struct { /// If the required sections aren't present but a reference to external debug /// info is, then this this function will recurse to attempt to load the debug /// sections from an external file. + /// + /// MLUGG TODO: this should *return* a thing pub fn load( em: *ElfModule, gpa: Allocator, @@ -1518,6 +1518,8 @@ pub const ElfModule = struct { parent_mapped_mem: ?[]align(std.heap.page_size_min) const u8, elf_filename: ?[]const u8, ) LoadError!void { + assert(em.mapped_memory == null); + if (expected_crc) |crc| if (crc != std.hash.crc.Crc32.hash(mapped_mem)) return error.InvalidDebugInfo; const hdr: *const elf.Ehdr = @ptrCast(&mapped_mem[0]); @@ -1709,8 +1711,9 @@ pub const ElfModule = struct { separate_debug_crc, §ions, mapped_mem, - )) |debug_info| { - return debug_info; + )) |v| { + v; + return; } else |_| {} // <exe_dir>/.debug/<gnu_debuglink> |
