Zig: missing stacktraces

Created on 13 May 2019  路  3Comments  路  Source: ziglang/zig

uname -ra
Darwin Kernel Version root:xnu-3789.73.27~1/RELEASE_X86_64 x86_64

zig version
0.4.0+08d41da9

I created the following program;

const std = @import("std");
const os = std.os;
const warn = std.debug.warn;

pub fn main() !void {
    var file = try os.File.openRead("~/nonExistent/ok.txt");
    defer file.close();

    var buffer: [20]u8 = undefined;
    _ = try file.read(buffer[0..buffer.len]);

    warn("buffer:\n");
    warn("{}", buffer);
}

then I ran;
zig fmt . && zig build-exe main.zig && ./main

I got the following:

error: FileNotFound
???:?:?: 0x103ce2826 in _std.os.posixOpenC (main.o)
???:?:?: 0x103cdba65 in _std.os.file.File.openReadC (main.o)
???:?:?: 0x103cdaf48 in _std.os.file.File.openRead (main.o)
???:?:?: 0x103ce8337 in _main.0 (main.o)

the stacktrace is missing file positions and other useful details

bug

Most helpful comment

I think it's finally time to introduce a stack trace regression test before closing this issue.

All 3 comments

seems that this issue was introduced with commit 6756e545f40dc7de373186a6581594e07bfd8200

I think it's finally time to introduce a stack trace regression test before closing this issue.

This is fixed now, and thanks to @mikdusan it is covered by a regression test.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dobkeratops picture dobkeratops  路  3Comments

dbandstra picture dbandstra  路  3Comments

jorangreef picture jorangreef  路  3Comments

jayschwa picture jayschwa  路  3Comments

andrewrk picture andrewrk  路  3Comments