authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-28 18:40:01-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-29 02:35:06-07:00
loga48251735787f590491caf4e446dad74c66aa13c
treebb19fa93b4512ec4c190661015204f2e127024e8
parentfdaf9c40d6a351477aacb1af27871f3de12d485e

std.debug: default signal handler also handles SIGFPE


1 files changed, 2 insertions(+), 0 deletions(-)

lib/std/debug.zig+2
......@@ -1784,6 +1784,7 @@ pub fn updateSegfaultHandler(act: ?*const os.Sigaction) error{OperationNotSuppor
17841784 try os.sigaction(os.SIG.SEGV, act, null);
17851785 try os.sigaction(os.SIG.ILL, act, null);
17861786 try os.sigaction(os.SIG.BUS, act, null);
1787 try os.sigaction(os.SIG.FPE, act, null);
17871788}
17881789
17891790/// 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
18451846 os.SIG.SEGV => stderr.print("Segmentation fault at address 0x{x}\n", .{addr}),
18461847 os.SIG.ILL => stderr.print("Illegal instruction at address 0x{x}\n", .{addr}),
18471848 os.SIG.BUS => stderr.print("Bus error at address 0x{x}\n", .{addr}),
1849 os.SIG.FPE => stderr.print("Arithmetic exception at address 0x{x}\n", .{addr}),
18481850 else => unreachable,
18491851 } catch os.abort();
18501852 }