aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug/Dwarf/Unwind.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2025-09-02 15:54:36 +0100
committermlugg <mlugg@mlugg.co.uk>2025-09-30 13:44:49 +0100
commit84b65860cfa4b7e61cb98347778331d67137d7e8 (patch)
tree164290d3b2e86f06e74e02f2ca9d315edaed4e5b /lib/std/debug/Dwarf/Unwind.zig
parent55a7affea41a4a1f4e117d7ee55c1c0e8b869203 (diff)
downloadzig-84b65860cfa4b7e61cb98347778331d67137d7e8.tar.gz
zig-84b65860cfa4b7e61cb98347778331d67137d7e8.zip
the world if ElfModule didn't suck:
Diffstat (limited to 'lib/std/debug/Dwarf/Unwind.zig')
-rw-r--r--lib/std/debug/Dwarf/Unwind.zig11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/std/debug/Dwarf/Unwind.zig b/lib/std/debug/Dwarf/Unwind.zig
index 09cad0db23..323bf39874 100644
--- a/lib/std/debug/Dwarf/Unwind.zig
+++ b/lib/std/debug/Dwarf/Unwind.zig
@@ -41,8 +41,6 @@ const SortedFdeEntry = struct {
const Section = enum { debug_frame, eh_frame };
-// MLUGG TODO deinit?
-
/// Initialize with unwind information from the contents of a `.debug_frame` or `.eh_frame` section.
///
/// If the `.eh_frame_hdr` section is available, consider instead using `initEhFrameHdr`. This
@@ -78,6 +76,13 @@ pub fn initEhFrameHdr(header: EhFrameHeader, section_vaddr: u64, section_bytes_p
};
}
+pub fn deinit(unwind: *Unwind, gpa: Allocator) void {
+ if (unwind.lookup) |lookup| switch (lookup) {
+ .eh_frame_hdr => {},
+ .sorted_fdes => |fdes| gpa.free(fdes),
+ };
+}
+
/// This represents the decoded .eh_frame_hdr header
pub const EhFrameHeader = struct {
eh_frame_vaddr: u64,
@@ -205,8 +210,6 @@ pub const EntryHeader = union(enum) {
const unit_header = try Dwarf.readUnitHeader(r, endian);
if (unit_header.unit_length == 0) return .terminator;
- // TODO MLUGG: seriously, just... check the formats of everything in BOTH LSB Core and DWARF. this is a fucking *mess*. maybe add spec references.
-
// Next is a value which will disambiguate CIEs and FDEs. Annoyingly, LSB Core makes this
// value always 4-byte, whereas DWARF makes it depend on the `dwarf.Format`.
const cie_ptr_or_id_size: u8 = switch (section) {