IDAPython 9.0
|
Public Member Functions | |
__init__ (self, *args, **kwargs) | |
bool | precise_defeas (self) |
bool | optimized (self) |
bool | short_display (self) |
bool | show_reduction (self) |
bool | graph_insns (self) |
bool | loaded_gdl (self) |
bool | should_beautify (self) |
bool | rtype_refined (self) |
bool | may_refine_rettype (self) |
bool | use_wingraph32 (self) |
bool | display_numaddrs (self) |
bool | display_valnums (self) |
bool | is_pattern (self) |
bool | is_thunk (self) |
bool | saverest_done (self) |
bool | callinfo_built (self) |
bool | really_alloc (self) |
bool | lvars_allocated (self) |
bool | chain_varnums_ok (self) |
bool | returns_fpval (self) |
bool | has_passregs (self) |
bool | generated_asserts (self) |
bool | propagated_asserts (self) |
bool | deleted_pairs (self) |
bool | common_stkvars_stkargs (self) |
bool | lvar_names_ok (self) |
bool | lvars_renamed (self) |
bool | has_over_chains (self) |
bool | valranges_done (self) |
bool | argidx_ok (self) |
bool | argidx_sorted (self) |
bool | code16_bit_removed (self) |
bool | has_stack_retval (self) |
bool | has_outlines (self) |
bool | is_ctr (self) |
bool | is_dtr (self) |
bool | is_cdtr (self) |
bool | prop_complex (self) |
int | get_mba_flags (self) |
int | get_mba_flags2 (self) |
None | set_mba_flags (self, int f) |
None | clr_mba_flags (self, int f) |
None | set_mba_flags2 (self, int f) |
None | clr_mba_flags2 (self, int f) |
None | clr_cdtr (self) |
int | calc_shins_flags (self) |
int | stkoff_vd2ida (self, int off) |
int | stkoff_ida2vd (self, int off) |
int | argbase (self) |
'vdloc_t' | idaloc2vd (self, 'argloc_t' loc, int width) |
'argloc_t' | vd2idaloc (self, *args) |
bool | is_stkarg (self, 'lvar_t' v) |
'argloc_t' | get_ida_argloc (self, 'lvar_t' v) |
bool | write_to_const_detected (self) |
bool | bad_call_sp_detected (self) |
bool | regargs_is_not_aligned (self) |
bool | has_bad_sp (self) |
None | term (self) |
'func_t *' | get_curfunc (self) |
bool | use_frame (self) |
bool | is_snippet (self) |
bool | set_maturity (self, 'mba_maturity_t' mat) |
int | optimize_local (self, int locopt_bits) |
'merror_t' | build_graph (self) |
'mbl_graph_t *' | get_graph (self) |
int | analyze_calls (self, int acflags) |
'merror_t' | optimize_global (self) |
None | alloc_lvars (self) |
None | dump (self) |
None | dump_mba (self, bool _verify, str title) |
None | verify (self, bool always) |
None | mark_chains_dirty (self) |
'mblock_t *' | get_mblock (self, 'uint' n) |
'mblock_t *' | insert_block (self, int bblk) |
'mblock_t *' | split_block (self, 'mblock_t' blk, 'minsn_t' start_insn) |
bool | remove_block (self, 'mblock_t' blk) |
bool | remove_blocks (self, int start_blk, int end_blk) |
'mblock_t *' | copy_block (self, 'mblock_t' blk, int new_serial, int cpblk_flags=3) |
bool | remove_empty_and_unreachable_blocks (self) |
bool | merge_blocks (self) |
int | for_all_ops (self, 'mop_visitor_t' mv) |
int | for_all_insns (self, 'minsn_visitor_t' mv) |
int | for_all_topinsns (self, 'minsn_visitor_t' mv) |
'mop_t *' | find_mop (self, 'op_parent_info_t' ctx, ida_idaapi.ea_t ea, bool is_dest, 'mlist_t' list) |
'minsn_t *' | create_helper_call (self, ida_idaapi.ea_t ea, str helper, 'tinfo_t' rettype=None, 'mcallargs_t' callargs=None, 'mop_t' out=None) |
None | get_func_output_lists (self, *args) |
'lvar_t &' | arg (self, int n) |
ida_idaapi.ea_t | alloc_fict_ea (self, ida_idaapi.ea_t real_ea) |
ida_idaapi.ea_t | map_fict_ea (self, ida_idaapi.ea_t fict_ea) |
'ivl_t const &' | get_std_region (self, 'memreg_index_t' idx) |
'ivl_t const &' | get_lvars_region (self) |
'ivl_t const &' | get_shadow_region (self) |
'ivl_t const &' | get_args_region (self) |
'ivl_t' | get_stack_region (self) |
None | serialize (self) |
None | save_snapshot (self, str description) |
'mreg_t' | alloc_kreg (self, 'size_t' size, bool check_size=True) |
None | free_kreg (self, 'mreg_t' reg, 'size_t' size) |
'merror_t' | inline_func (self, 'codegen_t' cdg, int blknum, 'mba_ranges_t' ranges, int decomp_flags=0, int inline_flags=0) |
'stkpnt_t const *' | locate_stkpnt (self, ida_idaapi.ea_t ea) |
bool | set_lvar_name (self, 'lvar_t' v, str name, int flagbits) |
bool | set_nice_lvar_name (self, 'lvar_t' v, str name) |
bool | set_user_lvar_name (self, 'lvar_t' v, str name) |
Static Public Member Functions | |
'mba_t *' | deserialize ('uchar const *' bytes) |
Static Public Attributes | |
str | mbr |
str | entry_ea |
str | last_prolog_ea |
str | first_epilog_ea |
str | qty |
str | npurged |
str | cc = property(_ida_hexrays.mba_t_cc_get, _ida_hexrays.mba_t_cc_set) |
str | tmpstk_size |
str | frsize |
str | frregs |
str | fpd |
str | pfn_flags |
str | retsize |
str | shadow_args |
str | fullsize |
str | stacksize |
str | inargoff |
str | minstkref |
str | minstkref_ea |
str | minargref |
str | spd_adjust |
str | gotoff_stkvars |
str | restricted_memory |
str | aliased_memory |
str | nodel_memory |
str | consumed_argregs |
str | maturity |
str | reqmat |
str | final_type |
str | idb_type |
str | idb_spoiled |
str | spoiled_list |
str | fti_flags |
str | label |
str | vars |
str | argidx |
str | retvaridx |
str | error_ea |
str | error_strarg |
str | blocks |
str | natural |
str | std_ivls |
str | notes |
str | occurred_warns |
Protected Member Functions | |
None | _print (self, 'vd_printer_t' vp) |
None | _register (self) |
None | _deregister (self) |
Properties | |
thisown | |
idb_node = property(lambda self: self.deprecated_idb_node) | |
__init__ | ( | self, | |
* | args, | ||
** | kwargs ) |
|
protected |
|
protected |
|
protected |
ida_idaapi.ea_t alloc_fict_ea | ( | self, | |
ida_idaapi.ea_t | real_ea ) |
Allocate a fictional address. This function can be used to allocate a new unique address for a new instruction, if re-using any existing address leads to conflicts. For example, if the last instruction of the function modifies R0 and falls through to the next function, it will be a tail call: LDM R0!, {R4,R7} end of the function start of another function In this case R0 generates two different lvars at the same address: * one modified by LDM * another that represents the return value from the tail call Another example: a third-party plugin makes a copy of an instruction. This may lead to the generation of two variables at the same address. Example 3: fictional addresses can be used for new instructions created while modifying the microcode. This function can be used to allocate a new unique address for a new instruction or a variable. The fictional address is selected from an unallocated address range. @param real_ea: real instruction address (BADADDR is ok too) @returns a unique fictional address
'mreg_t' alloc_kreg | ( | self, | |
'size_t' | size, | ||
bool | check_size = True ) |
Allocate a kernel register. @param size: size of the register in bytes @param check_size: if true, only the sizes that correspond to a size of a basic type will be accepted. @returns allocated register. mr_none means failure.
None alloc_lvars | ( | self | ) |
Allocate local variables. Must be called only immediately after optimize_global(), with no modifications to the microcode. Converts registers, stack variables, and similar operands into mop_l. This call will not fail because all necessary checks were performed in optimize_global(). After this call the microcode reaches its final state.
int analyze_calls | ( | self, | |
int | acflags ) |
Analyze calls and determine calling conventions. @param acflags: permitted actions that are necessary for successful detection of calling conventions. See Bits for analyze_calls() @returns number of calls. -1 means error.
'lvar_t &' arg | ( | self, | |
int | n ) |
Get input argument of the decompiled function. @param n: argument number (0..nargs-1)
int argbase | ( | self | ) |
bool argidx_ok | ( | self | ) |
bool argidx_sorted | ( | self | ) |
bool bad_call_sp_detected | ( | self | ) |
'merror_t' build_graph | ( | self | ) |
Build control flow graph. This function may be called only once. It calculates the type of each basic block and the adjacency list. optimize_local() calls this function if necessary. You need to call this function only before MMAT_LOCOPT. @returns error code
int calc_shins_flags | ( | self | ) |
bool callinfo_built | ( | self | ) |
bool chain_varnums_ok | ( | self | ) |
None clr_cdtr | ( | self | ) |
None clr_mba_flags | ( | self, | |
int | f ) |
None clr_mba_flags2 | ( | self, | |
int | f ) |
bool code16_bit_removed | ( | self | ) |
bool common_stkvars_stkargs | ( | self | ) |
Make a copy of a block. This function makes a simple copy of the block. It does not fix the predecessor and successor lists, they must be fixed if necessary. @param blk: block to copy @param new_serial: position of the copied block @param cpblk_flags: combination of Batch decompilation bits... bits @returns pointer to the new copy
'minsn_t *' create_helper_call | ( | self, | |
ida_idaapi.ea_t | ea, | ||
str | helper, | ||
'tinfo_t' | rettype = None, | ||
'mcallargs_t' | callargs = None, | ||
'mop_t' | out = None ) |
Create a call of a helper function. @param ea: The desired address of the instruction @param helper: The helper name @param rettype: The return type (nullptr or empty type means 'void') @param callargs: The helper arguments (nullptr-no arguments) @param out: The operand where the call result should be stored. If this argument is not nullptr, "mov helper_call(), out" will be generated. Otherwise "call helper()" will be generated. Note: the size of this operand must be equal to the RETTYPE size @returns pointer to the created instruction or nullptr if error
bool deleted_pairs | ( | self | ) |
|
static |
Deserialize a byte sequence into mbl array. @param bytes: pointer to the beginning of the byte sequence. @returns new mbl array
bool display_numaddrs | ( | self | ) |
bool display_valnums | ( | self | ) |
None dump | ( | self | ) |
Dump microcode to a file. The file will be created in the directory pointed by IDA_DUMPDIR envvar. Dump will be created only if IDA is run under debugger.
None dump_mba | ( | self, | |
bool | _verify, | ||
str | title ) |
'mop_t *' find_mop | ( | self, | |
'op_parent_info_t' | ctx, | ||
ida_idaapi.ea_t | ea, | ||
bool | is_dest, | ||
'mlist_t' | list ) |
Find an operand in the microcode. This function tries to find the operand that matches LIST. Any operand that overlaps with LIST is considered as a match. @param ctx: context information for the result @param ea: desired address of the operand. BADADDR means to accept any address. @param is_dest: search for destination operand? this argument may be ignored if the exact match could not be found @param list: list of locations the correspond to the operand @returns pointer to the operand or nullptr.
int for_all_insns | ( | self, | |
'minsn_visitor_t' | mv ) |
Visit all instructions. This function visits all instruction and subinstructions. @param mv: instruction visitor @returns non-zero value returned by mv.visit_mop() or zero
int for_all_ops | ( | self, | |
'mop_visitor_t' | mv ) |
Visit all operands of all instructions. @param mv: operand visitor @returns non-zero value returned by mv.visit_mop() or zero
int for_all_topinsns | ( | self, | |
'minsn_visitor_t' | mv ) |
Visit all top level instructions. @param mv: instruction visitor @returns non-zero value returned by mv.visit_mop() or zero
None free_kreg | ( | self, | |
'mreg_t' | reg, | ||
'size_t' | size ) |
Free a kernel register. If wrong arguments are passed, this function will generate an internal error. @param reg: a previously allocated kernel register @param size: size of the register in bytes
bool generated_asserts | ( | self | ) |
'ivl_t const &' get_args_region | ( | self | ) |
'func_t *' get_curfunc | ( | self | ) |
None get_func_output_lists | ( | self, | |
* | args ) |
Prepare the lists of registers & memory that are defined/killed by a function @param return_regs: defined regs to return (eax,edx) @param spoiled: spoiled regs (flags,ecx,mem) @param type: the function type @param call_ea: the call insn address (if known) @param tail_call: is it the tail call?
'mbl_graph_t *' get_graph | ( | self | ) |
Get control graph. Call build_graph() if you need the graph before MMAT_LOCOPT.
'argloc_t' get_ida_argloc | ( | self, | |
'lvar_t' | v ) |
'ivl_t const &' get_lvars_region | ( | self | ) |
int get_mba_flags | ( | self | ) |
int get_mba_flags2 | ( | self | ) |
'mblock_t *' get_mblock | ( | self, | |
'uint' | n ) |
Get basic block by its serial number.
'ivl_t const &' get_shadow_region | ( | self | ) |
'ivl_t' get_stack_region | ( | self | ) |
'ivl_t const &' get_std_region | ( | self, | |
'memreg_index_t' | idx ) |
Get information about various memory regions. We map the stack frame to the global memory, to some unused range.
bool graph_insns | ( | self | ) |
bool has_bad_sp | ( | self | ) |
bool has_outlines | ( | self | ) |
bool has_over_chains | ( | self | ) |
bool has_passregs | ( | self | ) |
bool has_stack_retval | ( | self | ) |
'vdloc_t' idaloc2vd | ( | self, | |
'argloc_t' | loc, | ||
int | width ) |
'merror_t' inline_func | ( | self, | |
'codegen_t' | cdg, | ||
int | blknum, | ||
'mba_ranges_t' | ranges, | ||
int | decomp_flags = 0, | ||
int | inline_flags = 0 ) |
Inline a range. Currently only functions are supported, not arbitrary ranges. This function may be called only during the initial microcode generation phase. @param cdg: the codegenerator object @param blknum: the block contaning the call/jump instruction to inline @param ranges: the set of ranges to inline @param decomp_flags: combination of decompile() flags bits @param inline_flags: combination of inline_func() flags bits @returns error code
'mblock_t *' insert_block | ( | self, | |
int | bblk ) |
Insert a block in the middle of the mbl array. The very first block of microcode must be empty, it is the entry block. The very last block of microcode must be BLT_STOP, it is the exit block. Therefore inserting a new block before the entry point or after the exit block is not a good idea. @param bblk: the new block will be inserted before BBLK @returns ptr to the new block
bool is_cdtr | ( | self | ) |
bool is_ctr | ( | self | ) |
bool is_dtr | ( | self | ) |
bool is_pattern | ( | self | ) |
bool is_snippet | ( | self | ) |
bool is_stkarg | ( | self, | |
'lvar_t' | v ) |
bool is_thunk | ( | self | ) |
bool loaded_gdl | ( | self | ) |
'stkpnt_t const *' locate_stkpnt | ( | self, | |
ida_idaapi.ea_t | ea ) |
bool lvar_names_ok | ( | self | ) |
bool lvars_allocated | ( | self | ) |
bool lvars_renamed | ( | self | ) |
ida_idaapi.ea_t map_fict_ea | ( | self, | |
ida_idaapi.ea_t | fict_ea ) |
Resolve a fictional address. This function provides a reverse of the mapping made by alloc_fict_ea(). @param fict_ea: fictional definition address @returns the real instruction address
None mark_chains_dirty | ( | self | ) |
Mark the microcode use-def chains dirty. Call this function is any inter-block data dependencies got changed because of your modifications to the microcode. Failing to do so may cause an internal error.
bool may_refine_rettype | ( | self | ) |
bool merge_blocks | ( | self | ) |
Merge blocks. This function merges blocks constituting linear flow. It calls remove_empty_and_unreachable_blocks() as well. @returns true if changed any blocks
'merror_t' optimize_global | ( | self | ) |
Optimize microcode globally. This function applies various optimization methods until we reach the fixed point. After that it preallocates lvars unless reqmat forbids it. @returns error code
int optimize_local | ( | self, | |
int | locopt_bits ) |
Optimize each basic block locally @param locopt_bits: combination of Bits for optimize_local() bits @returns number of changes. 0 means nothing changed This function is called by the decompiler, usually there is no need to call it explicitly.
bool optimized | ( | self | ) |
bool precise_defeas | ( | self | ) |
bool prop_complex | ( | self | ) |
bool propagated_asserts | ( | self | ) |
bool really_alloc | ( | self | ) |
bool regargs_is_not_aligned | ( | self | ) |
bool remove_block | ( | self, | |
'mblock_t' | blk ) |
Delete a block. @param blk: block to delete @returns true if at least one of the other blocks became empty or unreachable
bool remove_blocks | ( | self, | |
int | start_blk, | ||
int | end_blk ) |
bool remove_empty_and_unreachable_blocks | ( | self | ) |
Delete all empty and unreachable blocks. Blocks marked with MBL_KEEP won't be deleted.
bool returns_fpval | ( | self | ) |
bool rtype_refined | ( | self | ) |
None save_snapshot | ( | self, | |
str | description ) |
Create and save microcode snapshot.
bool saverest_done | ( | self | ) |
None serialize | ( | self | ) |
Serialize mbl array into a sequence of bytes.
bool set_lvar_name | ( | self, | |
'lvar_t' | v, | ||
str | name, | ||
int | flagbits ) |
bool set_maturity | ( | self, | |
'mba_maturity_t' | mat ) |
Set maturity level. @param mat: new maturity level @returns true if it is time to stop analysis Plugins may use this function to skip some parts of the analysis. The maturity level cannot be decreased.
None set_mba_flags | ( | self, | |
int | f ) |
None set_mba_flags2 | ( | self, | |
int | f ) |
bool set_nice_lvar_name | ( | self, | |
'lvar_t' | v, | ||
str | name ) |
bool set_user_lvar_name | ( | self, | |
'lvar_t' | v, | ||
str | name ) |
bool short_display | ( | self | ) |
bool should_beautify | ( | self | ) |
bool show_reduction | ( | self | ) |
Split a block: insert a new one after the block, move some instructions to new block @param blk: block to be split @param start_insn: all instructions to be moved to new block: starting with this one up to the end @returns ptr to the new block
int stkoff_ida2vd | ( | self, | |
int | off ) |
int stkoff_vd2ida | ( | self, | |
int | off ) |
None term | ( | self | ) |
bool use_frame | ( | self | ) |
bool use_wingraph32 | ( | self | ) |
bool valranges_done | ( | self | ) |
'argloc_t' vd2idaloc | ( | self, | |
* | args ) |
This function has the following signatures: 0. vd2idaloc(loc: const vdloc_t &, width: int) -> argloc_t 1. vd2idaloc(loc: const vdloc_t &, width: int, spd: int) -> argloc_t # 0: vd2idaloc(loc: const vdloc_t &, width: int) -> argloc_t # 1: vd2idaloc(loc: const vdloc_t &, width: int, spd: int) -> argloc_t
None verify | ( | self, | |
bool | always ) |
Verify microcode consistency. @param always: if false, the check will be performed only if ida runs under debugger If any inconsistency is discovered, an internal error will be generated. We strongly recommend you to call this function before returing control to the decompiler from your callbacks, in the case if you modified the microcode. If the microcode is inconsistent, this function will generate an internal error. We provide the source code of this function in the plugins/hexrays_sdk/verifier directory for your reference.
bool write_to_const_detected | ( | self | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |