diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-02-07 22:51:43 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-07 22:51:43 -0500 |
| commit | 0e7461d4a34272a94acba20b09aaee283e88a806 (patch) | |
| tree | 72b45e0feb56452e8d3fb25c8bf68a401b19b656 /lib/std/debug.zig | |
| parent | eff50abce68ffc69d236fcc0b919bc63fcd0e89a (diff) | |
| parent | a779450fefd623c54da37912995ffe7ad16b514e (diff) | |
| download | zig-0e7461d4a34272a94acba20b09aaee283e88a806.tar.gz zig-0e7461d4a34272a94acba20b09aaee283e88a806.zip | |
Merge pull request #4408 from LemonBoy/mmap-i386-fix
handle SIGBUS, fix mmap on i386 linux
Diffstat (limited to 'lib/std/debug.zig')
| -rw-r--r-- | lib/std/debug.zig | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 100ac3e798..b9fafab07c 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -2256,6 +2256,7 @@ pub fn attachSegfaultHandler() void { os.sigaction(os.SIGSEGV, &act, null); os.sigaction(os.SIGILL, &act, null); + os.sigaction(os.SIGBUS, &act, null); } fn resetSegfaultHandler() void { @@ -2273,6 +2274,7 @@ fn resetSegfaultHandler() void { }; os.sigaction(os.SIGSEGV, &act, null); os.sigaction(os.SIGILL, &act, null); + os.sigaction(os.SIGBUS, &act, null); } fn handleSegfaultLinux(sig: i32, info: *const os.siginfo_t, ctx_ptr: *const c_void) callconv(.C) noreturn { @@ -2285,6 +2287,7 @@ fn handleSegfaultLinux(sig: i32, info: *const os.siginfo_t, ctx_ptr: *const c_vo switch (sig) { os.SIGSEGV => std.debug.warn("Segmentation fault at address 0x{x}\n", .{addr}), os.SIGILL => std.debug.warn("Illegal instruction at address 0x{x}\n", .{addr}), + os.SIGBUS => std.debug.warn("Bus error at address 0x{x}\n", .{addr}), else => unreachable, } switch (builtin.arch) { |
