DoxigAlpha

parseAndDump

Function parameters

Parameters

#
step:*Step
bytes:[]const u8

Functions in this namespace

Functions

#
checkExact
Adds an exact match phrase to the latest created Check.
checkExactPath
Like `checkExact()` but takes an additional argument `LazyPath` which will be
checkContains
Adds a fuzzy match phrase to the latest created Check.
checkContainsPath
Like `checkContains()` but takes an additional argument `lazy_path` which will be
checkExtract
Adds an exact match phrase with variable extractor to the latest created Check.
checkExtractLazyPath
Like `checkExtract()` but takes an additional argument `LazyPath` which will be
checkNotPresent
Adds another searched phrase to the latest created Check
checkNotPresentLazyPath
Like `checkExtract()` but takes an additional argument `LazyPath` which will be
checkInHeaders
Creates a new check checking in the file headers (section, program headers, etc.).
checkInSymtab
Creates a new check checking specifically symbol table parsed and dumped from the object
checkInDyldRebase
Creates a new check checking specifically dyld rebase opcodes contents parsed and dumped
checkInDyldBind
Creates a new check checking specifically dyld bind opcodes contents parsed and dumped
checkInDyldWeakBind
Creates a new check checking specifically dyld weak bind opcodes contents parsed and dumped
checkInDyldLazyBind
Creates a new check checking specifically dyld lazy bind opcodes contents parsed and dumped
checkInExports
Creates a new check checking specifically exports info contents parsed and dumped
checkInIndirectSymtab
Creates a new check checking specifically indirect symbol table parsed and dumped
checkInDynamicSymtab
Creates a new check checking specifically dynamic symbol table parsed and dumped from the object
checkInDynamicSection
Creates a new check checking specifically dynamic section parsed and dumped from the object
checkInArchiveSymtab
Creates a new check checking specifically symbol table parsed and dumped from the archive
checkComputeCompare
Creates a new standalone, singular check which allows running simple binary operations

= .check_object

Values

#
base_id
= .check_object

Source

Implementation

#
fn parseAndDump(step: *Step, check: Check, bytes: []const u8) ![]const u8 {
    const gpa = step.owner.allocator;
    var fbs = std.io.fixedBufferStream(bytes);
    const reader = fbs.reader();

    const buf = try reader.readBytesNoEof(8);
    if (!mem.eql(u8, buf[0..4], &std.wasm.magic)) {
        return error.InvalidMagicByte;
    }
    if (!mem.eql(u8, buf[4..], &std.wasm.version)) {
        return error.UnsupportedWasmVersion;
    }

    var output = std.array_list.Managed(u8).init(gpa);
    defer output.deinit();
    parseAndDumpInner(step, check, bytes, &fbs, &output) catch |err| switch (err) {
        error.EndOfStream => try output.appendSlice("\n<UnexpectedEndOfStream>"),
        else => |e| return e,
    };
    return output.toOwnedSlice();
}