Add simple stacktrace logging

This commit is contained in:
Sam Tebbs 2019-11-02 02:18:02 +00:00
parent 9d52e08ea7
commit f0161f0ec9
10 changed files with 477 additions and 14 deletions

View file

@ -1,7 +1,13 @@
const builtin = @import("builtin");
const std = @import("std");
const MemProfile = @import("mem_mock.zig").MemProfile;
pub fn panic(trace: ?*builtin.StackTrace, comptime format: []const u8, args: ...) noreturn {
@setCold(true);
std.debug.panic(format, args);
}
pub fn init(mem_profile: *const MemProfile, allocator: *std.mem.Allocator) !void {
// This is never run so just return an arbitrary error to satisfy the compiler
return error.NotNeeded;
}

View file

@ -42,11 +42,13 @@ def get_pre_archinit_cases():
def get_post_archinit_cases():
return [
TestCase("Arch init finishes", [r"Arch init done"]),
TestCase("Panic init", [r"Init panic", r"Done"]),
TestCase("VGA init", [r"Init vga", r"Done"]),
TestCase("VGA tests", [r"VGA: Tested max scan line", r"VGA: Tested cursor shape", r"VGA: Tested updating cursor"]),
TestCase("TTY init", [r"Init tty", r"Done"]),
TestCase("TTY tests", [r"TTY: Tested globals", r"TTY: Tested printing"]),
TestCase("Init finishes", [r"Init done"])
TestCase("Init finishes", [r"Init done"]),
TestCase("Panic tests", [r"Kernel panic: integer overflow", r"c[a-z\d]+: panic", r"c[a-z\d]+: panic.runtimeTests", r"c[a-z\d]+: kmain", r"c[a-z\d]+: start_higher_half"], "\[ERROR\] ")
]
def read_messages(proc):