diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2025-09-09 14:20:49 +0100 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2025-09-30 13:44:52 +0100 |
| commit | c1a30bd0d876330ce7a241fc297c66577ae7e6aa (patch) | |
| tree | fbc6e50c11746e259fb5366caf57fce40c4d6964 /lib/std/debug/SelfInfo.zig | |
| parent | f7980487395b660d5c568ba57891ab371a27102d (diff) | |
| download | zig-c1a30bd0d876330ce7a241fc297c66577ae7e6aa.tar.gz zig-c1a30bd0d876330ce7a241fc297c66577ae7e6aa.zip | |
std: replace debug.Dwarf.ElfModule with debug.ElfFile
This abstraction isn't really tied to DWARF at all! Really, we're just
loading some information from an ELF file which is useful for debugging.
That *includes* DWARF, but it also includes other information. For
instance, the other change here:
Now, if DWARF information is missing, `debug.SelfInfo.ElfModule` will
name symbols by finding a matching symtab entry. We actually already do
this on Mach-O, so it makes obvious sense to do the same on ELF! This
change is what motivated the restructuring to begin with.
The symtab work is derived from #22077.
Co-authored-by: geemili <opensource@geemili.xyz>
Diffstat (limited to 'lib/std/debug/SelfInfo.zig')
| -rw-r--r-- | lib/std/debug/SelfInfo.zig | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/std/debug/SelfInfo.zig b/lib/std/debug/SelfInfo.zig index ef222cc7f4..d838a1a6c1 100644 --- a/lib/std/debug/SelfInfo.zig +++ b/lib/std/debug/SelfInfo.zig @@ -78,6 +78,7 @@ pub fn getSymbolAtAddress(self: *SelfInfo, gpa: Allocator, address: usize) Error pub fn getModuleNameForAddress(self: *SelfInfo, gpa: Allocator, address: usize) Error![]const u8 { comptime assert(target_supported); const module: Module = try .lookup(&self.lookup_cache, gpa, address); + if (module.name.len == 0) return error.MissingDebugInfo; return module.name; } |
