aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-02-05 15:56:56 -0500
committerGitHub <noreply@github.com>2020-02-05 15:56:56 -0500
commit378d733439a574cc7b961f1d6a09167479225da8 (patch)
tree92a2c005cbb6b7f5d83e81a0c20bca92ce78818d /lib/std/debug.zig
parent40b1fecace87abc2e508bfafea955b3d08266301 (diff)
parentf30feab1b90fe7fa9c9d05acb18d404a3baf717f (diff)
downloadzig-378d733439a574cc7b961f1d6a09167479225da8.tar.gz
zig-378d733439a574cc7b961f1d6a09167479225da8.zip
Merge pull request #4345 from Rocknest/open-di
Fix double close in openElfDebugInfo
Diffstat (limited to 'lib/std/debug.zig')
-rw-r--r--lib/std/debug.zig9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig
index a87dbe292d..8a0503a30d 100644
--- a/lib/std/debug.zig
+++ b/lib/std/debug.zig
@@ -378,6 +378,7 @@ pub fn printSourceAtAddress(debug_info: *DebugInfo, out_stream: var, address: us
return noasync printSourceAtAddressPosix(debug_info, out_stream, address, tty_config);
}
+/// TODO resources https://github.com/ziglang/zig/issues/4353
fn printSourceAtAddressWindows(
di: *DebugInfo,
out_stream: var,
@@ -604,6 +605,7 @@ pub const TTY = struct {
};
};
+/// TODO resources https://github.com/ziglang/zig/issues/4353
fn populateModule(di: *DebugInfo, mod: *Module) !void {
if (mod.populated)
return;
@@ -755,6 +757,7 @@ pub const OpenSelfDebugInfoError = error{
UnsupportedOperatingSystem,
};
+/// TODO resources https://github.com/ziglang/zig/issues/4353
/// TODO once https://github.com/ziglang/zig/issues/3157 is fully implemented,
/// make this `noasync fn` and remove the individual noasync calls.
pub fn openSelfDebugInfo(allocator: *mem.Allocator) !DebugInfo {
@@ -963,6 +966,7 @@ pub fn openDwarfDebugInfo(di: *DwarfInfo, allocator: *mem.Allocator) !void {
try di.scanAllCompileUnits();
}
+/// TODO resources https://github.com/ziglang/zig/issues/4353
pub fn openElfDebugInfo(
allocator: *mem.Allocator,
data: []u8,
@@ -997,12 +1001,11 @@ pub fn openElfDebugInfo(
null,
};
- efile.close();
-
try openDwarfDebugInfo(&di, allocator);
return di;
}
+/// TODO resources https://github.com/ziglang/zig/issues/4353
fn openSelfDebugInfoPosix(allocator: *mem.Allocator) !DwarfInfo {
var exe_file = try fs.openSelfExe();
errdefer exe_file.close();
@@ -1022,6 +1025,7 @@ fn openSelfDebugInfoPosix(allocator: *mem.Allocator) !DwarfInfo {
return openElfDebugInfo(allocator, exe_mmap);
}
+/// TODO resources https://github.com/ziglang/zig/issues/4353
fn openSelfDebugInfoMacOs(allocator: *mem.Allocator) !DebugInfo {
const hdr = &std.c._mh_execute_header;
assert(hdr.magic == std.macho.MH_MAGIC_64);
@@ -2074,6 +2078,7 @@ fn getAbbrevTableEntry(abbrev_table: *const AbbrevTable, abbrev_code: u64) ?*con
return null;
}
+/// TODO resources https://github.com/ziglang/zig/issues/4353
fn getLineNumberInfoMacOs(di: *DebugInfo, symbol: MachoSymbol, address: usize) !LineInfo {
const ofile = symbol.ofile orelse return error.MissingDebugInfo;
const gop = try di.ofiles.getOrPut(ofile);