struct UnwindContext [src]
Fields
allocator: Allocator
cfa: ?usize
pc: usize
thread_context: *std.debug.ThreadContext
reg_context: Dwarf.abi.RegisterContext
vm: VirtualMachine
stack_machine: Dwarf.expression.StackMachine(.{ .call_frame_context = true })
Members
Source
pub const UnwindContext = struct {
allocator: Allocator,
cfa: ?usize,
pc: usize,
thread_context: *std.debug.ThreadContext,
reg_context: Dwarf.abi.RegisterContext,
vm: VirtualMachine,
stack_machine: Dwarf.expression.StackMachine(.{ .call_frame_context = true }),
pub fn init(
allocator: Allocator,
thread_context: *std.debug.ThreadContext,
) !UnwindContext {
comptime assert(supports_unwinding);
const pc = stripInstructionPtrAuthCode(
(try regValueNative(thread_context, ip_reg_num, null)).*,
);
const context_copy = try allocator.create(std.debug.ThreadContext);
std.debug.copyContext(thread_context, context_copy);
return .{
.allocator = allocator,
.cfa = null,
.pc = pc,
.thread_context = context_copy,
.reg_context = undefined,
.vm = .{},
.stack_machine = .{},
};
}
pub fn deinit(self: *UnwindContext) void {
self.vm.deinit(self.allocator);
self.stack_machine.deinit(self.allocator);
self.allocator.destroy(self.thread_context);
self.* = undefined;
}
pub fn getFp(self: *const UnwindContext) !usize {
return (try regValueNative(self.thread_context, fpRegNum(self.reg_context), self.reg_context)).*;
}
}