aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug.zig
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2019-11-30 16:13:33 +0100
committerLemonBoy <thatlemon@gmail.com>2019-11-30 16:13:33 +0100
commite1e06e676666015faf733f70c6e1970999b5af9e (patch)
tree3a746667523885e19ec23ae4b70e9a323ce74133 /lib/std/debug.zig
parent85e1e3b95f1f1699a842a5e889d8987692a829a4 (diff)
downloadzig-e1e06e676666015faf733f70c6e1970999b5af9e.tar.gz
zig-e1e06e676666015faf733f70c6e1970999b5af9e.zip
linux-i386 support
Diffstat (limited to 'lib/std/debug.zig')
-rw-r--r--lib/std/debug.zig6
1 files changed, 6 insertions, 0 deletions
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]);