vds_hooks
summary: react to decompiler events/notifications
- description:
Shows how to hook to many notifications sent by the decompiler.
This plugin doesn’t really accomplish anything: it just prints the parameters.
The list of notifications handled below should be exhaustive, and is there to hint at what is possible to accomplish by subclassing ida_hexrays.Hexrays_Hooks
see_also: curpos_details
level: intermediate
Attributes
Classes
Module Contents
- class vds_hooks.vds_hooks_t
Bases:
ida_hexrays.Hexrays_Hooks- display_shortened_cfuncs = False
- display_vdui_curpos = False
- inhibit_log = 0
- flowchart(fc, mba, reachable_blocks, decomp_flags)
Flowchart has been generated.
- stkpnts(mba, stkpnts)
SP change points have been calculated.
- Parameters:
mba – (mba_t *)
- Returns:
Microcode error code This event is generated for each inlined range as well.
- prolog(mba, fc, reachable_blocks, decomp_flags)
Prolog analysis has been finished.
- mba_maturity(mba, reqmat)
Maturity level of an MBA was changed.
- Parameters:
mba – (mba_t *)
reqmat – (mba_maturity_t) requested maturity level
- Returns:
Microcode error code
- microcode(mba)
Microcode has been generated.
- Parameters:
mba – (mba_t *)
- Returns:
Microcode error code
- preoptimized(mba)
Microcode has been preoptimized.
- Parameters:
mba – (mba_t *)
- Returns:
Microcode error code
- locopt(mba)
Basic block level optimization has been finished.
- Parameters:
mba – (mba_t *)
- Returns:
Microcode error code
- prealloc(mba)
Local variables: preallocation step begins.
- Parameters:
mba – (mba_t *) This event may occur several times. Should return: 1 if modified microcode Negative values are Microcode error code
- glbopt(mba)
Global optimization has been finished. If microcode is modified, MERR_LOOP must be returned. It will cause a complete restart of the optimization.
- Parameters:
mba – (mba_t *)
- Returns:
Microcode error code
- begin_structural(out, cfunc, ctrl_graph)
- maturity(cfunc, maturity)
Ctree maturity level is being changed.
- Parameters:
cfunc – (cfunc_t *)
new_maturity – (ctree_maturity_t)
- interr(code)
Internal error has occurred.
- Parameters:
errcode – (int )
- combine(blk, insn)
Trying to combine instructions of basic block.
- print_func(cfunc, printer)
Printing ctree and generating text.
- func_printed(cfunc)
Function text has been generated. Plugins may modify the text in cfunc_t::sv. However, it is too late to modify the ctree or microcode. The text uses regular color codes (see lines.hpp) COLOR_ADDR is used to store pointers to ctree items.
- Parameters:
cfunc – (cfunc_t *)
- resolve_stkaddrs(mba)
The optimizer is about to resolve stack addresses.
- Parameters:
mba – (mba_t *)
- switch_pseudocode(vu)
Existing pseudocode view has been reloaded with a new function. Its text has not been refreshed yet, only cfunc and mba pointers are ready.
- Parameters:
vu – (vdui_t *)
- refresh_pseudocode(vu)
Existing pseudocode text has been refreshed. Adding/removing pseudocode lines is forbidden in this event.
- Parameters:
vu – (vdui_t *) See also hxe_text_ready, which happens earlier
- keyboard(vu, key_code, shift_state)
Keyboard has been hit.
- right_click(vu)
Mouse right click. Use hxe_populating_popup instead, in case you want to add items in the popup menu.
- Parameters:
vu – (vdui_t *)
- double_click(vu, shift_state)
Mouse double click.
- Parameters:
vu – (vdui_t *)
shift_state – (int) Should return: 1 if the event has been handled
- curpos(vu)
Current cursor position has been changed. (for example, by left-clicking or using keyboard)
- Parameters:
vu – (vdui_t *)
- create_hint(vu)
Create a hint for the current item.
- Parameters:
vu – (vdui_t *)
- Returns:
0: continue collecting hints with other subscribers
- Returns:
1: stop collecting hints
- text_ready(vu)
Decompiled text is ready.
- Parameters:
vu – (vdui_t *) This event can be used to modify the output text (sv). Obsolete. Please use hxe_func_printed instead.
- populating_popup(widget, popup, vu)
Populating popup menu. We can add menu items now.
- lvar_name_changed(vu, v, name, is_user_name)
Local variable got renamed.
- lvar_type_changed(vu, v, tif)
Local variable type got changed.
- lvar_cmt_changed(vu, v, cmt)
Local variable comment got changed.
- lvar_mapping_changed(vu, _from, to)
Local variable mapping got changed.
- cmt_changed(cfunc, loc, cmt)
Comment got changed.
- build_callinfo(blk, type)
Analyzing a call instruction.
- callinfo_built(blk)
A call instruction has been anallyzed.
- Parameters:
blk – (mblock_t *) blk->tail is the call.
- calls_done(mba)
All calls have been analyzed.
- Parameters:
mba – (mba_t *) This event is generated immediately after analyzing all calls, before any optimizitions, call unmerging and block merging.
- begin_inlining(cdg, flags)
Starting to inline outlined functions.
- Parameters:
cdg – (codegen_t *)
decomp_flags – (int)
- Returns:
Microcode error code This is an opportunity to inline other ranges.
- inlining_func(cdg, blk, mbr)
A set of ranges is going to be inlined.
- inlined_func(cdg, blk, mbr, i1, i2)
A set of ranges got inlined.
- pre_structural(ctrl_graph, cfunc, cfg)
Structure analysis is starting.
- vds_hooks.vds_hooks