mate_query.cpg.models.node.ast.mc module

Nodes in the LLVM middle-end’s AST.

At runtime, the models here are accessed via attributes on a CPG, not directly.

class mate_query.cpg.models.node.ast.mc.MachineBasicBlock(uuid: str, kind: NodeKind, attributes: Dict[str, Any] = {})

Bases: mate_query.cpg.models.node._typechecking.NodeMixin

Named after the eponymous LLVM class, these nodes represent the LLVM middle-end’s concept of a basic block.

Parameters
  • uuid (str) –

  • kind (NodeKind) –

  • attributes (Dict[str, Any]) –

address_taken

Whether or not this basic block is potentially a target of an indirect branch

Return type

bool

property asm_block: sqlalchemy.orm.relationships.RelationshipProperty

The corresponding ASMBlock.

can_fallthrough

Whether or not this basic block can implicitly transfer control flow by falling through to the next

Return type

bool

ends_in_return

Whether or not this basic block ends in a return

Return type

bool

property entry: sqlalchemy.orm.relationships.RelationshipProperty

The entry MachineInstr for this machine basic block.

has_inline_asm

Whether or not this block contains inlined assembly statements

Return type

bool

instrs

The array of middle-end instructions in this block

Return type

list

property instructions: sqlalchemy.orm.relationships.RelationshipProperty

A sequence of MachineInstr for each instruction in this machine basic block.

is_epilogue_insertion_block

Whether or not this basic block will contain generated epilogue code (e.g., for stack cleanup)

Return type

bool

is_prologue_insertion_block

Whether or not this basic block will contain generated prologue code (e.g., for stack setup)

Return type

bool

number

The numeric identifier for this basic block

Return type

int

preds

The array of predecessor blocks, identified by their symbols

Return type

list

pretty_string
Return type

str

succs

The array of successor blocks, identified by their symbols

Return type

list

symbol

The machine-addressable symbol for this basic block

Return type

str

property terminator: sqlalchemy.orm.relationships.RelationshipProperty

The exit MachineInstr for this machine basic block.

class mate_query.cpg.models.node.ast.mc.MachineFunction(uuid: str, kind: NodeKind, attributes: Dict[str, Any] = {})

Bases: mate_query.cpg.models.node._typechecking.NodeMixin

Named after the eponymous LLVM class, these nodes represent the LLVM middle-end’s concept of a function.

Parameters
  • uuid (str) –

  • kind (NodeKind) –

  • attributes (Dict[str, Any]) –

property arguments: sqlalchemy.orm.relationships.RelationshipProperty

The arguments of this function.

property blocks: sqlalchemy.orm.relationships.RelationshipProperty

The function’s MachineBasicBlock list.

demangled_name

The demangled function name, or the regular name if not mangled

Return type

str

property dwarf_type: sqlalchemy.orm.relationships.RelationshipProperty

The function’s mate_query.cpg.models.node.dwarf.DWARFType.

epilogues

Pairs of VA (Virtual Address) ranges where the function contains epilogue code (e.g., stack teardown)

Return type

list

frame

A MachineFrameInfo model of the function’s stack frame.

frame_info

Information about this function’s stack frame

Return type

dict

is_mangled

Whether or not this function’s name has been mangled

Return type

bool

property local_variables: sqlalchemy.orm.relationships.RelationshipProperty

The local variables in this function.

name

The corresponding LLVM IR function’s name

Return type

str

offset

The offset into the binary itself where this function is located.

Return type

int

operand

TODO(lb)

Return type

str

pretty_string

A pretty representation of the function

Return type

str

prologues

Pairs of VA (Virtual Address) ranges where the function contains prologue code (e.g., stack setup)

Return type

list

source

A list of source entries for this function

Return type

list

symbols

The function’s binary symbols

Return type

list

type_id

A compressed representation of the function’s DWARF type

Return type

str

va_end

The VA (Virtual Address) tells us the last VA where the function is located in the binary.

Return type

int

va_start

The VA (Virtual Address) tells us where this function is located in the binary.

Return type

int

property vtables: sqlalchemy.orm.relationships.RelationshipProperty

The function’s mate_query.cpg.models.node.ast.bin.VTable list.

class mate_query.cpg.models.node.ast.mc.MachineInstr(uuid: str, kind: NodeKind, attributes: Dict[str, Any] = {})

Bases: mate_query.cpg.models.node._typechecking.NodeMixin

Named after the eponymous LLVM class, these nodes represent the LLVM middle-end’s concept of an instruction.

Parameters
  • uuid (str) –

  • kind (NodeKind) –

  • attributes (Dict[str, Any]) –

flags
Return type

int

opcode
Return type

int

pretty_string
Return type

str