| IDA SDK

Classes | Functions | Macros | Typedefs | Enumerations
gdl.hpp File Reference

## Detailed Description

Low level graph drawing operations.

## Classes
class | intset_t
| Set of integer constants. More...
class | intmap_t
| Map of integer constants to integer constants. More...
struct | edge_t
| Edge connecting two graph nodes. More...
struct | edgevec_t
class | node_set_t
| Set of graph nodes. More...
class | node_ordering_t
| Node ordering in a graph. More...
class | node_iterator
| Node iterator (used to draw graphs) More...
class | gdl_graph_t
| gdl graph interface - includes only functions required to draw it More...
class | cancellable_graph_t
struct | qbasic_block_t
| Information about a basic block of a qflow_chart_t. More...
class | qflow_chart_t
| A flow chart for a function, or a set of address ranges. More...

## Functions
idaman void ida_export | gen_gdl (const gdl_graph_t *g, const char *fname)
| Create GDL file for graph.
idaman int ida_export | display_gdl (const char *fname)
| Display GDL file by calling wingraph32. More...
idaman bool ida_export | gen_flow_graph (const char *filename, const char *title, func_t *pfn, ea_t ea1, ea_t ea2, int gflags)
| Build and display a flow graph. More...
idaman bool ida_export | gen_simple_call_chart (const char *filename, const char *wait, const char *title, int gflags)
| Build and display a simple function call graph. More...
idaman bool ida_export | gen_complex_call_chart (const char *filename, const char *wait, const char *title, ea_t ea1, ea_t ea2, int flags, int32 recursion_depth=-1)
| Build and display a complex xref graph. More...
idaman void ida_export | setup_graph_subsystem (const char *_grapher, bgcolor_t(idaapi *get_graph_color)(int color))
| Setup the user-defined graph colors and graph viewer program. More...
THREAD_SAFE bool | is_noret_block (fc_block_type_t btype)
| Does this block never return?
THREAD_SAFE bool | is_ret_block (fc_block_type_t btype)
| Does this block return?

## Macros
#define | DECLARE_HELPER(decl)
#define | CHART_PRINT_NAMES 0x1000
| print labels for each block?
#define | CHART_GEN_DOT 0x2000
| generate .dot file (file extension is forced to .dot)
#define | CHART_GEN_GDL 0x4000
| generate .gdl file (file extension is forced to .gdl)
#define | CHART_WINGRAPH 0x8000
| call grapher to display the graph
#define | CHART_NOLIBFUNCS 0x0400
| don't include library functions in the graph
#define | CHART_REFERENCING 0x0001
| references to the addresses in the list
#define | CHART_REFERENCED 0x0002
| references from the addresses in the list
#define | CHART_RECURSIVE 0x0004
| analyze added blocks
#define | CHART_FOLLOW_DIRECTION 0x0008
| analyze references to added blocks only in the direction of the reference who discovered the current block
#define | CHART_IGNORE_XTRN 0x0010
#define | CHART_IGNORE_DATA_BSS 0x0020
#define | CHART_IGNORE_LIB_TO 0x0040
| ignore references to library functions
#define | CHART_IGNORE_LIB_FROM 0x0080
| ignore references from library functions
#define | CHART_PRINT_COMMENTS 0x0100
#define | CHART_PRINT_DOTS 0x0200
| print dots if xrefs exist outside of the range recursion depth
#define | FC_PRINT 0x0001
| print names (used only by display_flow_chart())
#define | FC_NOEXT 0x0002
| do not compute external blocks. More...
#define | FC_RESERVED 0x0004
| former FC_PREDS
#define | FC_APPND 0x0008
| multirange flowchart (set by append_to_flowchart)
#define | FC_CHKBREAK 0x0010
| build_qflow_chart() may be aborted by user
#define | FC_CALL_ENDS 0x0020
| call instructions terminate basic blocks
#define | FC_NOPREDS 0x0040
| do not compute predecessor lists
#define | FC_OUTLINES 0x0080
| include outlined code (with FUNC_OUTLINE)

## Typedefs
typedef qvector< intvec_t > | array_of_intvec_t
typedef qvector< intmap_t > | array_of_intmap_t
typedef qvector< node_set_t > | array_of_node_set_t

## Enumerations
enum | fc_block_type_t { fcb_normal , fcb_indjump , fcb_ret , fcb_cndret , fcb_noret , fcb_enoret , fcb_extern , fcb_error }
| Flow chart block types. More...
enum | edge_type_t { EDGE_NONE = 0 , EDGE_TREE = 1 , EDGE_FORWARD = 2 , EDGE_BACK = 3 , EDGE_CROSS = 4 , EDGE_SUBGRAPH = 5 }

## Macro Definition Documentation

## ◆ DECLARE_HELPER

#define DECLARE_HELPER | ( |  | decl | ) |

Value:
decl node_iterator *ida_export node_iterator_goup(node_iterator *); \
decl void ida_export create_qflow_chart(qflow_chart_t &); \
decl bool ida_export append_to_flowchart(qflow_chart_t &, ea_t, ea_t); \
decl fc_block_type_t ida_export fc_calc_block_type(const qflow_chart_t &, size_t); \
decl bool ida_export create_multirange_qflow_chart(qflow_chart_t &, const rangevec_t &);
node_iterator
Node iterator (used to draw graphs)
Definition: gdl.hpp:230
qflow_chart_t
A flow chart for a function, or a set of address ranges.
Definition: gdl.hpp:443
fc_block_type_t
fc_block_type_t
Flow chart block types.
Definition: gdl.hpp:30
rangevec_t
Vector of range_t instances.
Definition: range.hpp:93

## Enumeration Type Documentation

## ◆ fc_block_type_t

enum fc_block_type_t

Flow chart block types.

Enumerator
fcb_normal | normal block
fcb_indjump | block ends with indirect jump
fcb_ret | return block
fcb_cndret | conditional return block
fcb_noret | noreturn block
fcb_enoret | external noreturn block (does not belong to the function)
fcb_extern | external normal block
fcb_error | block passes execution past the function end

## Function Documentation

## ◆ display_gdl()

idaman int ida_export display_gdl | ( | const char * | fname | ) |

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.

Returns
  error code from os, 0 if ok

## ◆ gen_flow_graph()

idaman bool ida_export gen_flow_graph | ( | const char * | filename,
|  | const char * | title,
|  | func_t * | pfn,
|  | ea_t | ea1,
|  | ea_t | ea2,
|  | int | gflags
| ) |  |

Build and display a flow graph.

Parameters

  filename | output file name. the file extension is not used. maybe nullptr.
  title | graph title
  pfn | function to graph
  ea1,ea2 | if pfn == nullptr, then the address range
  gflags | combination of Flow graph building flags. if none of CHART_GEN_DOT, CHART_GEN_GDL, CHART_WINGRAPH is specified, the function will return false

Returns
  success. if fails, a warning message is displayed on the screen

## ◆ gen_simple_call_chart()

idaman bool ida_export gen_simple_call_chart | ( | const char * | filename,
|  | const char * | wait,
|  | const char * | title,
|  | int | gflags
| ) |  |

Build and display a simple function call graph.

Parameters

  filename | output file name. the file extension is not used. maybe nullptr.
  wait | message to display during graph building
  title | graph title
  gflags | 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.

Returns
  success. if fails, a warning message is displayed on the screen

## ◆ gen_complex_call_chart()

idaman bool ida_export gen_complex_call_chart | ( | const char * | filename,
|  | const char * | wait,
|  | const char * | title,
|  | ea_t | ea1,
|  | ea_t | ea2,
|  | int | flags,
|  | int32 | recursion_depth = `-1`
| ) |  |

Build and display a complex xref graph.

Parameters

  filename | output file name. the file extension is not used. maybe nullptr.
  wait | message to display during graph building
  title | graph title
  ea1,ea2 | address range
  flags | 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 | optional limit of recursion

Returns
  success. if fails, a warning message is displayed on the screen

## ◆ setup_graph_subsystem()

idaman void ida_export setup_graph_subsystem | ( | const char * | _grapher,
|  | bgcolor_t(idaapi *)(int color) | get_graph_color
| ) |  |

Setup the user-defined graph colors and graph viewer program.

This function is called by the GUI at the beginning, so no need to call it again.