Module index

Module ida_gdl

Low level graph drawing operations.

Global variables

var CHART_FOLLOW_DIRECTION
analyze references to added blocks only in the direction of the reference who discovered the current block
var CHART_GEN_DOT
generate .dot file (file extension is forced to .dot)
var CHART_GEN_GDL
generate .gdl file (file extension is forced to .gdl)
var CHART_IGNORE_DATA_BSS
CHART_IGNORE_DATA_BSS = 32
var CHART_IGNORE_LIB_FROM
ignore references from library functions
var CHART_IGNORE_LIB_TO
ignore references to library functions
var CHART_IGNORE_XTRN
CHART_IGNORE_XTRN = 16
var CHART_NOLIBFUNCS
don't include library functions in the graph
var CHART_PRINT_COMMENTS
CHART_PRINT_COMMENTS = 256
var CHART_PRINT_DOTS
print dots if xrefs exist outside of the range recursion depth
var CHART_PRINT_NAMES
print labels for each block?
var CHART_RECURSIVE
analyze added blocks
var CHART_REFERENCED
references from the addresses in the list
var CHART_REFERENCING
references to the addresses in the list
var CHART_WINGRAPH
call grapher to display the graph
var FC_APPND
multirange flowchart (set by append_to_flowchart)
var FC_CALL_ENDS
call instructions terminate basic blocks
var FC_CHKBREAK
build_qflow_chart() may be aborted by user
var FC_NOEXT
do not compute external blocks. Use this to prevent jumps leaving the function from appearing in the flow chart. Unless specified, the targets of those outgoing jumps will be present in the flow chart under the form of one- instruction blocks
var FC_NOPREDS
do not compute predecessor lists
var FC_OUTLINES
include outlined code (with FUNC_OUTLINE)
var FC_PREDS
FC_PREDS = 0
var FC_PRINT
print names (used only by display_flow_chart())
var FC_RESERVED
FC_RESERVED = 4
var fcb_cndret
conditional return block
var fcb_enoret
external noreturn block (does not belong to the function)
var fcb_error
block passes execution past the function end
var fcb_extern
external normal block
var fcb_indjump
block ends with indirect jump
var fcb_noret
noreturn block
var fcb_normal
normal block
var fcb_ret
return block

Functions

def display_gdl(*args) ‑> int
display_gdl(fname) -> int
Display GDL file by calling wingraph32. The exact name of the grapher is taken from the configuration file and set up by setup_graph_subsystem(). The path should point to a temporary file: when wingraph32 succeeds showing the graph, the input file will be deleted.
fname: (C++: const char *) char const *
return: error code from os, 0 if ok
def gen_complex_call_chart(*args) ‑> bool
gen_complex_call_chart(filename, wait, title, ea1, ea2, flags, recursion_depth=-1) -> bool
Build and display a complex xref graph.
filename: (C++: const char *) output file name. the file extension is not used. maybe
nullptr.
wait: (C++: const char *) message to display during graph building
title: (C++: const char *) graph title
ea1: (C++: ea_t) ,ea2: address range
flags: (C++: int) combination of Call chart building flags and Flow graph building
flags. if none of CHART_GEN_DOT, CHART_GEN_GDL, CHART_WINGRAPH is specified, the function will return false.
flags: (C++: int) combination of Call chart building flags and Flow graph building
flags. if none of CHART_GEN_DOT, CHART_GEN_GDL, CHART_WINGRAPH is specified, the function will return false.
recursion_depth: (C++: int32) optional limit of recursion
return: success. if fails, a warning message is displayed on the screen
def gen_flow_graph(*args) ‑> bool
gen_flow_graph(filename, title, pfn, ea1, ea2, gflags) -> bool
Build and display a flow graph.
filename: (C++: const char *) output file name. the file extension is not used. maybe
nullptr.
title: (C++: const char *) graph title
pfn: (C++: func_t *) function to graph
ea1: (C++: ea_t) ,ea2: if pfn == nullptr, then the address range
gflags: (C++: int) combination of Flow graph building flags. if none of
CHART_GEN_DOT, CHART_GEN_GDL, CHART_WINGRAPH is specified, the function will return false
gflags: (C++: int) combination of Flow graph building flags. if none of
CHART_GEN_DOT, CHART_GEN_GDL, CHART_WINGRAPH is specified, the function will return false
return: success. if fails, a warning message is displayed on the screen
def gen_gdl(*args) ‑> void
gen_gdl(g, fname)
Create GDL file for graph.
g: (C++: const gdl_graph_t *) gdl_graph_t const *
fname: (C++: const char *) char const *
def gen_simple_call_chart(*args) ‑> bool
gen_simple_call_chart(filename, wait, title, gflags) -> bool
Build and display a simple function call graph.
filename: (C++: const char *) output file name. the file extension is not used. maybe
nullptr.
wait: (C++: const char *) message to display during graph building
title: (C++: const char *) graph title
gflags: (C++: int) combination of CHART_NOLIBFUNCS and Flow graph building flags. if
none of CHART_GEN_DOT, CHART_GEN_GDL, CHART_WINGRAPH is specified, the function will return false.
return: success. if fails, a warning message is displayed on the screen
def is_noret_block(*args) ‑> bool
is_noret_block(btype) -> bool
Does this block never return?
btype: (C++: fc_block_type_t) enum fc_block_type_t
def is_ret_block(*args) ‑> bool
is_ret_block(btype) -> bool
Does this block return?
btype: (C++: fc_block_type_t) enum fc_block_type_t

Classes

class BasicBlock (id, bb, fc)
Basic block class. It is returned by the Flowchart class

Instance variables

var end_ea
end_ea of basic block
var id
Basic block ID
var start_ea
start_ea of basic block
var type
Block type (check fc_block_type_t enum)

Methods

def preds(self)
Iterates the predecessors list
def succs(self)
Iterates the successors list
class FlowChart (f=None, bounds=None, flags=0)
Flowchart class used to determine basic blocks. Check ex_gdl_qflow_chart.py for sample usage.
Constructor
f: A func_t type, use get_func(ea) to get a reference
bounds: A tuple of the form (start, end). Used if "f" is None
flags: one of the FC_xxxx flags.

Instance variables

var size
Number of blocks in the flow chart

Methods

def refresh(self)
Refreshes the flow chart
class cancellable_graph_t (*args)
Proxy of C++ cancellable_graph_t class.
__init__(self) -> cancellable_graph_t
self: PyObject *

Ancestors

Subclasses

Instance variables

var cancelled
cancelled

Inherited members

class gdl_graph_t (*args)
Proxy of C++ gdl_graph_t class.
__init__(self) -> gdl_graph_t
self: PyObject *

Subclasses

Methods

def begin(self, *args) ‑> node_iterator
begin(self) -> node_iterator
def edge(self, *args) ‑> int
edge(self, node, i, ispred) -> int
node: int
i: int
ispred: bool
def empty(self, *args) ‑> bool
empty(self) -> bool
def end(self, *args) ‑> node_iterator
end(self) -> node_iterator
def entry(self, *args) ‑> int
entry(self) -> int
def exists(self, *args) ‑> bool
exists(self, node) -> bool
node: int
def exit(self, *args) ‑> int
exit(self) -> int
def front(self, *args) ‑> int
front(self) -> int
def get_edge_color(self, *args) ‑> bgcolor_t
get_edge_color(self, i, j) -> bgcolor_t
i: int
j: int
def get_node_color(self, *args) ‑> bgcolor_t
get_node_color(self, n) -> bgcolor_t
n: int
def get_node_label(self, *args) ‑> char *
get_node_label(self, n) -> char *
n: int
def nedge(self, *args) ‑> size_t
nedge(self, node, ispred) -> size_t
node: int
ispred: bool
def node_qty(self, *args) ‑> int
node_qty(self) -> int
def npred(self, *args) ‑> int
npred(self, node) -> int
node: int
def nsucc(self, *args) ‑> int
nsucc(self, node) -> int
node: int
def pred(self, *args) ‑> int
pred(self, node, i) -> int
node: int
i: int
def print_edge(self, *args) ‑> bool
print_edge(self, fp, i, j) -> bool
fp: FILE *
i: int
j: int
def print_graph_attributes(self, *args) ‑> void
print_graph_attributes(self, fp)
fp: FILE *
def print_node(self, *args) ‑> bool
print_node(self, fp, n) -> bool
fp: FILE *
n: int
def print_node_attributes(self, *args) ‑> void
print_node_attributes(self, fp, n)
fp: FILE *
n: int
def size(self, *args) ‑> int
size(self) -> int
def succ(self, *args) ‑> int
succ(self, node, i) -> int
node: int
i: int
class node_iterator (*args)
Proxy of C++ node_iterator class.
__init__(self, _g, n) -> node_iterator
_g: gdl_graph_t const *
n: int
class qbasic_block_t (*args)
Proxy of C++ qbasic_block_t class.
__init__(self) -> qbasic_block_t

Ancestors

Inherited members

class qflow_chart_t (*args)
Proxy of C++ qflow_chart_t class.
__init__(self) -> qflow_chart_t
__init__(self, _title, _pfn, _ea1, _ea2, _flags) -> qflow_chart_t
_title: char const *
_pfn: func_t *
_ea1: ea_t
_ea2: ea_t
_flags: int

Ancestors

Instance variables

var bounds
overall bounds of the qflow_chart_t instance
var flags
flags. See Flow chart flags
var nproper
number of basic blocks belonging to the specified range
var pfn
the function this instance was built upon
var title
title

Methods

def append_to_flowchart(self, *args) ‑> void
append_to_flowchart(self, ea1, ea2)
ea1: ea_t
ea2: ea_t
def calc_block_type(self, *args) ‑> fc_block_type_t
calc_block_type(self, blknum) -> fc_block_type_t
blknum: size_t
def create(self, *args) ‑> void
create(self, _title, _pfn, _ea1, _ea2, _flags)
_title: char const *
_pfn: func_t *
_ea1: ea_t
_ea2: ea_t
_flags: int
create(self, _title, ranges, _flags)
_title: char const *
ranges: rangevec_t const &
_flags: int
def is_noret_block(self, *args) ‑> bool
is_noret_block(self, blknum) -> bool
blknum: size_t
def is_ret_block(self, *args) ‑> bool
is_ret_block(self, blknum) -> bool
blknum: size_t
def print_names(self, *args) ‑> bool
print_names(self) -> bool
def refresh(self, *args) ‑> void
refresh(self)

Inherited members