mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
fmt and cleanup
This commit is contained in:
parent
c98e03fc7e
commit
a325d7f6d1
@ -162,8 +162,6 @@ pub fn dumpStackTraceFromBase(context: anytype) void {
|
||||
}
|
||||
|
||||
var it = StackIterator.initWithContext(null, debug_info, context) catch return;
|
||||
|
||||
// TODO: Should `it.dwarf_context.pc` be `it.getIp()`? (but then the non-dwarf case has to store ip)
|
||||
printSourceAtAddress(debug_info, stderr, it.dwarf_context.pc, tty_config) catch return;
|
||||
|
||||
while (it.next()) |return_address| {
|
||||
@ -2039,59 +2037,6 @@ fn dumpSegfaultInfoPosix(sig: i32, addr: usize, ctx_ptr: ?*const anyopaque) void
|
||||
},
|
||||
else => {},
|
||||
}
|
||||
|
||||
// TODO: Move this logic to dwarf.abi.regBytes
|
||||
|
||||
// switch (native_arch) {
|
||||
// .x86 => {
|
||||
// const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr));
|
||||
// const ip = @intCast(usize, ctx.mcontext.gregs[os.REG.EIP]) ;
|
||||
// const bp = @intCast(usize, ctx.mcontext.gregs[os.REG.EBP]);
|
||||
// dumpStackTraceFromBase(bp, ip);
|
||||
// },
|
||||
// .x86_64 => {
|
||||
// const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr));
|
||||
// const ip = switch (native_os) {
|
||||
// .linux, .netbsd, .solaris => @intCast(usize, ctx.mcontext.gregs[os.REG.RIP]),
|
||||
// .freebsd => @intCast(usize, ctx.mcontext.rip),
|
||||
// .openbsd => @intCast(usize, ctx.sc_rip),
|
||||
// .macos => @intCast(usize, ctx.mcontext.ss.rip),
|
||||
// else => unreachable,
|
||||
// };
|
||||
// const bp = switch (native_os) {
|
||||
// .linux, .netbsd, .solaris => @intCast(usize, ctx.mcontext.gregs[os.REG.RBP]),
|
||||
// .openbsd => @intCast(usize, ctx.sc_rbp),
|
||||
// .freebsd => @intCast(usize, ctx.mcontext.rbp),
|
||||
// .macos => @intCast(usize, ctx.mcontext.ss.rbp),
|
||||
// else => unreachable,
|
||||
// };
|
||||
// dumpStackTraceFromBase(bp, ip);
|
||||
// },
|
||||
// .arm => {
|
||||
// const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr));
|
||||
// const ip = @intCast(usize, ctx.mcontext.arm_pc);
|
||||
// const bp = @intCast(usize, ctx.mcontext.arm_fp);
|
||||
// dumpStackTraceFromBase(bp, ip);
|
||||
// },
|
||||
// .aarch64 => {
|
||||
// const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr));
|
||||
// const ip = switch (native_os) {
|
||||
// .macos => @intCast(usize, ctx.mcontext.ss.pc),
|
||||
// .netbsd => @intCast(usize, ctx.mcontext.gregs[os.REG.PC]),
|
||||
// .freebsd => @intCast(usize, ctx.mcontext.gpregs.elr),
|
||||
// else => @intCast(usize, ctx.mcontext.pc),
|
||||
// };
|
||||
// // x29 is the ABI-designated frame pointer
|
||||
// const bp = switch (native_os) {
|
||||
// .macos => @intCast(usize, ctx.mcontext.ss.fp),
|
||||
// .netbsd => @intCast(usize, ctx.mcontext.gregs[os.REG.FP]),
|
||||
// .freebsd => @intCast(usize, ctx.mcontext.gpregs.x[os.REG.FP]),
|
||||
// else => @intCast(usize, ctx.mcontext.regs[29]),
|
||||
// };
|
||||
// dumpStackTraceFromBase(bp, ip);
|
||||
// },
|
||||
// else => {},
|
||||
// }
|
||||
}
|
||||
|
||||
fn handleSegfaultWindows(info: *windows.EXCEPTION_POINTERS) callconv(windows.WINAPI) c_long {
|
||||
|
||||
@ -1603,7 +1603,6 @@ pub const DwarfInfo = struct {
|
||||
// TODO: Evaluate expression
|
||||
_ = expression;
|
||||
return error.UnimplementedTODO;
|
||||
|
||||
},
|
||||
else => return error.InvalidCFARule,
|
||||
};
|
||||
|
||||
@ -61,19 +61,15 @@ pub fn StackMachine(comptime options: StackMachineOptions) type {
|
||||
fn generic(value: anytype) Value {
|
||||
const int_info = @typeInfo(@TypeOf(value)).Int;
|
||||
if (@sizeOf(@TypeOf(value)) > options.addr_size) {
|
||||
return .{
|
||||
.generic = switch (int_info.signedness) {
|
||||
return .{ .generic = switch (int_info.signedness) {
|
||||
.signed => @bitCast(addr_type, @truncate(addr_type_signed, value)),
|
||||
.unsigned => @truncate(addr_type, value),
|
||||
}
|
||||
};
|
||||
} };
|
||||
} else {
|
||||
return .{
|
||||
.generic = switch (int_info.signedness) {
|
||||
return .{ .generic = switch (int_info.signedness) {
|
||||
.signed => @bitCast(addr_type, @intCast(addr_type_signed, value)),
|
||||
.unsigned => @intCast(addr_type, value),
|
||||
}
|
||||
};
|
||||
} };
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,20 +109,15 @@ pub fn StackMachine(comptime options: StackMachineOptions) type {
|
||||
=> generic(try leb.readILEB128(i64, reader)),
|
||||
OP.lit0...OP.lit31 => |n| generic(n - OP.lit0),
|
||||
OP.reg0...OP.reg31 => |n| .{ .register = n - OP.reg0 },
|
||||
OP.breg0...OP.breg31 => |n| .{
|
||||
.base_register = .{
|
||||
OP.breg0...OP.breg31 => |n| .{ .base_register = .{
|
||||
.base_register = n - OP.breg0,
|
||||
.offset = try leb.readILEB128(i64, reader),
|
||||
}
|
||||
},
|
||||
} },
|
||||
OP.regx => .{ .register = try leb.readULEB128(u8, reader) },
|
||||
OP.bregx,
|
||||
OP.regval_type => .{
|
||||
.base_register = .{
|
||||
OP.bregx, OP.regval_type => .{ .base_register = .{
|
||||
.base_register = try leb.readULEB128(u8, reader),
|
||||
.offset = try leb.readILEB128(i64, reader),
|
||||
}
|
||||
},
|
||||
} },
|
||||
OP.piece => .{
|
||||
.composite_location = .{
|
||||
.size = try leb.readULEB128(u8, reader),
|
||||
@ -139,9 +130,7 @@ pub fn StackMachine(comptime options: StackMachineOptions) type {
|
||||
.offset = try leb.readILEB128(i64, reader),
|
||||
},
|
||||
},
|
||||
OP.implicit_value,
|
||||
OP.entry_value
|
||||
=> blk: {
|
||||
OP.implicit_value, OP.entry_value => blk: {
|
||||
const size = try leb.readULEB128(u8, reader);
|
||||
if (stream.pos + size > stream.buffer.len) return error.InvalidExpression;
|
||||
const block = stream.buffer[stream.pos..][0..size];
|
||||
@ -156,12 +145,10 @@ pub fn StackMachine(comptime options: StackMachineOptions) type {
|
||||
if (stream.pos + size > stream.buffer.len) return error.InvalidExpression;
|
||||
const value_bytes = stream.buffer[stream.pos..][0..size];
|
||||
stream.pos += size;
|
||||
break :blk .{
|
||||
.base_type = .{
|
||||
break :blk .{ .base_type = .{
|
||||
.type_offset = type_offset,
|
||||
.value_bytes = value_bytes,
|
||||
}
|
||||
};
|
||||
} };
|
||||
},
|
||||
OP.deref_type,
|
||||
OP.xderef_type,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user