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...@@ -1784,6 +1784,7 @@ pub fn updateSegfaultHandler(act: ?*const os.Sigaction) error{OperationNotSuppor
1784 try os.sigaction(os.SIG.SEGV, act, null);1784 try os.sigaction(os.SIG.SEGV, act, null);
1785 try os.sigaction(os.SIG.ILL, act, null);1785 try os.sigaction(os.SIG.ILL, act, null);
1786 try os.sigaction(os.SIG.BUS, act, null);1786 try os.sigaction(os.SIG.BUS, act, null);
1787 try os.sigaction(os.SIG.FPE, act, null);
1787}1788}
17881789
1789/// Attaches a global SIGSEGV handler which calls @panic("segmentation fault");1790/// 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...@@ -1845,6 +1846,7 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any
1845 os.SIG.SEGV => stderr.print("Segmentation fault at address 0x{x}\n", .{addr}),1846 os.SIG.SEGV => stderr.print("Segmentation fault at address 0x{x}\n", .{addr}),
1846 os.SIG.ILL => stderr.print("Illegal instruction at address 0x{x}\n", .{addr}),1847 os.SIG.ILL => stderr.print("Illegal instruction at address 0x{x}\n", .{addr}),
1847 os.SIG.BUS => stderr.print("Bus error at address 0x{x}\n", .{addr}),1848 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}),
1848 else => unreachable,1850 else => unreachable,
1849 } catch os.abort();1851 } catch os.abort();
1850 }1852 }