| author | |
| committer | |
| log | b54bdace75df63e58892c65f97ff644b95a4b307 |
| tree | 4fb93b4d7e5069dca86fc72e27751a569bab3a96 |
| parent | e932ab003f8db74c5e4e95177eb02eb0cf0d8449 |
| parent | b0f280f4a4f3b1f804d84cc71c3e1be54d6e05a8 |
| signature |
std.debug: Add unwind support for serenity4 files changed, 29 insertions(+), 5 deletions(-)
lib/std/c.zig+12-3| ... | @@ -3140,8 +3140,17 @@ pub const SIG = switch (native_os) { | ... | @@ -3140,8 +3140,17 @@ pub const SIG = switch (native_os) { |
| 3140 | pub const UNBLOCK = 2; | 3140 | pub const UNBLOCK = 2; |
| 3141 | pub const SETMASK = 3; | 3141 | pub const SETMASK = 3; |
| 3142 | }, | 3142 | }, |
| 3143 | // https://github.com/SerenityOS/serenity/blob/046c23f567a17758d762a33bdf04bacbfd088f9f/Kernel/API/POSIX/signal.h | ||
| 3143 | // https://github.com/SerenityOS/serenity/blob/046c23f567a17758d762a33bdf04bacbfd088f9f/Kernel/API/POSIX/signal_numbers.h | 3144 | // https://github.com/SerenityOS/serenity/blob/046c23f567a17758d762a33bdf04bacbfd088f9f/Kernel/API/POSIX/signal_numbers.h |
| 3144 | .serenity => struct { | 3145 | .serenity => struct { |
| 3146 | pub const DFL: ?Sigaction.handler_fn = @ptrFromInt(0); | ||
| 3147 | pub const ERR: ?Sigaction.handler_fn = @ptrFromInt(maxInt(usize)); | ||
| 3148 | pub const IGN: ?Sigaction.handler_fn = @ptrFromInt(1); | ||
| 3149 | |||
| 3150 | pub const BLOCK = 1; | ||
| 3151 | pub const UNBLOCK = 2; | ||
| 3152 | pub const SETMASK = 3; | ||
| 3153 | |||
| 3145 | pub const INVAL = 0; | 3154 | pub const INVAL = 0; |
| 3146 | pub const HUP = 1; | 3155 | pub const HUP = 1; |
| 3147 | pub const INT = 2; | 3156 | pub const INT = 2; |
| ... | @@ -3346,15 +3355,15 @@ pub const Sigaction = switch (native_os) { | ... | @@ -3346,15 +3355,15 @@ pub const Sigaction = switch (native_os) { |
| 3346 | }, | 3355 | }, |
| 3347 | // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/signal.h#L39-L46 | 3356 | // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/signal.h#L39-L46 |
| 3348 | .serenity => extern struct { | 3357 | .serenity => extern struct { |
| 3349 | pub const handler_fn = *align(1) const fn (c_int) callconv(.c) void; | 3358 | pub const handler_fn = *align(1) const fn (i32) callconv(.c) void; |
| 3350 | pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*anyopaque) callconv(.c) void; | 3359 | pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void; |
| 3351 | 3360 | ||
| 3352 | handler: extern union { | 3361 | handler: extern union { |
| 3353 | handler: ?handler_fn, | 3362 | handler: ?handler_fn, |
| 3354 | sigaction: ?sigaction_fn, | 3363 | sigaction: ?sigaction_fn, |
| 3355 | }, | 3364 | }, |
| 3356 | mask: sigset_t, | 3365 | mask: sigset_t, |
| 3357 | flags: c_int, | 3366 | flags: c_uint, |
| 3358 | }, | 3367 | }, |
| 3359 | else => void, | 3368 | else => void, |
| 3360 | }; | 3369 | }; |
lib/std/debug.zig+2-1| ... | @@ -1288,6 +1288,7 @@ pub const have_segfault_handling_support = switch (native_os) { | ... | @@ -1288,6 +1288,7 @@ pub const have_segfault_handling_support = switch (native_os) { |
| 1288 | .windows, | 1288 | .windows, |
| 1289 | .freebsd, | 1289 | .freebsd, |
| 1290 | .openbsd, | 1290 | .openbsd, |
| 1291 | .serenity, | ||
| 1291 | => true, | 1292 | => true, |
| 1292 | 1293 | ||
| 1293 | else => false, | 1294 | else => false, |
| ... | @@ -1371,7 +1372,7 @@ fn handleSegfaultPosix(sig: i32, info: *const posix.siginfo_t, ctx_ptr: ?*anyopa | ... | @@ -1371,7 +1372,7 @@ fn handleSegfaultPosix(sig: i32, info: *const posix.siginfo_t, ctx_ptr: ?*anyopa |
| 1371 | } | 1372 | } |
| 1372 | const addr: usize = switch (native_os) { | 1373 | const addr: usize = switch (native_os) { |
| 1373 | .linux => @intFromPtr(info.fields.sigfault.addr), | 1374 | .linux => @intFromPtr(info.fields.sigfault.addr), |
| 1374 | .freebsd, .macos => @intFromPtr(info.addr), | 1375 | .freebsd, .macos, .serenity => @intFromPtr(info.addr), |
| 1375 | .netbsd => @intFromPtr(info.info.reason.fault.addr), | 1376 | .netbsd => @intFromPtr(info.info.reason.fault.addr), |
| 1376 | .openbsd => @intFromPtr(info.data.fault.addr), | 1377 | .openbsd => @intFromPtr(info.data.fault.addr), |
| 1377 | .solaris, .illumos => @intFromPtr(info.reason.fault.addr), | 1378 | .solaris, .illumos => @intFromPtr(info.reason.fault.addr), |
lib/std/debug/SelfInfo/Elf.zig+5| ... | @@ -114,6 +114,11 @@ pub const can_unwind: bool = s: { | ... | @@ -114,6 +114,11 @@ pub const can_unwind: bool = s: { |
| 114 | .x86, | 114 | .x86, |
| 115 | .x86_64, | 115 | .x86_64, |
| 116 | }, | 116 | }, |
| 117 | .serenity => &.{ | ||
| 118 | .x86_64, | ||
| 119 | .aarch64, | ||
| 120 | .riscv64, | ||
| 121 | }, | ||
| 117 | else => unreachable, | 122 | else => unreachable, |
| 118 | }; | 123 | }; |
| 119 | for (archs) |a| { | 124 | for (archs) |a| { |
lib/std/debug/cpu_context.zig+10-1| ... | @@ -57,7 +57,7 @@ pub fn fromPosixSignalContext(ctx_ptr: ?*const anyopaque) ?Native { | ... | @@ -57,7 +57,7 @@ pub fn fromPosixSignalContext(ctx_ptr: ?*const anyopaque) ?Native { |
| 57 | .r15 = uc.mcontext.gregs[std.posix.REG.R15], | 57 | .r15 = uc.mcontext.gregs[std.posix.REG.R15], |
| 58 | .rip = uc.mcontext.gregs[std.posix.REG.RIP], | 58 | .rip = uc.mcontext.gregs[std.posix.REG.RIP], |
| 59 | }) }, | 59 | }) }, |
| 60 | .freebsd => .{ .gprs = .init(.{ | 60 | .freebsd, .serenity => .{ .gprs = .init(.{ |
| 61 | .rax = uc.mcontext.rax, | 61 | .rax = uc.mcontext.rax, |
| 62 | .rdx = uc.mcontext.rdx, | 62 | .rdx = uc.mcontext.rdx, |
| 63 | .rcx = uc.mcontext.rcx, | 63 | .rcx = uc.mcontext.rcx, |
| ... | @@ -174,6 +174,11 @@ pub fn fromPosixSignalContext(ctx_ptr: ?*const anyopaque) ?Native { | ... | @@ -174,6 +174,11 @@ pub fn fromPosixSignalContext(ctx_ptr: ?*const anyopaque) ?Native { |
| 174 | .sp = uc.mcontext.sp, | 174 | .sp = uc.mcontext.sp, |
| 175 | .pc = uc.mcontext.pc, | 175 | .pc = uc.mcontext.pc, |
| 176 | }, | 176 | }, |
| 177 | .serenity => .{ | ||
| 178 | .x = uc.mcontext.x, | ||
| 179 | .sp = uc.mcontext.sp, | ||
| 180 | .pc = uc.mcontext.pc, | ||
| 181 | }, | ||
| 177 | else => null, | 182 | else => null, |
| 178 | }, | 183 | }, |
| 179 | .loongarch64 => switch (builtin.os.tag) { | 184 | .loongarch64 => switch (builtin.os.tag) { |
| ... | @@ -188,6 +193,10 @@ pub fn fromPosixSignalContext(ctx_ptr: ?*const anyopaque) ?Native { | ... | @@ -188,6 +193,10 @@ pub fn fromPosixSignalContext(ctx_ptr: ?*const anyopaque) ?Native { |
| 188 | .r = [1]usize{0} ++ uc.mcontext.gregs[1..].*, // r0 position is used for pc; replace with zero | 193 | .r = [1]usize{0} ++ uc.mcontext.gregs[1..].*, // r0 position is used for pc; replace with zero |
| 189 | .pc = uc.mcontext.gregs[0], | 194 | .pc = uc.mcontext.gregs[0], |
| 190 | }, | 195 | }, |
| 196 | .serenity => if (native_arch == .riscv32) null else .{ | ||
| 197 | .r = [1]u64{0} ++ uc.mcontext.x, | ||
| 198 | .pc = uc.mcontext.pc, | ||
| 199 | }, | ||
| 191 | else => null, | 200 | else => null, |
| 192 | }, | 201 | }, |
| 193 | .s390x => switch (builtin.os.tag) { | 202 | .s390x => switch (builtin.os.tag) { |