DoxigAlpha

runTo

Runs the CIE instructions, then the FDE instructions. Execution halts once the row that corresponds to pc is known, and the row is returned.

Function parameters

Parameters

#
self:*VirtualMachine
allocator:std.mem.Allocator
pc:u64
cie:std.debug.Dwarf.CommonInformationEntry
fde:std.debug.Dwarf.FrameDescriptionEntry
addr_size_bytes:u8
endian:std.builtin.Endian

How is this different than `Module` when the host is Windows?

Types

#
WindowsModule
How is this different than `Module` when the host is Windows?
VirtualMachine
This is a virtual machine that runs DWARF call frame instructions.

Functions in this namespace

Functions

#
readElfDebugInfo
Reads debug info from an ELF file, or the current binary if none in specified.
unwindFrameMachO
Unwind a frame using MachO compact unwind info (from __unwind_info).
stripInstructionPtrAuthCode
Some platforms use pointer authentication - the upper bits of instruction pointers contain a signature.
unwindFrameDwarf
Unwind a stack frame using DWARF unwinding info, updating the register context.
supportsUnwinding
Tells whether unwinding for this target is *implemented* here in the Zig

Error sets in this namespace

Error Sets

#

Tells whether unwinding for the host is implemented.

Values

#
supports_unwinding
Tells whether unwinding for the host is implemented.

Source

Implementation

#
pub fn runTo(
    self: *VirtualMachine,
    allocator: std.mem.Allocator,
    pc: u64,
    cie: std.debug.Dwarf.CommonInformationEntry,
    fde: std.debug.Dwarf.FrameDescriptionEntry,
    addr_size_bytes: u8,
    endian: std.builtin.Endian,
) !Row {
    assert(self.cie_row == null);
    if (pc < fde.pc_begin or pc >= fde.pc_begin + fde.pc_range) return error.AddressOutOfRange;

    var prev_row: Row = self.current_row;

    var cie_stream = std.io.fixedBufferStream(cie.initial_instructions);
    var fde_stream = std.io.fixedBufferStream(fde.instructions);
    var streams = [_]*std.io.FixedBufferStream([]const u8){
        &cie_stream,
        &fde_stream,
    };

    for (&streams, 0..) |stream, i| {
        while (stream.pos < stream.buffer.len) {
            const instruction = try std.debug.Dwarf.call_frame.Instruction.read(stream, addr_size_bytes, endian);
            prev_row = try self.step(allocator, cie, i == 0, instruction);
            if (pc < fde.pc_begin + self.current_row.offset) return prev_row;
        }
    }

    return self.current_row;
}