build: update std/debug.zig to zig-0.15.0-dev.877+0adcfd60f
This commit is contained in:
parent
b258b2bb54
commit
0a4c1a57b1
2 changed files with 38 additions and 28 deletions
|
@ -124,7 +124,7 @@ pub fn install_crash_handler() void {
|
||||||
}
|
}
|
||||||
const act = std.posix.Sigaction{
|
const act = std.posix.Sigaction{
|
||||||
.handler = .{ .sigaction = handle_crash },
|
.handler = .{ .sigaction = handle_crash },
|
||||||
.mask = std.posix.empty_sigset,
|
.mask = std.posix.sigemptyset(),
|
||||||
.flags = (std.posix.SA.SIGINFO | std.posix.SA.RESTART),
|
.flags = (std.posix.SA.SIGINFO | std.posix.SA.RESTART),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -78,13 +78,9 @@ pub fn FullPanic(comptime panicFn: fn ([]const u8, ?usize) noreturn) type {
|
||||||
@branchHint(.cold);
|
@branchHint(.cold);
|
||||||
call("invalid error code", @returnAddress());
|
call("invalid error code", @returnAddress());
|
||||||
}
|
}
|
||||||
pub fn castTruncatedData() noreturn {
|
pub fn integerOutOfBounds() noreturn {
|
||||||
@branchHint(.cold);
|
@branchHint(.cold);
|
||||||
call("integer cast truncated bits", @returnAddress());
|
call("integer does not fit in destination type", @returnAddress());
|
||||||
}
|
|
||||||
pub fn negativeToUnsigned() noreturn {
|
|
||||||
@branchHint(.cold);
|
|
||||||
call("attempt to cast negative value to unsigned integer", @returnAddress());
|
|
||||||
}
|
}
|
||||||
pub fn integerOverflow() noreturn {
|
pub fn integerOverflow() noreturn {
|
||||||
@branchHint(.cold);
|
@branchHint(.cold);
|
||||||
|
@ -126,9 +122,9 @@ pub fn FullPanic(comptime panicFn: fn ([]const u8, ?usize) noreturn) type {
|
||||||
@branchHint(.cold);
|
@branchHint(.cold);
|
||||||
call("for loop over objects with non-equal lengths", @returnAddress());
|
call("for loop over objects with non-equal lengths", @returnAddress());
|
||||||
}
|
}
|
||||||
pub fn memcpyLenMismatch() noreturn {
|
pub fn copyLenMismatch() noreturn {
|
||||||
@branchHint(.cold);
|
@branchHint(.cold);
|
||||||
call("@memcpy arguments have non-equal lengths", @returnAddress());
|
call("source and destination arguments have non-equal lengths", @returnAddress());
|
||||||
}
|
}
|
||||||
pub fn memcpyAlias() noreturn {
|
pub fn memcpyAlias() noreturn {
|
||||||
@branchHint(.cold);
|
@branchHint(.cold);
|
||||||
|
@ -165,9 +161,11 @@ pub const sys_can_stack_trace = switch (builtin.cpu.arch) {
|
||||||
|
|
||||||
// `@returnAddress()` in LLVM 10 gives
|
// `@returnAddress()` in LLVM 10 gives
|
||||||
// "Non-Emscripten WebAssembly hasn't implemented __builtin_return_address".
|
// "Non-Emscripten WebAssembly hasn't implemented __builtin_return_address".
|
||||||
|
// On Emscripten, Zig only supports `@returnAddress()` in debug builds
|
||||||
|
// because Emscripten's implementation is very slow.
|
||||||
.wasm32,
|
.wasm32,
|
||||||
.wasm64,
|
.wasm64,
|
||||||
=> native_os == .emscripten,
|
=> native_os == .emscripten and builtin.mode == .Debug,
|
||||||
|
|
||||||
// `@returnAddress()` is unsupported in LLVM 13.
|
// `@returnAddress()` is unsupported in LLVM 13.
|
||||||
.bpfel,
|
.bpfel,
|
||||||
|
@ -586,15 +584,20 @@ pub fn defaultPanic(
|
||||||
|
|
||||||
// For backends that cannot handle the language features depended on by the
|
// For backends that cannot handle the language features depended on by the
|
||||||
// default panic handler, we have a simpler panic handler:
|
// default panic handler, we have a simpler panic handler:
|
||||||
if (builtin.zig_backend == .stage2_wasm or
|
switch (builtin.zig_backend) {
|
||||||
builtin.zig_backend == .stage2_arm or
|
.stage2_aarch64,
|
||||||
builtin.zig_backend == .stage2_aarch64 or
|
.stage2_arm,
|
||||||
builtin.zig_backend == .stage2_x86 or
|
.stage2_powerpc,
|
||||||
(builtin.zig_backend == .stage2_x86_64 and (builtin.target.ofmt != .elf and builtin.target.ofmt != .macho)) or
|
.stage2_riscv64,
|
||||||
builtin.zig_backend == .stage2_sparc64 or
|
.stage2_spirv,
|
||||||
builtin.zig_backend == .stage2_spirv64)
|
.stage2_wasm,
|
||||||
{
|
.stage2_x86,
|
||||||
@trap();
|
=> @trap(),
|
||||||
|
.stage2_x86_64 => switch (builtin.target.ofmt) {
|
||||||
|
.elf, .macho => {},
|
||||||
|
else => @trap(),
|
||||||
|
},
|
||||||
|
else => {},
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (builtin.os.tag) {
|
switch (builtin.os.tag) {
|
||||||
|
@ -615,9 +618,9 @@ pub fn defaultPanic(
|
||||||
// isn't visible on actual hardware if directly booted into
|
// isn't visible on actual hardware if directly booted into
|
||||||
inline for ([_]?*uefi.protocol.SimpleTextOutput{ uefi.system_table.std_err, uefi.system_table.con_out }) |o| {
|
inline for ([_]?*uefi.protocol.SimpleTextOutput{ uefi.system_table.std_err, uefi.system_table.con_out }) |o| {
|
||||||
if (o) |out| {
|
if (o) |out| {
|
||||||
_ = out.setAttribute(uefi.protocol.SimpleTextOutput.red);
|
out.setAttribute(.{ .foreground = .red }) catch {};
|
||||||
_ = out.outputString(exit_msg);
|
_ = out.outputString(exit_msg) catch {};
|
||||||
_ = out.setAttribute(uefi.protocol.SimpleTextOutput.white);
|
out.setAttribute(.{ .foreground = .white }) catch {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -752,7 +755,7 @@ pub const StackIterator = struct {
|
||||||
pub fn init(first_address: ?usize, fp: ?usize) StackIterator {
|
pub fn init(first_address: ?usize, fp: ?usize) StackIterator {
|
||||||
if (native_arch.isSPARC()) {
|
if (native_arch.isSPARC()) {
|
||||||
// Flush all the register windows on stack.
|
// Flush all the register windows on stack.
|
||||||
asm volatile (if (std.Target.sparc.featureSetHas(builtin.cpu.features, .v9))
|
asm volatile (if (builtin.cpu.has(.sparc, .v9))
|
||||||
"flushw"
|
"flushw"
|
||||||
else
|
else
|
||||||
"ta 3" // ST_FLUSH_WINDOWS
|
"ta 3" // ST_FLUSH_WINDOWS
|
||||||
|
@ -905,6 +908,8 @@ pub const StackIterator = struct {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (builtin.omit_frame_pointer) return null;
|
||||||
|
|
||||||
const fp = if (comptime native_arch.isSPARC())
|
const fp = if (comptime native_arch.isSPARC())
|
||||||
// On SPARC the offset is positive. (!)
|
// On SPARC the offset is positive. (!)
|
||||||
math.add(usize, it.fp, fp_offset) catch return null
|
math.add(usize, it.fp, fp_offset) catch return null
|
||||||
|
@ -1371,12 +1376,11 @@ pub fn attachSegfaultHandler() void {
|
||||||
windows_segfault_handle = windows.kernel32.AddVectoredExceptionHandler(0, handleSegfaultWindows);
|
windows_segfault_handle = windows.kernel32.AddVectoredExceptionHandler(0, handleSegfaultWindows);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var act = posix.Sigaction{
|
const act = posix.Sigaction{
|
||||||
.handler = .{ .sigaction = handleSegfaultPosix },
|
.handler = .{ .sigaction = handleSegfaultPosix },
|
||||||
.mask = posix.empty_sigset,
|
.mask = posix.sigemptyset(),
|
||||||
.flags = (posix.SA.SIGINFO | posix.SA.RESTART | posix.SA.RESETHAND),
|
.flags = (posix.SA.SIGINFO | posix.SA.RESTART | posix.SA.RESETHAND),
|
||||||
};
|
};
|
||||||
|
|
||||||
updateSegfaultHandler(&act);
|
updateSegfaultHandler(&act);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1388,9 +1392,9 @@ fn resetSegfaultHandler() void {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var act = posix.Sigaction{
|
const act = posix.Sigaction{
|
||||||
.handler = .{ .handler = posix.SIG.DFL },
|
.handler = .{ .handler = posix.SIG.DFL },
|
||||||
.mask = posix.empty_sigset,
|
.mask = posix.sigemptyset(),
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
};
|
};
|
||||||
updateSegfaultHandler(&act);
|
updateSegfaultHandler(&act);
|
||||||
|
@ -1504,6 +1508,12 @@ fn handleSegfaultWindows(info: *windows.EXCEPTION_POINTERS) callconv(.winapi) c_
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handleSegfaultWindowsExtra(info: *windows.EXCEPTION_POINTERS, msg: u8, label: ?[]const u8) noreturn {
|
fn handleSegfaultWindowsExtra(info: *windows.EXCEPTION_POINTERS, msg: u8, label: ?[]const u8) noreturn {
|
||||||
|
// For backends that cannot handle the language features used by this segfault handler, we have a simpler one,
|
||||||
|
switch (builtin.zig_backend) {
|
||||||
|
.stage2_x86_64 => if (builtin.target.ofmt == .coff) @trap(),
|
||||||
|
else => {},
|
||||||
|
}
|
||||||
|
|
||||||
comptime assert(windows.CONTEXT != void);
|
comptime assert(windows.CONTEXT != void);
|
||||||
nosuspend switch (panic_stage) {
|
nosuspend switch (panic_stage) {
|
||||||
0 => {
|
0 => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue