mzteinit: print ERT

This commit is contained in:
LordMZTE 2024-02-03 00:20:49 +01:00
parent 21b6392a13
commit 5b4585e820
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
2 changed files with 20 additions and 1 deletions

View file

@ -42,6 +42,26 @@ pub fn main() void {
tryMain() catch |e| {
std.log.err("FATAL ERROR: {}", .{e});
if (@errorReturnTrace()) |trace| {
var buf: [1024 * 8]u8 = undefined;
const trace_s = s: {
const deb_inf = std.debug.getSelfDebugInfo() catch break :s null;
var fbs = std.io.fixedBufferStream(&buf);
std.debug.writeStackTrace(
trace.*,
fbs.writer(),
std.heap.page_allocator,
deb_inf,
.no_color,
) catch break :s null;
break :s fbs.getWritten();
};
if (trace_s) |s| {
std.log.err("ERT: {s}", .{s});
}
}
std.debug.print("Encountered fatal error (check log), starting emergency shell!\n", .{});
@panic(@errorName(std.os.execveZ(

View file

@ -7,4 +7,3 @@ pub fn Mutex(comptime T: type) type {
mtx: std.Thread.Mutex = .{},
};
}