Struct p8n_types::Function

source ·
pub struct Function {
    pub name: Str,
    pub names: Names,
    pub strings: Strings,
    pub segments: Segments,
    /* private fields */
}
Expand description

A single function in the binary.

A function is a set of basic blocks, with one serving as an entry point. Basic blocks form a control flow graph.

Each function also has a user-changeable name and a unchangeable uuid.

Fields

name: Str

Canonical name of the function. Can be anything.

names: Names

Table mapping SSA variable names to integers.

strings: Strings

Table mapping strings to integers.

segments: Segments

Table mapping segments identifiers to integers.

Implementations

Creates a new function by disassembling from region starting at start.

Continues disassembling of region. The function looks for resolved, indirect control flow edges.

Function entry point.

Iterator over all mnemonics in basic block idx.

Iterator over all basic blocks in reverse post order.

The Functions control flow graph.

Returns a reference to the basic block idx.

Returns a reference to the mnemonic idx.

The functions uuid.

The functions region.

Iterator over all IL statements in rgn.

Lowest address occupied by a basic block. Not neccecarly the entry point.

First address of the functions entry basic block.

Iterator over all indirect, unresolved jumps.

Mutable reference to the control flow graph.

Calls func on each indirect jump and call instruction and rewrites it to jump/call the returned concrete addresses.

Iterates thru all statements in basic_block calling func one each. The function is allowed to modify the IL.

Inserts a new mnemonic at position pos inside basic_block with opcode and semantics described by stmts.

Removes mnemonic.

Removes the first mnemonic of basic_block. Fails of basic_block has no mnemonics.

Deletes all basic blocks for which f returns false.

Assembles a new function from a list of mnemonics and control flow edges. Used for deserializing functions.

Compresses the internal representation of the function. Call this if you’re running low on memory.

Uncompresses the function into a faster to process representation.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.