From e1e06e676666015faf733f70c6e1970999b5af9e Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Sat, 30 Nov 2019 16:13:33 +0100 Subject: linux-i386 support --- lib/std/debug.zig | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/std/debug.zig') diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 6324c88d86..377e400d7c 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -2417,6 +2417,12 @@ extern fn handleSegfaultLinux(sig: i32, info: *const os.siginfo_t, ctx_ptr: *con std.debug.warn("Segmentation fault at address 0x{x}\n", addr); switch (builtin.arch) { + .i386 => { + const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr)); + const ip = @intCast(usize, ctx.mcontext.gregs[os.REG_EIP]); + const bp = @intCast(usize, ctx.mcontext.gregs[os.REG_EBP]); + dumpStackTraceFromBase(bp, ip); + }, .x86_64 => { const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr)); const ip = @intCast(usize, ctx.mcontext.gregs[os.REG_RIP]); -- cgit v1.2.3