mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
std.debug: some adjustments to target handling
* driverkit handling missing in a few places. * x86-solaris is a dead target. * aarch64_be does not exist on Darwin, FreeBSD, Windows.
This commit is contained in:
parent
771410cbf2
commit
b46867848e
@ -84,12 +84,32 @@ pub const can_unwind: bool = s: {
|
||||
// Notably, we are yet to support unwinding on ARM. There, unwinding is not done through
|
||||
// `.eh_frame`, but instead with the `.ARM.exidx` section, which has a different format.
|
||||
const archs: []const std.Target.Cpu.Arch = switch (builtin.target.os.tag) {
|
||||
.linux => &.{ .x86, .x86_64, .aarch64, .aarch64_be },
|
||||
.netbsd => &.{ .x86, .x86_64, .aarch64, .aarch64_be },
|
||||
.freebsd => &.{ .x86_64, .aarch64, .aarch64_be },
|
||||
.openbsd => &.{.x86_64},
|
||||
.solaris => &.{ .x86, .x86_64 },
|
||||
.illumos => &.{ .x86, .x86_64 },
|
||||
.linux => &.{
|
||||
.aarch64,
|
||||
.aarch64_be,
|
||||
.x86,
|
||||
.x86_64,
|
||||
},
|
||||
.netbsd => &.{
|
||||
.aarch64,
|
||||
.aarch64_be,
|
||||
.x86,
|
||||
.x86_64,
|
||||
},
|
||||
.freebsd => &.{
|
||||
.x86_64,
|
||||
.aarch64,
|
||||
},
|
||||
.openbsd => &.{
|
||||
.x86_64,
|
||||
},
|
||||
.solaris => &.{
|
||||
.x86_64,
|
||||
},
|
||||
.illumos => &.{
|
||||
.x86,
|
||||
.x86_64,
|
||||
},
|
||||
else => unreachable,
|
||||
};
|
||||
for (archs) |a| {
|
||||
|
||||
@ -371,7 +371,7 @@ fn unwindFrameInner(si: *SelfInfo, gpa: Allocator, context: *UnwindContext) !usi
|
||||
return context.next(gpa, &rules);
|
||||
},
|
||||
},
|
||||
.aarch64, .aarch64_be => switch (encoding.mode.arm64) {
|
||||
.aarch64 => switch (encoding.mode.arm64) {
|
||||
.OLD => return error.UnsupportedDebugInfo,
|
||||
.FRAMELESS => ip: {
|
||||
const sp = (try dwarfRegNative(&context.cpu_state, sp_reg_num)).*;
|
||||
|
||||
@ -88,7 +88,7 @@ pub const UnwindContext = struct {
|
||||
.R15 = ctx.gprs.get(.r15),
|
||||
.Rip = ctx.gprs.get(.rip),
|
||||
}),
|
||||
.aarch64, .aarch64_be => .{
|
||||
.aarch64 => .{
|
||||
.ContextFlags = 0,
|
||||
.Cpsr = 0,
|
||||
.DUMMYUNIONNAME = .{ .X = ctx.x },
|
||||
|
||||
@ -21,7 +21,7 @@ pub fn fromPosixSignalContext(ctx_ptr: ?*const anyopaque) ?Native {
|
||||
const uc: *const signal_ucontext_t = @ptrCast(@alignCast(ctx_ptr));
|
||||
return switch (native_arch) {
|
||||
.x86 => switch (native_os) {
|
||||
.linux, .netbsd, .solaris, .illumos => .{ .gprs = .init(.{
|
||||
.linux, .netbsd, .illumos => .{ .gprs = .init(.{
|
||||
.eax = uc.mcontext.gregs[std.posix.REG.EAX],
|
||||
.ecx = uc.mcontext.gregs[std.posix.REG.ECX],
|
||||
.edx = uc.mcontext.gregs[std.posix.REG.EDX],
|
||||
@ -92,7 +92,7 @@ pub fn fromPosixSignalContext(ctx_ptr: ?*const anyopaque) ?Native {
|
||||
.r15 = @bitCast(uc.sc_r15),
|
||||
.rip = @bitCast(uc.sc_rip),
|
||||
}) },
|
||||
.macos, .ios => .{ .gprs = .init(.{
|
||||
.driverkit, .macos, .ios => .{ .gprs = .init(.{
|
||||
.rax = uc.mcontext.ss.rax,
|
||||
.rdx = uc.mcontext.ss.rdx,
|
||||
.rcx = uc.mcontext.ss.rcx,
|
||||
@ -137,7 +137,7 @@ pub fn fromPosixSignalContext(ctx_ptr: ?*const anyopaque) ?Native {
|
||||
else => null,
|
||||
},
|
||||
.aarch64, .aarch64_be => switch (builtin.os.tag) {
|
||||
.macos, .ios, .tvos, .watchos, .visionos => .{
|
||||
.driverkit, .macos, .ios, .tvos, .watchos, .visionos => .{
|
||||
.x = uc.mcontext.ss.regs ++ @as([2]u64, .{
|
||||
uc.mcontext.ss.fp, // x29 = fp
|
||||
uc.mcontext.ss.lr, // x30 = lr
|
||||
@ -209,7 +209,7 @@ pub fn fromWindowsContext(ctx: *const std.os.windows.CONTEXT) Native {
|
||||
.r15 = ctx.R15,
|
||||
.rip = ctx.Rip,
|
||||
}) },
|
||||
.aarch64, .aarch64_be => .{
|
||||
.aarch64 => .{
|
||||
.x = ctx.DUMMYUNIONNAME.X[0..31].*,
|
||||
.sp = ctx.Sp,
|
||||
.pc = ctx.Pc,
|
||||
@ -371,7 +371,6 @@ pub const Arm = struct {
|
||||
pub fn dwarfRegisterBytes(ctx: *Arm, register_num: u16) DwarfRegisterError![]u8 {
|
||||
// DWARF for the Arm(r) Architecture § 4.1 "DWARF register names"
|
||||
switch (register_num) {
|
||||
// The order of `Gpr` intentionally matches DWARF's mappings.
|
||||
0...15 => return @ptrCast(&ctx.r[register_num]),
|
||||
|
||||
64...95 => return error.UnsupportedRegister, // S0 - S31
|
||||
@ -444,7 +443,6 @@ pub const Aarch64 = extern struct {
|
||||
pub fn dwarfRegisterBytes(ctx: *Aarch64, register_num: u16) DwarfRegisterError![]u8 {
|
||||
// DWARF for the Arm(r) 64-bit Architecture (AArch64) § 4.1 "DWARF register names"
|
||||
switch (register_num) {
|
||||
// The order of `Gpr` intentionally matches DWARF's mappings.
|
||||
0...30 => return @ptrCast(&ctx.x[register_num]),
|
||||
31 => return @ptrCast(&ctx.sp),
|
||||
32 => return @ptrCast(&ctx.pc),
|
||||
@ -471,7 +469,7 @@ const signal_ucontext_t = switch (native_os) {
|
||||
.linux => std.os.linux.ucontext_t,
|
||||
.emscripten => std.os.emscripten.ucontext_t,
|
||||
.freebsd => std.os.freebsd.ucontext_t,
|
||||
.macos, .ios, .tvos, .watchos, .visionos => extern struct {
|
||||
.driverkit, .macos, .ios, .tvos, .watchos, .visionos => extern struct {
|
||||
onstack: c_int,
|
||||
sigmask: std.c.sigset_t,
|
||||
stack: std.c.stack_t,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user