vds5

summary: dump C-tree graph

description:

Registers an action that can be used to show the graph of the ctree. The current item will be highlighted in the graph.

The command shortcut is Ctrl+Shift+G, and is also added to the context menu.

To display the graph, we produce a .gdl file, and request that ida displays that using ida_gdl.display_gdl.

level: advanced

Attributes

ACTION_NAME

ACTION_SHORTCUT

CL_WHITE

CL_BLUE

CL_RED

CL_GREEN

CL_YELLOW

CL_MAGENTA

CL_CYAN

CL_DARKGREY

CL_DARKBLUE

CL_DARKRED

CL_DARKGREEN

CL_DARKYELLOW

CL_DARKMAGENTA

CL_DARKCYAN

CL_GOLD

CL_LIGHTGREY

CL_LIGHTBLUE

CL_LIGHTRED

CL_LIGHTGREEN

CL_LIGHTYELLOW

CL_LIGHTMAGENTA

CL_LIGHTCYAN

CL_LILAC

CL_TURQUOISE

CL_AQUAMARINE

CL_KHAKI

CL_PURPLE

CL_YELLOWGREEN

CL_PINK

CL_ORANGE

CL_ORCHID

CL_BLACK

COLORS_LUT

Classes

cfunc_graph_t

graph_builder_t

display_graph_ah_t

vds5_hooks_t

my_plugin_t

Base class for all scripted plugins.

Functions

get_color_name(c)

PLUGIN_ENTRY()

Module Contents

vds5.ACTION_NAME = 'vds5.py:displaygraph'
vds5.ACTION_SHORTCUT = 'Ctrl+Shift+G'
vds5.CL_WHITE = 16777215
vds5.CL_BLUE = 16711680
vds5.CL_RED = 255
vds5.CL_GREEN = 65280
vds5.CL_YELLOW = 65535
vds5.CL_MAGENTA = 16711935
vds5.CL_CYAN = 16776960
vds5.CL_DARKGREY = 5592405
vds5.CL_DARKBLUE = 8388608
vds5.CL_DARKRED = 128
vds5.CL_DARKGREEN = 32768
vds5.CL_DARKYELLOW = 32896
vds5.CL_DARKMAGENTA = 8388736
vds5.CL_DARKCYAN = 8421376
vds5.CL_GOLD = 55295
vds5.CL_LIGHTGREY = 11184810
vds5.CL_LIGHTBLUE = 16744576
vds5.CL_LIGHTRED = 8421631
vds5.CL_LIGHTGREEN = 8454016
vds5.CL_LIGHTYELLOW = 8454143
vds5.CL_LIGHTMAGENTA = 16744703
vds5.CL_LIGHTCYAN = 16777088
vds5.CL_LILAC = 15631086
vds5.CL_TURQUOISE = 13688896
vds5.CL_AQUAMARINE = 13959039
vds5.CL_KHAKI = 9234160
vds5.CL_PURPLE = 15736992
vds5.CL_YELLOWGREEN = 3329434
vds5.CL_PINK = 13353215
vds5.CL_ORANGE = 42495
vds5.CL_ORCHID = 14053594
vds5.CL_BLACK = 0
vds5.COLORS_LUT
vds5.get_color_name(c)
class vds5.cfunc_graph_t(highlight)
items = []
highlight
succs = []
preds = []
nsucc(n)
npred(n)
succ(n, i)
pred(n, i)
size()
add_node()
add_edge(x, y)
get_expr_name(expr)
get_node_label(n)
get_node_color(n)
gen_gdl(fname)
dump()
class vds5.graph_builder_t(cg)

Bases: ida_hexrays.ctree_parentee_t

cg
reverse = []
add_node(i)
process(i)
visit_insn(i)

Visit a statement. This is a visitor function which should be overridden by a derived class to do some useful work. This visitor performs pre-order traserval, i.e. an item is visited before its children.

Returns:

0 to continue the traversal, nonzero to stop.

visit_expr(e)

Visit an expression. This is a visitor function which should be overridden by a derived class to do some useful work. This visitor performs pre-order traserval, i.e. an item is visited before its children.

Returns:

0 to continue the traversal, nonzero to stop.

class vds5.display_graph_ah_t

Bases: ida_kernwin.action_handler_t

activate(ctx)

Activate an action. This function implements the core behavior of an action. It is called when the action is triggered, from a menu, from a popup menu, from the toolbar, or programmatically.

Returns:

non-zero: all IDA windows will be refreshed

update(ctx)

Update an action. This is called when the context of the UI changed, and we need to let the action update some of its properties if needed (label, icon, …) In addition, this lets IDA know whether the action is enabled, and when it should be queried for availability again. Note: This callback is not meant to change anything in the application’s state, except by calling one (or many) of the “update_action_*()” functions on this very action.

class vds5.vds5_hooks_t(_flags: int = 0, _hkcb_flags: int = 1)

Bases: ida_hexrays.Hexrays_Hooks

populating_popup(widget, handle, vu)

Populating popup menu. We can add menu items now.

Parameters:
  • widget – (TWidget *)

  • popup_handle – (TPopupMenu *)

  • vu – (vdui_t *)

class vds5.my_plugin_t

Bases: ida_idaapi.plugin_t

Base class for all scripted plugins.

flags = 16
wanted_name = 'Hex-Rays show C graph (IDAPython)'
wanted_hotkey = ''
comment = 'Sample plugin5 for Hex-Rays decompiler'
help = ''
init()
term()
run(arg)
vds5.PLUGIN_ENTRY()