IDA SDK
Classes | Functions | Macros | Typedefs | Enumerations | Variables
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...
 
class  node_set_t
 Set of graph nodes. 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...
 
bool is_noret_block (fc_block_type_t btype)
 Does this block never return?
 
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_PREDS   0x0004
 compute predecessor lists
 
#define FC_APPND   0x0008
 multirange flowchart (set by append_to_flowchart)
 
#define FC_CHKBREAK   0x0010
 build_qflow_chart() may be aborted by user
 

Typedefs

typedef qvector< intvec_tarray_of_intvec_t
 
typedef qvector< intmap_tarray_of_intmap_t
 
typedef qvector< node_set_tarray_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...
 

Variables

int default_graph_format
 Format to generate when not specified in the flags. More...
 

Macro Definition Documentation

#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 &);
A flow chart for a function, or a set of address ranges.
Definition: gdl.hpp:323
uint32 ea_t
effective address
Definition: pro.h:385
#define ida_export
functions marked with this keyword are available as part of the IDA SDK
Definition: pro.h:240
fc_block_type_t
Flow chart block types.
Definition: gdl.hpp:32
Node iterator (used to draw graphs)
Definition: gdl.hpp:107

Enumeration Type Documentation

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

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().

Returns
error code from os, 0 if ok
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
filenameoutput file name. the file extension is not used. maybe NULL.
titlegraph title
pfnfunction to graph
ea1,ea2if pfn == NULL, then the address range
gflagscombination 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
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
filenameoutput file name. the file extension is not used. maybe NULL.
waitmessage to display during graph building
titlegraph title
gflagscombination 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
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
filenameoutput file name. the file extension is not used. maybe NULL.
waitmessage to display during graph building
titlegraph title
ea1,ea2address range
flagscombination 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_depthoptional limit of recursion
Returns
success. if fails, a warning message is displayed on the screen
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.

Variable Documentation

int default_graph_format

Format to generate when not specified in the flags.

(e.g. called from UI). the default is set in ida.cfg. 0 - GDL, 1 - DOT.