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_LIB_FROM`

  ignore references from library functions

`var CHART_IGNORE_LIB_TO`

  ignore references to library functions

`var CHART_NOLIBFUNCS`

  don't include library functions in the graph

`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_PRINT`

  print names (used only by display_flow_chart())

`var FC_RESERVED`

  former FC_PREDS

`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(fname: char const *)`

  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.

  @param fname: (C++: const char *) char const * @return: error code from os, 0 if ok

`def gen_complex_call_chart(filename: char const *, wait: char const *, title: char const *, ea1: ea_t, ea2: ea_t, flags: int, recursion_depth: int32 = -1)`

  gen_complex_call_chart(filename, wait, title, ea1, ea2, flags, recursion_depth=-1) -> bool Build and display a complex xref graph.

  @param filename: (C++: const char ) output file name. the file extension is not used. maybe nullptr. @param wait: (C++: const char ) message to display during graph building @param title: (C++: const char *) graph title @param ea1: (C++: ea_t) ,ea2: address range @param 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. @param 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. @param recursion_depth: (C++: int32) optional limit of recursion @return: success. if fails, a warning message is displayed on the screen

`def gen_flow_graph(filename: char const *, title: char const *, pfn: func_t *, ea1: ea_t, ea2: ea_t, gflags: int)`

  gen_flow_graph(filename, title, pfn, ea1, ea2, gflags) -> bool Build and display a flow graph.

  @param filename: (C++: const char ) output file name. the file extension is not used. maybe nullptr. @param title: (C++: const char ) graph title @param pfn: (C++: func_t *) function to graph @param ea1: (C++: ea_t) ,ea2: if pfn == nullptr, then the address range @param 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 @param 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(g: gdl_graph_t, fname: char const *)`

  gen_gdl(g, fname) Create GDL file for graph.

  @param g: (C++: const gdl_graph_t ) gdl_graph_t const * @param fname: (C++: const char ) char const *

`def gen_simple_call_chart(filename: char const *, wait: char const *, title: char const *, gflags: int)`

  gen_simple_call_chart(filename, wait, title, gflags) -> bool Build and display a simple function call graph.

  @param filename: (C++: const char ) output file name. the file extension is not used. maybe nullptr. @param wait: (C++: const char ) message to display during graph building @param title: (C++: const char *) graph title @param 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(btype: fc_block_type_t)`

  is_noret_block(btype) -> bool Does this block never return?

  @param btype: (C++: fc_block_type_t) enum fc_block_type_t

`def is_ret_block(btype: fc_block_type_t)`

  is_ret_block(btype) -> bool Does this block return?

  @param 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 @param f: A func_t type, use get_func(ea) to get a reference @param bounds: A tuple of the form (start, end). Used if "f" is None @param 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`

  Proxy of C++ cancellable_graph_t class.

  init(self) -> cancellable_graph_t

  @param self: PyObject *

  ### Ancestors

  - gdl_graph_t

  ### Subclasses

  - qflow_chart_t

  ### Instance variables

  `var cancelled : bool`

    cancelled

  ### Inherited members

  - `gdl_graph_t`:
    - `begin`
    - `edge`
    - `empty`
    - `end`
    - `entry`
    - `exists`
    - `exit`
    - `front`
    - `get_edge_color`
    - `get_node_color`
    - `get_node_label`
    - `nedge`
    - `node_qty`
    - `npred`
    - `nsucc`
    - `pred`
    - `print_edge`
    - `print_graph_attributes`
    - `print_node`
    - `print_node_attributes`
    - `size`
    - `succ`
    - `thisown`
`class edge_t (x: int = 0, y: int = 0)`

  Proxy of C++ edge_t class.

  init(self, x=0, y=0) -> edge_t

  @param x: int @param y: int

  ### Instance variables

  `var dst : int`

    destination node number

  `var src : int`

    source node number

  `var thisown`

    The membership flag

`class edgevec_t`

  Proxy of C++ edgevec_t class.

  init(self) -> edgevec_t

  ### Instance variables

  `var thisown`

    The membership flag

`class gdl_graph_t`

  Proxy of C++ gdl_graph_t class.

  init(self) -> gdl_graph_t

  @param self: PyObject *

  ### Subclasses

  - cancellable_graph_t
  - drawable_graph_t
  - simple_graph_t

  ### Instance variables

  `var thisown`

    The membership flag

  ### Methods

  `def begin(self) ‑> node_iterator`

    begin(self) -> node_iterator

  `def edge(self, node: int, i: int, ispred: bool) ‑> int`

    edge(self, node, i, ispred) -> int

    @param node: int @param i: int @param ispred: bool

  `def empty(self) ‑> bool`

    empty(self) -> bool

  `def end(self) ‑> node_iterator`

    end(self) -> node_iterator

  `def entry(self) ‑> int`

    entry(self) -> int

  `def exists(self, node: int) ‑> bool`

    exists(self, node) -> bool

    @param node: int

  `def exit(self) ‑> int`

    exit(self) -> int

  `def front(self) ‑> int`

    front(self) -> int

  `def get_edge_color(self, i: int, j: int)`

    get_edge_color(self, i, j) -> bgcolor_t

    @param i: int @param j: int

  `def get_node_color(self, n: int)`

    get_node_color(self, n) -> bgcolor_t

    @param n: int

  `def get_node_label(self, n: int)`

    get_node_label(self, n) -> char *

    @param n: int

  `def nedge(self, node: int, ispred: bool)`

    nedge(self, node, ispred) -> size_t

    @param node: int @param ispred: bool

  `def node_qty(self) ‑> int`

    node_qty(self) -> int

  `def npred(self, node: int) ‑> int`

    npred(self, node) -> int

    @param node: int

  `def nsucc(self, node: int) ‑> int`

    nsucc(self, node) -> int

    @param node: int

  `def pred(self, node: int, i: int) ‑> int`

    pred(self, node, i) -> int

    @param node: int @param i: int

  `def print_edge(self, fp: FILE *, i: int, j: int)`

    print_edge(self, fp, i, j) -> bool

    @param fp: FILE * @param i: int @param j: int

  `def print_graph_attributes(self, fp: FILE *)`

    print_graph_attributes(self, fp)

    @param fp: FILE *

  `def print_node(self, fp: FILE *, n: int)`

    print_node(self, fp, n) -> bool

    @param fp: FILE * @param n: int

  `def print_node_attributes(self, fp: FILE *, n: int)`

    print_node_attributes(self, fp, n)

    @param fp: FILE * @param n: int

  `def size(self) ‑> int`

    size(self) -> int

  `def succ(self, node: int, i: int) ‑> int`

    succ(self, node, i) -> int

    @param node: int @param i: int

`class node_iterator (_g: gdl_graph_t, n: int)`

  Proxy of C++ node_iterator class.

  init(self, _g, n) -> node_iterator

  @param _g: gdl_graph_t const * @param n: int

  ### Instance variables

  `var thisown`

    The membership flag

`class node_ordering_t`

  Proxy of C++ node_ordering_t class.

  init(self) -> node_ordering_t

  ### Instance variables

  `var thisown`

    The membership flag

  ### Methods

  `def clear(self)`

    clear(self)

  `def clr(self, _node: int) ‑> bool`

    clr(self, _node) -> bool

    @param _node: int

  `def node(self, _order: size_t)`

    node(self, _order) -> int

    @param _order: size_t

  `def order(self, _node: int) ‑> int`

    order(self, _node) -> int

    @param _node: int

  `def resize(self, n: int)`

    resize(self, n)

    @param n: int

  `def set(self, _node: int, num: int)`

    set(self, _node, num)

    @param _node: int @param num: int

  `def size(self)`

    size(self) -> size_t

`class qbasic_block_t`

  Proxy of C++ qbasic_block_t class.

  init(self) -> qbasic_block_t

  ### Ancestors

  - range_t

  ### Inherited members

  - `range_t`:
    - `clear`
    - `compare`
    - `contains`
    - `empty`
    - `end_ea`
    - `extend`
    - `intersect`
    - `overlaps`
    - `size`
    - `start_ea`
    - `thisown`
`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

  @param _title: char const * @param _pfn: func_t * @param _ea1: ea_t @param _ea2: ea_t @param _flags: int

  ### Ancestors

  - cancellable_graph_t
  - gdl_graph_t

  ### Instance variables

  `var bounds : range_t`

    overall bounds of the qflow_chart_t instance

  `var flags : int`

    flags. See Flow chart flags

  `var nproper : int`

    number of basic blocks belonging to the specified range

  `var pfn : func_t *`

    the function this instance was built upon

  `var title : qstring`

    title

  ### Methods

  `def append_to_flowchart(self, ea1: ea_t, ea2: ea_t)`

    append_to_flowchart(self, ea1, ea2)

    @param ea1: ea_t @param ea2: ea_t

  `def calc_block_type(self, blknum: size_t)`

    calc_block_type(self, blknum) -> fc_block_type_t

    @param blknum: size_t

  `def create(self, *args)`

    create(self, _title, _pfn, _ea1, _ea2, _flags)

    @param _title: char const * @param _pfn: func_t * @param _ea1: ea_t @param _ea2: ea_t @param _flags: int

    create(self, _title, ranges, _flags)

    @param _title: char const * @param ranges: rangevec_t const & @param _flags: int

  `def is_noret_block(self, blknum: size_t)`

    is_noret_block(self, blknum) -> bool

    @param blknum: size_t

  `def is_ret_block(self, blknum: size_t)`

    is_ret_block(self, blknum) -> bool

    @param blknum: size_t

  `def print_names(self) ‑> bool`

    print_names(self) -> bool

  `def refresh(self)`

    refresh(self)

  ### Inherited members

  - `cancellable_graph_t`:
    - `begin`
    - `cancelled`
    - `edge`
    - `empty`
    - `end`
    - `entry`
    - `exists`
    - `exit`
    - `front`
    - `get_edge_color`
    - `get_node_color`
    - `get_node_label`
    - `nedge`
    - `node_qty`
    - `npred`
    - `nsucc`
    - `pred`
    - `print_edge`
    - `print_graph_attributes`
    - `print_node`
    - `print_node_attributes`
    - `size`
    - `succ`
    - `thisown`