aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-07-28 18:40:01 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-07-29 02:35:06 -0700
commita48251735787f590491caf4e446dad74c66aa13c (patch)
treebb19fa93b4512ec4c190661015204f2e127024e8
parentfdaf9c40d6a351477aacb1af27871f3de12d485e (diff)
downloadzig-a48251735787f590491caf4e446dad74c66aa13c.tar.gz
zig-a48251735787f590491caf4e446dad74c66aa13c.zip
std.debug: default signal handler also handles SIGFPE
-rw-r--r--lib/std/debug.zig2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig
index b406fed471..7d0dcd35d0 100644
--- a/lib/std/debug.zig
+++ b/lib/std/debug.zig
@@ -1784,6 +1784,7 @@ pub fn updateSegfaultHandler(act: ?*const os.Sigaction) error{OperationNotSuppor
try os.sigaction(os.SIG.SEGV, act, null);
try os.sigaction(os.SIG.ILL, act, null);
try os.sigaction(os.SIG.BUS, act, null);
+ try os.sigaction(os.SIG.FPE, act, null);
}
/// Attaches a global SIGSEGV handler which calls @panic("segmentation fault");
@@ -1845,6 +1846,7 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any
os.SIG.SEGV => stderr.print("Segmentation fault at address 0x{x}\n", .{addr}),
os.SIG.ILL => stderr.print("Illegal instruction at address 0x{x}\n", .{addr}),
os.SIG.BUS => stderr.print("Bus error at address 0x{x}\n", .{addr}),
+ os.SIG.FPE => stderr.print("Arithmetic exception at address 0x{x}\n", .{addr}),
else => unreachable,
} catch os.abort();
}