aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug.zig
diff options
context:
space:
mode:
authorDavid Gonzalez Martin <davidgm94.work@protonmail.com>2023-07-24 23:49:44 -0600
committerJakub Konka <kubkon@jakubkonka.com>2023-08-04 09:24:11 +0200
commit9c05810be60756e07bd7fee09633671bbaa8cda6 (patch)
tree5cb47bace64690c2f738057037361e22441a1017 /lib/std/debug.zig
parent516eb33442bb6711ec62bf66c941696de9dca5b5 (diff)
downloadzig-9c05810be60756e07bd7fee09633671bbaa8cda6.tar.gz
zig-9c05810be60756e07bd7fee09633671bbaa8cda6.zip
debug: expose module debug info deinitialization
Before this commit, you could use readElfDebugInfo independently with one catch: the data is not freed since the deinitialization functions for ModuleDebugInfo are private. This change makes them public so the users of such function and similar can free the memory after the debug symbols have been used.
Diffstat (limited to 'lib/std/debug.zig')
-rw-r--r--lib/std/debug.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig
index ddd0f0ec95..52b5d2c19c 100644
--- a/lib/std/debug.zig
+++ b/lib/std/debug.zig
@@ -1949,7 +1949,7 @@ pub const ModuleDebugInfo = switch (native_os) {
addr_table: std.StringHashMap(u64),
};
- fn deinit(self: *@This(), allocator: mem.Allocator) void {
+ pub fn deinit(self: *@This(), allocator: mem.Allocator) void {
var it = self.ofiles.iterator();
while (it.next()) |entry| {
const ofile = entry.value_ptr;
@@ -2148,7 +2148,7 @@ pub const ModuleDebugInfo = switch (native_os) {
/// Only used if debug_data is .pdb
coff_section_headers: []coff.SectionHeader,
- fn deinit(self: *@This(), allocator: mem.Allocator) void {
+ pub fn deinit(self: *@This(), allocator: mem.Allocator) void {
self.debug_data.deinit(allocator);
if (self.debug_data == .pdb) {
allocator.free(self.coff_section_headers);
@@ -2221,7 +2221,7 @@ pub const ModuleDebugInfo = switch (native_os) {
mapped_memory: []align(mem.page_size) const u8,
external_mapped_memory: ?[]align(mem.page_size) const u8,
- fn deinit(self: *@This(), allocator: mem.Allocator) void {
+ pub fn deinit(self: *@This(), allocator: mem.Allocator) void {
self.dwarf.deinit(allocator);
os.munmap(self.mapped_memory);
if (self.external_mapped_memory) |m| os.munmap(m);
@@ -2240,7 +2240,7 @@ pub const ModuleDebugInfo = switch (native_os) {
}
},
.wasi => struct {
- fn deinit(self: *@This(), allocator: mem.Allocator) void {
+ pub fn deinit(self: *@This(), allocator: mem.Allocator) void {
_ = self;
_ = allocator;
}