ida_graph

Graph view management.

Attributes

SWIG_PYTHON_LEGACY_BOOL

NIF_BG_COLOR

node_info_t::bg_color

NIF_FRAME_COLOR

node_info_t::frame_color

NIF_EA

node_info_t::ea

NIF_TEXT

node_info_t::text

NIF_FLAGS

node_info_t::flags

NIF_ALL

GLICTL_CENTER

the gli should be set/get as center

NIFF_SHOW_CONTENTS

cvar

layout_none

layout_digraph

layout_tree

layout_circle

layout_polar_tree

layout_orthogonal

layout_radial_tree

git_none

nothing

git_edge

edge (graph_item_t::e, graph_item_t::n. n is farthest edge endpoint)

git_node

node title (graph_item_t::n)

git_tool

node title button (graph_item_t::n, graph_item_t::b)

git_text

node text (graph_item_t::n, graph_item_t::p)

git_elp

edge layout point (graph_item_t::elp)

ygap

xgap

arrow_height

arrow_width

MTG_GROUP_NODE

is group node?

MTG_DOT_NODE

is dot node?

MTG_NON_DISPLAYABLE_NODE

for disassembly graphs - non-displayable nodes have a visible area that is too large to generate disassembly lines for without IDA slowing down significantly (see MAX_VISIBLE_NODE_AREA)

COLLAPSED_NODE

grcode_calculating_layout

calculating user-defined graph layout.

grcode_layout_calculated

graph layout calculated.

grcode_changed_graph

new graph has been set.

grcode_reserved

grcode_clicked

graph is being clicked. this callback allows you to ignore some clicks. it occurs too early, internal graph variables are not updated yet. current_item1, current_item2 point to the same thing. item2 has more information. see also: custom_viewer_click_t

grcode_dblclicked

a graph node has been double clicked.

grcode_creating_group

a group is being created. this provides an opportunity for the graph to forbid creation of the group. Note that groups management is done by the interactive_graph_t instance itself: there is no need to modify the graph in this callback.

grcode_deleting_group

a group is being deleted. this provides an opportunity for the graph to forbid deletion of the group. Note that groups management is done by the interactive_graph_t instance itself: there is no need to modify the graph in this callback.

grcode_group_visibility

a group is being collapsed/uncollapsed this provides an opportunity for the graph to forbid changing the visibility of the group. Note that groups management is done by the interactive_graph_t instance itself: there is no need to modify the graph in this callback.

grcode_gotfocus

a graph viewer got focus.

grcode_lostfocus

a graph viewer lost focus.

grcode_user_refresh

refresh user-defined graph nodes and edges This is called when the UI considers that it is necessary to recreate the graph layout, and thus has to ensure that the 'interactive_graph_t' instance it is using, is up-to-date. For example:

grcode_reserved2

grcode_user_text

retrieve text for user-defined graph node. NB: do not use anything calling GDI!

grcode_user_size

calculate node size for user-defined graph.

grcode_user_title

render node title of a user-defined graph.

grcode_user_draw

render node of a user-defined graph. NB: draw only on the specified DC and nowhere else!

grcode_user_hint

retrieve hint for the user-defined graph.

grcode_destroyed

graph is being destroyed. Note that this doesn't mean the graph viewer is being destroyed; this only means that the graph that is being displayed by it is being destroyed, and that, e.g., any possibly cached data should be invalidated (this event can happen when, for example, the user decides to group nodes together: that operation will effectively create a new graph, that will replace the old one.) To be notified when the graph viewer itself is being destroyed, please see notification 'view_close', in kernwin.hpp

grcode_create_graph_viewer

use create_graph_viewer()

grcode_get_graph_viewer

use get_graph_viewer()

grcode_get_viewer_graph

use get_viewer_graph()

grcode_create_interactive_graph

use create_interactive_graph()

grcode_set_viewer_graph

use set_viewer_graph()

grcode_refresh_viewer

use refresh_viewer()

grcode_fit_window

use viewer_fit_window()

grcode_get_curnode

use viewer_get_curnode()

grcode_center_on

use viewer_center_on()

grcode_get_selection

use viewer_get_selection()

grcode_del_custom_layout

use interactive_graph_t::del_custom_layout()

grcode_set_custom_layout

use interactive_graph_t::set_custom_layout()

grcode_set_graph_groups

use interactive_graph_t::set_graph_groups()

grcode_clear

use interactive_graph_t::clear()

grcode_create_digraph_layout

use interactive_graph_t::create_digraph_layout()

grcode_create_tree_layout

use drawable_graph_t::create_tree_layout()

grcode_create_circle_layout

use drawable_graph_t::create_circle_layout()

grcode_get_node_representative

use interactive_graph_t::get_node_representative()

grcode_find_subgraph_node

use interactive_graph_t::_find_subgraph_node()

grcode_create_group

use interactive_graph_t::create_group()

grcode_get_custom_layout

use interactive_graph_t::get_custom_layout()

grcode_get_graph_groups

use interactive_graph_t::get_graph_groups()

grcode_empty

use interactive_graph_t::empty()

grcode_is_visible_node

use interactive_graph_t::is_visible_node()

grcode_delete_group

use interactive_graph_t::delete_group()

grcode_change_group_visibility

use interactive_graph_t::change_group_visibility()

grcode_set_edge

use interactive_graph_t::set_edge()

grcode_node_qty

use interactive_graph_t::node_qty()

grcode_nrect

use interactive_graph_t::nrect()

grcode_set_titlebar_height

use viewer_set_titlebar_height()

grcode_create_user_graph_place

use create_user_graph_place()

grcode_create_disasm_graph1

use create_disasm_graph(ea_t ea)

grcode_create_disasm_graph2

use create_disasm_graph(const rangevec_t &ranges)

grcode_set_node_info

use viewer_set_node_info()

grcode_get_node_info

use viewer_get_node_info()

grcode_del_node_info

use viewer_del_node_info()

grcode_viewer_create_groups

grcode_viewer_delete_groups

grcode_viewer_groups_visibility

grcode_viewer_create_groups_vec

use viewer_create_groups()

grcode_viewer_delete_groups_vec

use viewer_delete_groups()

grcode_viewer_groups_visibility_vec

use viewer_set_groups_visibility()

grcode_delete_interactive_graph

use delete_interactive_graph()

grcode_edge_infos_wrapper_copy

use edge_infos_wrapper_t::operator=()

grcode_edge_infos_wrapper_clear

use edge_infos_wrapper_t::clear()

grcode_attach_menu_item

grcode_set_gli

use viewer_set_gli()

grcode_get_gli

use viewer_get_gli()

edge_t

node_ordering_t

abstract_graph_t

mutable_graph_t

create_mutable_graph

delete_mutable_graph

grcode_create_mutable_graph

grcode_create_mutable_graph

Classes

screen_graph_selection_base_t

node_layout_t

pointvec_t

node_info_t

graph_node_visitor_t

graph_path_visitor_t

point_t

pointseq_t

rect_t

TPointDouble

edge_info_t

edge_layout_point_t

selection_item_t

screen_graph_selection_t

edge_segment_t

graph_item_t

interval_t

row_info_t

drawable_graph_t

edge_infos_wrapper_t

interactive_graph_t

graph_visitor_t

group_crinfo_t

user_graph_place_t

GraphViewer

Functions

get_node_info(→ bool)

Get node info.

set_node_info(→ None)

Set node info.

del_node_info(→ None)

Delete the node_info_t for the given node.

clr_node_info(→ None)

Clear node info for the given node.

calc_dist(→ double)

Calculate distance between p and q.

create_graph_viewer(→ graph_viewer_t *)

Create a custom graph viewer.

get_graph_viewer(→ graph_viewer_t *)

Get custom graph viewer for given form.

create_interactive_graph(→ interactive_graph_t *)

Create a new empty graph with given id.

create_disasm_graph(→ interactive_graph_t *)

This function has the following signatures:

get_viewer_graph(→ interactive_graph_t *)

Get graph object for given custom graph viewer.

set_viewer_graph(→ None)

Set the underlying graph object for the given viewer.

refresh_viewer(→ None)

Redraw the graph in the given view.

viewer_fit_window(→ None)

Fit graph viewer to its parent form.

viewer_get_curnode(→ int)

Get number of currently selected node (-1 if none)

viewer_center_on(→ None)

Center the graph view on the given node.

viewer_set_gli(→ None)

Set location info for given graph view If flags contains GLICTL_CENTER, then the gli will be set to be the center of the view. Otherwise it will be the top-left.

viewer_get_gli(→ bool)

Get location info for given graph view If flags contains GLICTL_CENTER, then the gli that will be retrieved, will be the one at the center of the view. Otherwise it will be the top-left.

viewer_set_node_info(→ None)

Set node info for node in given viewer (see set_node_info())

viewer_get_node_info(→ bool)

Get node info for node in given viewer (see get_node_info())

viewer_del_node_info(→ None)

Delete node info for node in given viewer (see del_node_info())

viewer_create_groups(→ bool)

This will perform an operation similar to what happens when a user manually selects a set of nodes, right-clicks and selects "Create group". This is a wrapper around interactive_graph_t::create_group that will, in essence:

viewer_delete_groups(→ bool)

Wrapper around interactive_graph_t::delete_group. This function will:

viewer_set_groups_visibility(→ bool)

Wrapper around interactive_graph_t::change_visibility. This function will:

viewer_attach_menu_item(→ bool)

Attach a previously-registered action to the view's context menu. See kernwin.hpp for how to register actions.

viewer_get_selection(→ bool)

Get currently selected items for graph viewer.

viewer_set_titlebar_height(→ int)

Set height of node title bars (grcode_set_titlebar_height)

delete_interactive_graph(→ None)

Delete graph object.

create_user_graph_place(→ user_graph_place_t *)

Get a copy of a user_graph_place_t (returns a pointer to static storage)

pyg_close(→ None)

pyg_select_node(→ None)

pyg_show(→ bool)

Module Contents

ida_graph.SWIG_PYTHON_LEGACY_BOOL
class ida_graph.screen_graph_selection_base_t(*args)

Bases: object

thisown
push_back(*args) selection_item_t &
pop_back() None
size() size_t
empty() bool
at(_idx: size_t) selection_item_t const &
qclear() None
clear() None
resize(*args) None
grow(*args) None
capacity() size_t
reserve(cnt: size_t) None
truncate() None
swap(r: screen_graph_selection_base_t) None
extract() selection_item_t *
inject(s: selection_item_t, len: size_t) None
begin(*args) qvector< selection_item_t >::const_iterator
end(*args) qvector< selection_item_t >::const_iterator
insert(it: selection_item_t, x: selection_item_t) qvector< selection_item_t >::iterator
erase(*args) qvector< selection_item_t >::iterator
find(*args) qvector< selection_item_t >::const_iterator
has(x: selection_item_t) bool
add_unique(x: selection_item_t) bool
append(x: selection_item_t) None
extend(x: screen_graph_selection_base_t) None
front
back
class ida_graph.node_layout_t(*args)

Bases: object

thisown
push_back(*args) rect_t &
pop_back() None
size() size_t
empty() bool
at(_idx: size_t) rect_t const &
qclear() None
clear() None
resize(*args) None
grow(*args) None
capacity() size_t
reserve(cnt: size_t) None
truncate() None
swap(r: node_layout_t) None
extract() rect_t *
inject(s: rect_t, len: size_t) None
begin(*args) qvector< rect_t >::const_iterator
end(*args) qvector< rect_t >::const_iterator
insert(it: rect_t, x: rect_t) qvector< rect_t >::iterator
erase(*args) qvector< rect_t >::iterator
find(*args) qvector< rect_t >::const_iterator
has(x: rect_t) bool
add_unique(x: rect_t) bool
append(x: rect_t) None
extend(x: node_layout_t) None
front
back
class ida_graph.pointvec_t(*args)

Bases: object

thisown
push_back(*args) point_t &
pop_back() None
size() size_t
empty() bool
at(_idx: size_t) point_t const &
qclear() None
clear() None
resize(*args) None
grow(*args) None
capacity() size_t
reserve(cnt: size_t) None
truncate() None
swap(r: pointvec_t) None
extract() point_t *
inject(s: point_t, len: size_t) None
begin(*args) qvector< point_t >::const_iterator
end(*args) qvector< point_t >::const_iterator
insert(it: point_t, x: point_t) qvector< point_t >::iterator
erase(*args) qvector< point_t >::iterator
find(*args) qvector< point_t >::const_iterator
has(x: point_t) bool
add_unique(x: point_t) bool
append(x: point_t) None
extend(x: pointvec_t) None
front
back
ida_graph.NIF_BG_COLOR

node_info_t::bg_color

ida_graph.NIF_FRAME_COLOR

node_info_t::frame_color

ida_graph.NIF_EA

node_info_t::ea

ida_graph.NIF_TEXT

node_info_t::text

ida_graph.NIF_FLAGS

node_info_t::flags

ida_graph.NIF_ALL
ida_graph.GLICTL_CENTER

the gli should be set/get as center

class ida_graph.node_info_t

Bases: object

thisown
bg_color: bgcolor_t

background color

frame_color: bgcolor_t

color of enclosing frame

flags: int

flags

ea: ida_idaapi.ea_t

address

text: str

node contents

valid_bg_color() bool

Has valid bg_color?

valid_frame_color() bool

Has valid frame_color?

valid_ea() bool

Has valid ea?

valid_text() bool

Has non-empty text?

valid_flags() bool

Has valid flags?

get_flags_for_valid() int

Get combination of Node info flags describing which attributes are valid.

ida_graph.NIFF_SHOW_CONTENTS
ida_graph.get_node_info(out: node_info_t, gid: graph_id_t, node: int) bool

Get node info.

Parameters:
  • out – result

  • gid – id of desired graph

  • node – node number

Returns:

success

ida_graph.set_node_info(gid: graph_id_t, node: int, ni: node_info_t, flags: int) None

Set node info.

Parameters:
  • gid – id of desired graph

  • node – node number

  • ni – node info to use

  • flags – combination of Node info flags, identifying which fields of ‘ni’ will be used

ida_graph.del_node_info(gid: graph_id_t, node: int) None

Delete the node_info_t for the given node.

ida_graph.clr_node_info(gid: graph_id_t, node: int, flags: int) None

Clear node info for the given node.

Parameters:
  • gid – id of desired graph

  • node – node number

  • flags – combination of Node info flags, identifying which fields of node_info_t will be cleared

class ida_graph.graph_node_visitor_t

Bases: object

thisown
reinit() None

Reset visited nodes.

set_visited(n: int) None

Mark node as visited.

is_visited(n: int) bool

Have we already visited the given node?

visit_node(arg0: int) int

Implements action to take when a node is visited.

is_forbidden_edge(arg0: int, arg1: int) bool

Should the edge between ‘n’ and ‘m’ be ignored?

class ida_graph.graph_path_visitor_t

Bases: object

thisown
path: intvec_t

current path

prune: bool

walk_forward(): prune := true means to stop the current path

walk_forward(arg0: int) int
walk_backward(arg0: int) int
class ida_graph.point_t(*args)

Bases: object

thisown
x: int
y: int
add(r: point_t) point_t &
sub(r: point_t) point_t &
negate() None
ida_graph.calc_dist(p: point_t, q: point_t) double

Calculate distance between p and q.

class ida_graph.pointseq_t

Bases: pointvec_t

thisown
class ida_graph.rect_t(*args)

Bases: object

thisown
left: int
top: int
right: int
bottom: int
verify() None
width() int
height() int
move_to(p: point_t) None
move_by(p: point_t) None
center() point_t
topleft() point_t
bottomright() point_t
grow(delta: int) None
intersect(r: rect_t) None
make_union(r: rect_t) None
empty() bool
is_intersection_empty(r: rect_t) bool
contains(p: point_t) bool
area() int
class ida_graph.TPointDouble(*args)

Bases: object

thisown
x: double
y: double
add(r: TPointDouble) None
sub(r: TPointDouble) None
negate() None
class ida_graph.edge_info_t

Bases: object

thisown
color: bgcolor_t

edge color

width: int

edge width

srcoff: int

source: edge port offset from the left

dstoff: int

destination: edge port offset from the left

layout: pointseq_t

describes geometry of edge

reverse_layout() None
ida_graph.cvar
ida_graph.layout_none
ida_graph.layout_digraph
ida_graph.layout_tree
ida_graph.layout_circle
ida_graph.layout_polar_tree
ida_graph.layout_orthogonal
ida_graph.layout_radial_tree
class ida_graph.edge_layout_point_t(*args)

Bases: object

thisown
pidx: int

index into edge_info_t::layout

e: edge_t

parent edge

compare(r: edge_layout_point_t) int
class ida_graph.selection_item_t(*args)

Bases: object

thisown
is_node: bool

represents a selected node?

node: int

node number (is_node = true)

elp: edge_layout_point_t

edge layout point (is_node = false)

compare(r: selection_item_t) int
class ida_graph.screen_graph_selection_t

Bases: screen_graph_selection_base_t

thisown
has(item: selection_item_t) bool
add(s: screen_graph_selection_t) None
sub(s: screen_graph_selection_t) None
add_node(node: int) None
del_node(node: int) None
add_point(e: edge_t, idx: int) None
del_point(e: edge_t, idx: int) None
nodes_count() size_t
points_count() size_t
items_count(look_for_nodes: bool) size_t
class ida_graph.edge_segment_t

Bases: object

thisown
e: edge_t
nseg: int
x0: int
x1: int
length() size_t
toright() bool
ida_graph.git_none

nothing

ida_graph.git_edge

edge (graph_item_t::e, graph_item_t::n. n is farthest edge endpoint)

ida_graph.git_node

node title (graph_item_t::n)

ida_graph.git_tool

node title button (graph_item_t::n, graph_item_t::b)

ida_graph.git_text

node text (graph_item_t::n, graph_item_t::p)

ida_graph.git_elp

edge layout point (graph_item_t::elp)

class ida_graph.graph_item_t

Bases: object

thisown
type: graph_item_type_t

type

e: edge_t

edge source and destination

n: int

node number

b: int

button number

p: point_t

text coordinates in the node

elp: edge_layout_point_t

edge layout point

is_node() bool
is_edge() bool
class ida_graph.interval_t(*args)

Bases: object

thisown
x0: int
x1: int
empty() bool
intersect(r: interval_t) None
make_union(r: interval_t) None
move_by(shift: int) None
length() int
contains(x: int) bool
class ida_graph.row_info_t

Bases: object

thisown
nodes: intvec_t

list of nodes at the row

top: int

top y coord of the row

bottom: int

bottom y coord of the row

height() int
class ida_graph.drawable_graph_t

Bases: ida_gdl.gdl_graph_t

thisown
title: str

graph title

rect_edges_made: bool

have create rectangular edges?

current_layout: layout_type_t

see Proximity view layouts

circle_center: point_t

for layout_circle

circle_radius: int

for layout_circle

callback_ud: void *

user data for callback

create_tree_layout() bool
create_circle_layout(p: point_t, radius: int) bool
set_callback(_callback: hook_cb_t *, _ud: void *) None
grcall(code: int) ssize_t
get_edge(e: edge_t) edge_info_t *
nrect(n: int) rect_t
ida_graph.ygap
ida_graph.xgap
ida_graph.arrow_height
ida_graph.arrow_width
class ida_graph.edge_infos_wrapper_t(*args, **kwargs)

Bases: object

thisown
clear() None
ptr: edge_infos_t *
class ida_graph.interactive_graph_t(*args, **kwargs)

Bases: drawable_graph_t

thisown
gid: int

graph id - unique for the database for flowcharts it is equal to the function start_ea

belongs: intvec_t

the subgraph the node belongs to INT_MAX means that the node doesn’t exist sign bit means collapsed node

node_flags: bytevec_t

node flags

org_succs: array_of_intvec_t
org_preds: array_of_intvec_t
succs: array_of_intvec_t
preds: array_of_intvec_t
nodes: interactive_graph_t::node_layout_t
edges: edge_infos_wrapper_t
size() int

Get the total number of nodes (including group nodes, and including hidden nodes.) See also node_qty()

Returns:

the total number of nodes in the graph

node_qty() int

Get the number of visible nodes (the list can be retrieved using gdl.hpp’s node_iterator) See also size()

Returns:

the number of visible nodes

empty() bool

Is the graph (visually) empty?

Returns:

true if there are no visible nodes

exists(node: int) bool

Is the node visible?

Parameters:

node – the node number

Returns:

success

get_node_representative(node: int) int

Get the node that currently visually represents ‘node’. This will find the “closest” parent group node that’s visible, by attempting to walk up the group nodes that contain ‘node’, and will stop when it finds a node that is currently visible. See also get_group_node()

Parameters:

node – the node

Returns:

the node that represents ‘node’, or ‘node’ if it’s not part of any group

get_node_group(node: int) int
set_node_group(node: int, group: int) None
is_deleted_node(node: int) bool
set_deleted_node(node: int) None
is_subgraph_node(node: int) bool
is_dot_node(node: int) bool
is_group_node(node: int) bool
is_displayable_node(node: int) bool
is_simple_node(node: int) bool
is_collapsed_node(node: int) bool
is_uncollapsed_node(node: int) bool
is_visible_node(node: int) bool

Is the node currently visible? An invisible node is a node that’s part of a group that’s currently collapsed.

Parameters:

node – the node

Returns:

success

get_first_subgraph_node(group: int) int
get_next_subgraph_node(group: int, current: int) int
create_group(nodes: intvec_t const &) int

Create a new group node, that will contain all the nodes in ‘nodes’.

Parameters:

nodes – the nodes that will be part of the group

Returns:

the group node, or -1 in case of error

delete_group(group: int) bool

Delete a group node. This deletes the group node only; it does not delete nodes that are part of the group.

Parameters:

group – the group node

Returns:

success

change_group_visibility(group: int, expand: bool) bool

Expand/collapse a group node

Parameters:
  • group – the group node

  • expand – whether to expand or collapse

Returns:

success

nsucc(b: int) int
npred(b: int) int
succ(b: int, i: int) int
pred(b: int, i: int) int
succset(b: int) intvec_t const &
predset(b: int) intvec_t const &
reset() None
redo_layout() bool

Recompute the layout, according to the value of ‘current_layout’.

Returns:

success

resize(n: int) None

Resize the graph to ‘n’ nodes

Parameters:

n – the new size

add_node(r: rect_t) int

Add a node, possibly with a specific geometry

Parameters:

r – the node geometry (can be nullptr)

Returns:

the new node

del_node(n: int) ssize_t

Delete a node

Parameters:

n – the node to delete

Returns:

the number of deleted edges

add_edge(i: int, j: int, ei: edge_info_t) bool
del_edge(i: int, j: int) bool
replace_edge(i: int, j: int, x: int, y: int) bool
refresh() bool

Refresh the graph A graph needs refreshing when it’s “backing data”. E.g., if the number (or contents) of the objects in the above example, change. Let’s say the user’s plugin ends up finding a 5th piece of scattered data. It should then add it to its internal list of known objects, and tell IDA that the graph needs to be refreshed, using refresh_viewer(). This will cause IDA to: * discard all its internal rendering information, * call interactive_graph_t::refresh() on the graph so that the user’s plugin has a chance to “sync” the number of nodes & edges that this graph contains, to the information that the plugin has collected so far * re-create internal rendering information, and * repaint the view

Returns:

success

set_nrect(n: int, r: rect_t) bool
set_edge(e: edge_t, ei: edge_info_t) bool
create_digraph_layout() bool
del_custom_layout() None
get_custom_layout() bool
set_custom_layout() None
get_graph_groups() bool
set_graph_groups() None
calc_group_ea(arg2: intvec_t const &) ida_idaapi.ea_t
is_user_graph() bool
ida_graph.MTG_GROUP_NODE

is group node?

ida_graph.MTG_DOT_NODE

is dot node?

ida_graph.MTG_NON_DISPLAYABLE_NODE

for disassembly graphs - non-displayable nodes have a visible area that is too large to generate disassembly lines for without IDA slowing down significantly (see MAX_VISIBLE_NODE_AREA)

ida_graph.COLLAPSED_NODE
class ida_graph.graph_visitor_t

Bases: object

thisown
visit_node(arg2: int, arg3: rect_t) int
visit_edge(arg2: edge_t, arg3: edge_info_t) int
ida_graph.grcode_calculating_layout

calculating user-defined graph layout.

ida_graph.grcode_layout_calculated

graph layout calculated.

ida_graph.grcode_changed_graph

new graph has been set.

ida_graph.grcode_reserved
ida_graph.grcode_clicked

graph is being clicked. this callback allows you to ignore some clicks. it occurs too early, internal graph variables are not updated yet. current_item1, current_item2 point to the same thing. item2 has more information. see also: custom_viewer_click_t

ida_graph.grcode_dblclicked

a graph node has been double clicked.

ida_graph.grcode_creating_group

a group is being created. this provides an opportunity for the graph to forbid creation of the group. Note that groups management is done by the interactive_graph_t instance itself: there is no need to modify the graph in this callback.

ida_graph.grcode_deleting_group

a group is being deleted. this provides an opportunity for the graph to forbid deletion of the group. Note that groups management is done by the interactive_graph_t instance itself: there is no need to modify the graph in this callback.

ida_graph.grcode_group_visibility

a group is being collapsed/uncollapsed this provides an opportunity for the graph to forbid changing the visibility of the group. Note that groups management is done by the interactive_graph_t instance itself: there is no need to modify the graph in this callback.

ida_graph.grcode_gotfocus

a graph viewer got focus.

ida_graph.grcode_lostfocus

a graph viewer lost focus.

ida_graph.grcode_user_refresh

refresh user-defined graph nodes and edges This is called when the UI considers that it is necessary to recreate the graph layout, and thus has to ensure that the ‘interactive_graph_t’ instance it is using, is up-to-date. For example: * at graph creation-time * if a refresh_viewer() call was made

ida_graph.grcode_reserved2
ida_graph.grcode_user_text

retrieve text for user-defined graph node. NB: do not use anything calling GDI!

ida_graph.grcode_user_size

calculate node size for user-defined graph.

ida_graph.grcode_user_title

render node title of a user-defined graph.

ida_graph.grcode_user_draw

render node of a user-defined graph. NB: draw only on the specified DC and nowhere else!

ida_graph.grcode_user_hint

retrieve hint for the user-defined graph.

ida_graph.grcode_destroyed

graph is being destroyed. Note that this doesn’t mean the graph viewer is being destroyed; this only means that the graph that is being displayed by it is being destroyed, and that, e.g., any possibly cached data should be invalidated (this event can happen when, for example, the user decides to group nodes together: that operation will effectively create a new graph, that will replace the old one.) To be notified when the graph viewer itself is being destroyed, please see notification ‘view_close’, in kernwin.hpp

ida_graph.grcode_create_graph_viewer

use create_graph_viewer()

ida_graph.grcode_get_graph_viewer

use get_graph_viewer()

ida_graph.grcode_get_viewer_graph

use get_viewer_graph()

ida_graph.grcode_create_interactive_graph

use create_interactive_graph()

ida_graph.grcode_set_viewer_graph

use set_viewer_graph()

ida_graph.grcode_refresh_viewer

use refresh_viewer()

ida_graph.grcode_fit_window

use viewer_fit_window()

ida_graph.grcode_get_curnode

use viewer_get_curnode()

ida_graph.grcode_center_on

use viewer_center_on()

ida_graph.grcode_get_selection

use viewer_get_selection()

ida_graph.grcode_del_custom_layout

use interactive_graph_t::del_custom_layout()

ida_graph.grcode_set_custom_layout

use interactive_graph_t::set_custom_layout()

ida_graph.grcode_set_graph_groups

use interactive_graph_t::set_graph_groups()

ida_graph.grcode_clear

use interactive_graph_t::clear()

ida_graph.grcode_create_digraph_layout

use interactive_graph_t::create_digraph_layout()

ida_graph.grcode_create_tree_layout

use drawable_graph_t::create_tree_layout()

ida_graph.grcode_create_circle_layout

use drawable_graph_t::create_circle_layout()

ida_graph.grcode_get_node_representative

use interactive_graph_t::get_node_representative()

ida_graph.grcode_find_subgraph_node

use interactive_graph_t::_find_subgraph_node()

ida_graph.grcode_create_group

use interactive_graph_t::create_group()

ida_graph.grcode_get_custom_layout

use interactive_graph_t::get_custom_layout()

ida_graph.grcode_get_graph_groups

use interactive_graph_t::get_graph_groups()

ida_graph.grcode_empty

use interactive_graph_t::empty()

ida_graph.grcode_is_visible_node

use interactive_graph_t::is_visible_node()

ida_graph.grcode_delete_group

use interactive_graph_t::delete_group()

ida_graph.grcode_change_group_visibility

use interactive_graph_t::change_group_visibility()

ida_graph.grcode_set_edge

use interactive_graph_t::set_edge()

ida_graph.grcode_node_qty

use interactive_graph_t::node_qty()

ida_graph.grcode_nrect

use interactive_graph_t::nrect()

ida_graph.grcode_set_titlebar_height

use viewer_set_titlebar_height()

ida_graph.grcode_create_user_graph_place

use create_user_graph_place()

ida_graph.grcode_create_disasm_graph1

use create_disasm_graph(ea_t ea)

ida_graph.grcode_create_disasm_graph2

use create_disasm_graph(const rangevec_t &ranges)

ida_graph.grcode_set_node_info

use viewer_set_node_info()

ida_graph.grcode_get_node_info

use viewer_get_node_info()

ida_graph.grcode_del_node_info

use viewer_del_node_info()

ida_graph.grcode_viewer_create_groups
ida_graph.grcode_viewer_delete_groups
ida_graph.grcode_viewer_groups_visibility
ida_graph.grcode_viewer_create_groups_vec

use viewer_create_groups()

ida_graph.grcode_viewer_delete_groups_vec

use viewer_delete_groups()

ida_graph.grcode_viewer_groups_visibility_vec

use viewer_set_groups_visibility()

ida_graph.grcode_delete_interactive_graph

use delete_interactive_graph()

ida_graph.grcode_edge_infos_wrapper_copy

use edge_infos_wrapper_t::operator=()

ida_graph.grcode_edge_infos_wrapper_clear

use edge_infos_wrapper_t::clear()

ida_graph.grcode_attach_menu_item
ida_graph.grcode_set_gli

use viewer_set_gli()

ida_graph.grcode_get_gli

use viewer_get_gli()

class ida_graph.group_crinfo_t

Bases: object

thisown
nodes: intvec_t
text: str
ida_graph.create_graph_viewer(title: str, id: int, callback: hook_cb_t *, ud: void *, title_height: int, parent: TWidget * = None) graph_viewer_t *

Create a custom graph viewer.

Parameters:
  • title – the widget title

  • id – graph id

  • callback – callback to handle graph notifications (graph_notification_t)

  • ud – user data passed to callback

  • title_height – node title height

  • parent – the parent widget of the graph viewer

Returns:

new viewer

ida_graph.get_graph_viewer(parent: TWidget *) graph_viewer_t *

Get custom graph viewer for given form.

ida_graph.create_interactive_graph(id: int) interactive_graph_t *

Create a new empty graph with given id.

ida_graph.create_disasm_graph(*args) interactive_graph_t *

This function has the following signatures:

  1. create_disasm_graph(ea: ida_idaapi.ea_t) -> interactive_graph_t *

  2. create_disasm_graph(ranges: const rangevec_t &) -> interactive_graph_t *

# 0: create_disasm_graph(ea: ida_idaapi.ea_t) -> interactive_graph_t *

Create a graph for the function that contains ‘ea’.

# 1: create_disasm_graph(ranges: const rangevec_t &) -> interactive_graph_t *

Create a graph using an arbitrary set of ranges.

ida_graph.get_viewer_graph(gv: graph_viewer_t *) interactive_graph_t *

Get graph object for given custom graph viewer.

ida_graph.set_viewer_graph(gv: graph_viewer_t *, g: interactive_graph_t) None

Set the underlying graph object for the given viewer.

ida_graph.refresh_viewer(gv: graph_viewer_t *) None

Redraw the graph in the given view.

ida_graph.viewer_fit_window(gv: graph_viewer_t *) None

Fit graph viewer to its parent form.

ida_graph.viewer_get_curnode(gv: graph_viewer_t *) int

Get number of currently selected node (-1 if none)

ida_graph.viewer_center_on(gv: graph_viewer_t *, node: int) None

Center the graph view on the given node.

ida_graph.viewer_set_gli(gv: graph_viewer_t *, gli: graph_location_info_t const *, flags: int = 0) None

Set location info for given graph view If flags contains GLICTL_CENTER, then the gli will be set to be the center of the view. Otherwise it will be the top-left.

ida_graph.viewer_get_gli(out: graph_location_info_t *, gv: graph_viewer_t *, flags: int = 0) bool

Get location info for given graph view If flags contains GLICTL_CENTER, then the gli that will be retrieved, will be the one at the center of the view. Otherwise it will be the top-left.

ida_graph.viewer_set_node_info(gv: graph_viewer_t *, n: int, ni: node_info_t, flags: int) None

Set node info for node in given viewer (see set_node_info())

ida_graph.viewer_get_node_info(gv: graph_viewer_t *, out: node_info_t, n: int) bool

Get node info for node in given viewer (see get_node_info())

ida_graph.viewer_del_node_info(gv: graph_viewer_t *, n: int) None

Delete node info for node in given viewer (see del_node_info())

ida_graph.viewer_create_groups(gv: graph_viewer_t *, out_group_nodes: intvec_t *, gi: groups_crinfos_t const &) bool

This will perform an operation similar to what happens when a user manually selects a set of nodes, right-clicks and selects “Create group”. This is a wrapper around interactive_graph_t::create_group that will, in essence: * clone the current graph * for each group_crinfo_t, attempt creating group in that new graph * if all were successful, animate to that new graph.

ida_graph.viewer_delete_groups(gv: graph_viewer_t *, groups: intvec_t const &, new_current: int = -1) bool

Wrapper around interactive_graph_t::delete_group. This function will: * clone the current graph * attempt deleting the groups in that new graph * if successful, animate to that new graph.

ida_graph.viewer_set_groups_visibility(gv: graph_viewer_t *, groups: intvec_t const &, expand: bool, new_current: int = -1) bool

Wrapper around interactive_graph_t::change_visibility. This function will: * clone the current graph * attempt changing visibility of the groups in that new graph * if successful, animate to that new graph.

ida_graph.viewer_attach_menu_item(g: graph_viewer_t *, name: str) bool

Attach a previously-registered action to the view’s context menu. See kernwin.hpp for how to register actions.

Parameters:
  • g – graph viewer

  • name – action name

Returns:

success

ida_graph.viewer_get_selection(gv: graph_viewer_t *, sgs: screen_graph_selection_t) bool

Get currently selected items for graph viewer.

ida_graph.viewer_set_titlebar_height(gv: graph_viewer_t *, height: int) int

Set height of node title bars (grcode_set_titlebar_height)

ida_graph.delete_interactive_graph(g: interactive_graph_t) None

Delete graph object.

class ida_graph.user_graph_place_t(*args, **kwargs)

Bases: object

thisown
node: int
ida_graph.create_user_graph_place(node: int, lnnum: int) user_graph_place_t *

Get a copy of a user_graph_place_t (returns a pointer to static storage)

ida_graph.pyg_close(_self: PyObject *) None
ida_graph.pyg_select_node(_self: PyObject *, nid: int) None
ida_graph.pyg_show(_self: PyObject *) bool
ida_graph.edge_t
ida_graph.node_ordering_t
ida_graph.abstract_graph_t
ida_graph.mutable_graph_t
ida_graph.create_mutable_graph
ida_graph.delete_mutable_graph
ida_graph.grcode_create_mutable_graph
ida_graph.grcode_create_mutable_graph
class ida_graph.GraphViewer(title, close_open=False)

Bases: ida_kernwin.CustomIDAMemo

class UI_Hooks_Trampoline(v)

Bases: ida_kernwin.UI_Hooks

v
populating_widget_popup(w, popup_handle)

IDA is populating the context menu for a widget. This is your chance to attach_action_to_popup(). Have a look at ui_finish_populating_widget_popup, if you want to augment the context menu with your own actions after the menu has had a chance to be properly populated by the owning component or plugin (which typically does it on ui_populating_widget_popup.)

Parameters:
  • widget – (TWidget *)

  • popup_handle – (TPopupMenu *)

  • ctx – (const action_activation_ctx_t *)

Returns:

void

ui_hooks_trampoline
AddNode(obj)

Creates a node associated with the given object and returns the node id

AddEdge(src_node, dest_node)

Creates an edge between two given node ids

Clear()

Clears all the nodes and edges

Count()

Returns the node count

Close()

Closes the graph. It is possible to call Show() again (which will recreate the graph)

Show()

Shows an existing graph or creates a new one

Returns:

Boolean

Select(node_id)

Selects a node on the graph

OnRefresh()

Event called when the graph is refreshed or first created. From this event you are supposed to create nodes and edges. This callback is mandatory.

NOTE: *It is important to clear previous nodes before adding nodes.*

Returns:

Returning True tells the graph viewer to use the items. Otherwise old items will be used.

AddCommand(title, shortcut)
OnPopup(widget, popup_handle)
OnCommand(cmd_id)