Get the FDE at a given offset, as well as its associated CIE. This offset typically comes from
lookupPc. The CFI instructions within can be evaluated with VirtualMachine.
pub fn getFde(unwind: *const Unwind, fde_offset: u64, endian: Endian) !struct
pub fn getFde(unwind: *const Unwind, fde_offset: u64, endian: Endian) !struct { *const CommonInformationEntry, FrameDescriptionEntry } {
const section = unwind.frame_section;
if (fde_offset > section.bytes.len) return error.EndOfStream;
var fde_reader: Reader = .fixed(section.bytes[@intCast(fde_offset)..]);
const fde_info = switch (try EntryHeader.read(&fde_reader, fde_offset, section.id, endian)) {
.fde => |info| info,
.cie, .terminator => return bad(), // This is meant to be an FDE
};
const cie = unwind.findCie(fde_info.cie_offset) orelse return error.InvalidDebugInfo;
const fde: FrameDescriptionEntry = try .parse(
section.vaddr + fde_offset + fde_reader.seek,
try fde_reader.take(cast(usize, fde_info.bytes_len) orelse return error.EndOfStream),
cie,
endian,
);
return .{ cie, fde };
}