Latest available version: IDA and decompilers v8.4.240320sp1 see all releases
Hex-Rays logo State-of-the-art binary code analysis tools
email icon

Micro block array (internal representation of the decompiled code). More...

#include <hexrays.hpp>

Public Member Functions

bool precise_defeas () const
 
bool optimized () const
 
bool short_display () const
 
bool show_reduction () const
 
bool graph_insns () const
 
bool loaded_gdl () const
 
bool should_beautify () const
 
bool rtype_refined () const
 
bool may_refine_rettype () const
 
bool use_wingraph32 () const
 
bool display_numaddrs () const
 
bool display_valnums () const
 
bool is_pattern () const
 
bool is_thunk () const
 
bool saverest_done () const
 
bool callinfo_built () const
 
bool really_alloc () const
 
bool lvars_allocated () const
 
bool chain_varnums_ok () const
 
bool returns_fpval () const
 
bool has_passregs () const
 
bool generated_asserts () const
 
bool propagated_asserts () const
 
bool deleted_pairs () const
 
bool common_stkvars_stkargs () const
 
bool lvar_names_ok () const
 
bool lvars_renamed () const
 
bool has_over_chains () const
 
bool valranges_done () const
 
bool argidx_ok () const
 
bool argidx_sorted () const
 
bool code16_bit_removed () const
 
bool has_stack_retval () const
 
bool has_outlines () const
 
bool is_ctr () const
 
bool is_dtr () const
 
bool is_cdtr () const
 
bool prop_complex () const
 
int get_mba_flags () const
 
int get_mba_flags2 () const
 
void set_mba_flags (int f)
 
void clr_mba_flags (int f)
 
void set_mba_flags2 (int f)
 
void clr_mba_flags2 (int f)
 
void clr_cdtr ()
 
int calc_shins_flags () const
 
sval_t stkoff_vd2ida (sval_t off) const
 
sval_t stkoff_ida2vd (sval_t off) const
 
sval_t argbase () const
 
vdloc_t idaloc2vd (const argloc_t &loc, int width) const
 
argloc_t vd2idaloc (const vdloc_t &loc, int width) const
 
bool is_stkarg (const lvar_t &v) const
 
member_t * get_stkvar (sval_t vd_stkoff, uval_t *poff) const
 
argloc_t get_ida_argloc (const lvar_t &v) const
 
bool write_to_const_detected () const
 
bool bad_call_sp_detected () const
 
bool regargs_is_not_aligned () const
 
bool has_bad_sp () const
 
void term ()
 
func_t * get_curfunc () const
 
bool use_frame () const
 
bool range_contains (ea_t ea) const
 
bool is_snippet () const
 
bool set_maturity (mba_maturity_t mat)
 Set maturity level. More...
 
int optimize_local (int locopt_bits)
 Optimize each basic block locally. More...
 
merror_t build_graph ()
 Build control flow graph. More...
 
mbl_graph_tget_graph ()
 Get control graph. More...
 
int analyze_calls (int acflags)
 Analyze calls and determine calling conventions. More...
 
merror_t optimize_global ()
 Optimize microcode globally. More...
 
void alloc_lvars ()
 Allocate local variables. More...
 
void dump () const
 Dump microcode to a file. More...
 
void vdump_mba (bool _verify, const char *title, va_list va) const
 
void dump_mba (bool _verify, const char *title,...) const
 
void print (vd_printer_t &vp) const
 Print microcode to any destination. More...
 
void verify (bool always) const
 Verify microcode consistency. More...
 
void mark_chains_dirty ()
 Mark the microcode use-def chains dirty. More...
 
const mblock_tget_mblock (int n) const
 Get basic block by its serial number. More...
 
mblock_tget_mblock (int n)
 
mblock_tinsert_block (int bblk)
 Insert a block in the middle of the mbl array. More...
 
bool remove_block (mblock_t *blk)
 Delete a block. More...
 
mblock_tcopy_block (mblock_t *blk, int new_serial, int cpblk_flags=3)
 Make a copy of a block. More...
 
bool remove_empty_and_unreachable_blocks ()
 Delete all empty and unreachable blocks. More...
 
bool combine_blocks ()
 Combine blocks. More...
 
int for_all_ops (mop_visitor_t &mv)
 Visit all operands of all instructions. More...
 
int for_all_insns (minsn_visitor_t &mv)
 Visit all instructions. More...
 
int for_all_topinsns (minsn_visitor_t &mv)
 Visit all top level instructions. More...
 
mop_tfind_mop (op_parent_info_t *ctx, ea_t ea, bool is_dest, const mlist_t &list)
 Find an operand in the microcode. More...
 
minsn_tcreate_helper_call (ea_t ea, const char *helper, const tinfo_t *rettype=nullptr, const mcallargs_t *callargs=nullptr, const mop_t *out=nullptr)
 Create a call of a helper function. More...
 
void get_func_output_lists (mlist_t *return_regs, mlist_t *spoiled, const tinfo_t &type, ea_t call_ea=BADADDR, bool tail_call=false)
 Prepare the lists of registers & memory that are defined/killed by a function. More...
 
lvar_targ (int n)
 Get input argument of the decompiled function. More...
 
const lvar_targ (int n) const
 
ea_t alloc_fict_ea (ea_t real_ea)
 Allocate a fictional address. More...
 
ea_t map_fict_ea (ea_t fict_ea) const
 Resolve a fictional address. More...
 
const ivl_tget_std_region (memreg_index_t idx) const
 Get information about various memory regions. More...
 
const ivl_tget_lvars_region () const
 
const ivl_tget_shadow_region () const
 
const ivl_tget_args_region () const
 
ivl_t get_stack_region () const
 
void serialize (bytevec_t &vout) const
 Serialize mbl array into a sequence of bytes. More...
 
void save_snapshot (const char *description)
 Create and save microcode snapshot. More...
 
mreg_t alloc_kreg (size_t size, bool check_size=true)
 Allocate a kernel register. More...
 
void free_kreg (mreg_t reg, size_t size)
 Free a kernel register. More...
 
bool set_lvar_name (lvar_t &v, const char *name, int flagbits)
 
bool set_nice_lvar_name (lvar_t &v, const char *name)
 
bool set_user_lvar_name (lvar_t &v, const char *name)
 

Static Public Member Functions

static vdloc_t idaloc2vd (const argloc_t &loc, int width, sval_t spd)
 
static argloc_t vd2idaloc (const vdloc_t &loc, int width, sval_t spd)
 
static WARN_UNUSED_RESULT mba_tdeserialize (const uchar *bytes, size_t nbytes)
 Deserialize a byte sequence into mbl array. More...
 

Public Attributes

mba_ranges_t mbr
 
ea_t entry_ea = BADADDR
 
ea_t last_prolog_ea = BADADDR
 
ea_t first_epilog_ea = BADADDR
 
int qty = 0
 number of basic blocks More...
 
int npurged = -1
 -1 - unknown More...
 
cm_t cc = CM_CC_UNKNOWN
 calling convention More...
 
sval_t tmpstk_size = 0
 size of the temporary stack part (which dynamically changes with push/pops) More...
 
sval_t frsize = 0
 size of local stkvars range in the stack frame More...
 
sval_t frregs = 0
 size of saved registers range in the stack frame More...
 
sval_t fpd = 0
 frame pointer delta More...
 
int pfn_flags = 0
 copy of func_t::flags More...
 
int retsize = 0
 size of return address in the stack frame More...
 
int shadow_args = 0
 size of shadow argument area More...
 
sval_t fullsize = 0
 Full stack size including incoming args. More...
 
sval_t stacksize = 0
 The maximal size of the function stack including bytes allocated for outgoing call arguments (up to retaddr) More...
 
sval_t inargoff = 0
 offset of the first stack argument; after fix_scattered_movs() INARGOFF may be less than STACKSIZE More...
 
sval_t minstkref = 0
 The lowest stack location whose address was taken. More...
 
ea_t minstkref_ea = BADADDR
 address with lowest minstkref (for debugging) More...
 
sval_t minargref = 0
 The lowest stack argument location whose address was taken This location and locations above it can be aliased It controls locations >= inargoff-shadow_args. More...
 
sval_t spd_adjust = 0
 If sp>0, the max positive sp value. More...
 
ivl_t aliased_vars = ivl_t(0, 0)
 Aliased stkvar locations. More...
 
ivl_t aliased_args = ivl_t(0, 0)
 Aliased stkarg locations. More...
 
ivlset_t gotoff_stkvars
 stkvars that hold .got offsets. considered to be unaliasable More...
 
ivlset_t restricted_memory
 
ivlset_t aliased_memory = ALLMEM
 aliased_memory+restricted_memory=ALLMEM More...
 
mlist_t nodel_memory
 global dead elimination may not delete references to this area More...
 
rlist_t consumed_argregs
 registers converted into stack arguments, should not be used as arguments More...
 
mba_maturity_t maturity = MMAT_ZERO
 current maturity level More...
 
mba_maturity_t reqmat = MMAT_ZERO
 required maturity level More...
 
bool final_type = false
 is the function type final? (specified by the user) More...
 
tinfo_t idb_type
 function type as retrieved from the database More...
 
reginfovec_t idb_spoiled
 MBA_SPLINFO && final_type: info in ida format. More...
 
mlist_t spoiled_list
 MBA_SPLINFO && !final_type: info in vd format. More...
 
int fti_flags = 0
 FTI_... constants for the current function. More...
 
netnode deprecated_idb_node
 netnode with additional decompiler info. More...
 
qstring label
 name of the function or pattern (colored) More...
 
lvars_t vars
 local variables More...
 
intvec_t argidx
 input arguments (indexes into 'vars') More...
 
int retvaridx = -1
 index of variable holding the return value -1 means none More...
 
ea_t error_ea = BADADDR
 during microcode generation holds ins.ea More...
 
qstring error_strarg
 
mblock_tblocks = nullptr
 double linked list of blocks More...
 
mblock_t ** natural = nullptr
 natural order of blocks More...
 
ivl_with_name_t std_ivls [6]
 we treat memory as consisting of 6 parts see memreg_index_t More...
 
hexwarns_t notes
 
uchar occurred_warns [32]
 
char reserved []
 

Detailed Description

Micro block array (internal representation of the decompiled code).

Array of micro blocks representing microcode for a decompiled function.

Intermediate representation of the decompiled function. The details of this class are not public yet because it will be modified in the near future. We plan to disclose them after porting the decompiler to ARM.

The first micro block is the entry point, the last one is the exit point. The entry and exit blocks are always empty. The exit block is generated at MMAT_LOCOPT maturity level.

Examples
hexrays_sample11.cpp, hexrays_sample12.cpp, hexrays_sample13.cpp, hexrays_sample15.cpp, hexrays_sample18.cpp, and hexrays_sample9.cpp.

Definition at line 59 of file hexrays.dox.

Constructor & Destructor Documentation

◆ ~mba_t()

mba_t::~mba_t ( )

Definition at line 4753 of file hexrays.hpp.

Member Function Documentation

◆ alloc_fict_ea()

ea_t mba_t::alloc_fict_ea ( 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.
    Parameters
    real_eareal instruction address (BADADDR is ok too)
    Returns
    a unique fictional address

Definition at line 11417 of file hexrays.hpp.

◆ alloc_kreg()

mreg_t mba_t::alloc_kreg ( size_t  size,
bool  check_size = true 
)

Allocate a kernel register.

Parameters
sizesize of the register in bytes
check_sizeif true, only the sizes that correspond to a size of a basic type will be accepted.
Returns
allocated register. mr_none means failure.

Definition at line 11451 of file hexrays.hpp.

◆ alloc_lvars()

void mba_t::alloc_lvars ( )

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.

Definition at line 11309 of file hexrays.hpp.

◆ analyze_calls()

int mba_t::analyze_calls ( int  acflags)

Analyze calls and determine calling conventions.

Parameters
acflagspermitted actions that are necessary for successful detection of calling conventions. See Bits for analyze_calls()
Returns
number of calls. -1 means error.
Examples
hexrays_sample12.cpp.

Definition at line 11297 of file hexrays.hpp.

◆ arg() [1/2]

lvar_t & mba_t::arg ( int  n)

Get input argument of the decompiled function.

Parameters
nargument number (0..nargs-1)

Definition at line 11411 of file hexrays.hpp.

◆ arg() [2/2]

const lvar_t & mba_t::arg ( int  n) const

Definition at line 4961 of file hexrays.hpp.

◆ argbase()

sval_t mba_t::argbase ( ) const

Definition at line 4645 of file hexrays.hpp.

◆ argidx_ok()

bool mba_t::argidx_ok ( ) const

Definition at line 4572 of file hexrays.hpp.

◆ argidx_sorted()

bool mba_t::argidx_sorted ( ) const

Definition at line 4573 of file hexrays.hpp.

◆ bad_call_sp_detected()

bool mba_t::bad_call_sp_detected ( ) const

Definition at line 4737 of file hexrays.hpp.

◆ build_graph()

merror_t mba_t::build_graph ( )

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
Examples
hexrays_sample12.cpp.

Definition at line 11285 of file hexrays.hpp.

◆ calc_shins_flags()

int mba_t::calc_shins_flags ( ) const

Definition at line 4588 of file hexrays.hpp.

◆ callinfo_built()

bool mba_t::callinfo_built ( ) const

Definition at line 4558 of file hexrays.hpp.

◆ chain_varnums_ok()

bool mba_t::chain_varnums_ok ( ) const

Definition at line 4561 of file hexrays.hpp.

◆ clr_cdtr()

void mba_t::clr_cdtr ( )

Definition at line 4587 of file hexrays.hpp.

◆ clr_mba_flags()

void mba_t::clr_mba_flags ( int  f)

Definition at line 4584 of file hexrays.hpp.

◆ clr_mba_flags2()

void mba_t::clr_mba_flags2 ( int  f)

Definition at line 4586 of file hexrays.hpp.

◆ code16_bit_removed()

bool mba_t::code16_bit_removed ( ) const

Definition at line 4574 of file hexrays.hpp.

◆ combine_blocks()

bool mba_t::combine_blocks ( )

Combine blocks.

This function merges blocks constituting linear flow. It calls remove_empty_and_unreachable_blocks() as well.

Returns
true if changed any blocks

Definition at line 11369 of file hexrays.hpp.

◆ common_stkvars_stkargs()

bool mba_t::common_stkvars_stkargs ( ) const

Definition at line 4567 of file hexrays.hpp.

◆ copy_block()

mblock_t * mba_t::copy_block ( mblock_t blk,
int  new_serial,
int  cpblk_flags = 3 
)

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.

Parameters
blkblock to copy
new_serialposition of the copied block
cpblk_flagscombination of Batch decompilation bits... bits
Returns
pointer to the new copy

Definition at line 11357 of file hexrays.hpp.

◆ create_helper_call()

minsn_t * mba_t::create_helper_call ( ea_t  ea,
const char *  helper,
const tinfo_t *  rettype = nullptr,
const mcallargs_t *  callargs = nullptr,
const mop_t out = nullptr 
)

Create a call of a helper function.

Parameters
eaThe desired address of the instruction
helperThe helper name
rettypeThe return type (nullptr or empty type means 'void')
callargsThe helper arguments (nullptr-no arguments)
outThe 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

Definition at line 11399 of file hexrays.hpp.

◆ deleted_pairs()

bool mba_t::deleted_pairs ( ) const

Definition at line 4566 of file hexrays.hpp.

◆ deserialize()

WARN_UNUSED_RESULT mba_t * mba_t::deserialize ( const uchar *  bytes,
size_t  nbytes 
)
static

Deserialize a byte sequence into mbl array.

Parameters
bytespointer to the beginning of the byte sequence.
nbytesnumber of bytes in the byte sequence.
Returns
new mbl array

Definition at line 11439 of file hexrays.hpp.

◆ display_numaddrs()

bool mba_t::display_numaddrs ( ) const

Definition at line 4553 of file hexrays.hpp.

◆ display_valnums()

bool mba_t::display_valnums ( ) const

Definition at line 4554 of file hexrays.hpp.

◆ dump()

void mba_t::dump ( ) const

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.

Examples
hexrays_sample18.cpp.

Definition at line 11315 of file hexrays.hpp.

◆ dump_mba()

void mba_t::dump_mba ( bool  _verify,
const char *  title,
  ... 
) const

Definition at line 4826 of file hexrays.hpp.

◆ find_mop()

mop_t * mba_t::find_mop ( op_parent_info_t ctx,
ea_t  ea,
bool  is_dest,
const 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.

Parameters
[out]ctxcontext information for the result
eadesired address of the operand. BADADDR means to accept any address.
is_destsearch for destination operand? this argument may be ignored if the exact match could not be found
listlist of locations the correspond to the operand
Returns
pointer to the operand or nullptr.
Examples
hexrays_sample12.cpp.

Definition at line 11393 of file hexrays.hpp.

◆ for_all_insns()

int mba_t::for_all_insns ( minsn_visitor_t mv)

Visit all instructions.

This function visits all instruction and subinstructions.

Parameters
mvinstruction visitor
Returns
non-zero value returned by mv.visit_mop() or zero

Definition at line 11381 of file hexrays.hpp.

◆ for_all_ops()

int mba_t::for_all_ops ( mop_visitor_t mv)

Visit all operands of all instructions.

Parameters
mvoperand visitor
Returns
non-zero value returned by mv.visit_mop() or zero

Definition at line 11375 of file hexrays.hpp.

◆ for_all_topinsns()

int mba_t::for_all_topinsns ( minsn_visitor_t mv)

Visit all top level instructions.

Parameters
mvinstruction visitor
Returns
non-zero value returned by mv.visit_mop() or zero
Examples
hexrays_sample15.cpp, and hexrays_sample18.cpp.

Definition at line 11387 of file hexrays.hpp.

◆ free_kreg()

void mba_t::free_kreg ( mreg_t  reg,
size_t  size 
)

Free a kernel register.

If wrong arguments are passed, this function will generate an internal error.

Parameters
rega previously allocated kernel register
sizesize of the register in bytes

Definition at line 11457 of file hexrays.hpp.

◆ generated_asserts()

bool mba_t::generated_asserts ( ) const

Definition at line 4564 of file hexrays.hpp.

◆ get_args_region()

const ivl_t & mba_t::get_args_region ( ) const

Definition at line 5350 of file hexrays.hpp.

◆ get_curfunc()

func_t * mba_t::get_curfunc ( ) const
Examples
hexrays_sample18.cpp.

Definition at line 11267 of file hexrays.hpp.

◆ get_func_output_lists()

void mba_t::get_func_output_lists ( mlist_t return_regs,
mlist_t spoiled,
const tinfo_t &  type,
ea_t  call_ea = BADADDR,
bool  tail_call = false 
)

Prepare the lists of registers & memory that are defined/killed by a function.

Parameters
[out]return_regsdefined regs to return (eax,edx)
[out]spoiledspoiled regs (flags,ecx,mem)
typethe function type
call_eathe call insn address (if known)
tail_callis it the tail call?

Definition at line 11405 of file hexrays.hpp.

◆ get_graph()

mbl_graph_t * mba_t::get_graph ( )

Get control graph.

Call build_graph() if you need the graph before MMAT_LOCOPT.

Examples
hexrays_sample12.cpp.

Definition at line 11291 of file hexrays.hpp.

◆ get_ida_argloc()

argloc_t mba_t::get_ida_argloc ( const lvar_t v) const

Definition at line 4661 of file hexrays.hpp.

◆ get_lvars_region()

const ivl_t & mba_t::get_lvars_region ( ) const

Definition at line 5340 of file hexrays.hpp.

◆ get_mba_flags()

int mba_t::get_mba_flags ( ) const

Definition at line 4581 of file hexrays.hpp.

◆ get_mba_flags2()

int mba_t::get_mba_flags2 ( ) const

Definition at line 4582 of file hexrays.hpp.

◆ get_mblock() [1/2]

mblock_t * mba_t::get_mblock ( int  n)

Definition at line 4857 of file hexrays.hpp.

◆ get_mblock() [2/2]

const mblock_t * mba_t::get_mblock ( int  n) const

Get basic block by its serial number.

Examples
hexrays_sample11.cpp, and hexrays_sample12.cpp.

Definition at line 4856 of file hexrays.hpp.

◆ get_shadow_region()

const ivl_t & mba_t::get_shadow_region ( ) const

Definition at line 5345 of file hexrays.hpp.

◆ get_stack_region()

ivl_t mba_t::get_stack_region ( ) const

Definition at line 5355 of file hexrays.hpp.

◆ get_std_region()

const ivl_t & mba_t::get_std_region ( memreg_index_t  idx) const

Get information about various memory regions.

We map the stack frame to the global memory, to some unused range.

Definition at line 5335 of file hexrays.hpp.

References std_ivls.

◆ graph_insns()

bool mba_t::graph_insns ( ) const

Definition at line 4547 of file hexrays.hpp.

◆ has_bad_sp()

bool mba_t::has_bad_sp ( ) const

Definition at line 4745 of file hexrays.hpp.

◆ has_outlines()

bool mba_t::has_outlines ( ) const

Definition at line 4576 of file hexrays.hpp.

◆ has_over_chains()

bool mba_t::has_over_chains ( ) const

Definition at line 4570 of file hexrays.hpp.

◆ has_passregs()

bool mba_t::has_passregs ( ) const

Definition at line 4563 of file hexrays.hpp.

◆ has_stack_retval()

bool mba_t::has_stack_retval ( ) const

Definition at line 4575 of file hexrays.hpp.

◆ idaloc2vd() [1/2]

vdloc_t mba_t::idaloc2vd ( const argloc_t &  loc,
int  width 
) const

Definition at line 11237 of file hexrays.hpp.

◆ idaloc2vd() [2/2]

vdloc_t mba_t::idaloc2vd ( const argloc_t &  loc,
int  width,
sval_t  spd 
)
static

Definition at line 11229 of file hexrays.hpp.

◆ insert_block()

mblock_t * mba_t::insert_block ( 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.

Parameters
bblkthe new block will be inserted before BBLK
Returns
ptr to the new block

Definition at line 11345 of file hexrays.hpp.

◆ is_cdtr()

bool mba_t::is_cdtr ( ) const

Definition at line 4579 of file hexrays.hpp.

◆ is_ctr()

bool mba_t::is_ctr ( ) const

Definition at line 4577 of file hexrays.hpp.

◆ is_dtr()

bool mba_t::is_dtr ( ) const

Definition at line 4578 of file hexrays.hpp.

◆ is_pattern()

bool mba_t::is_pattern ( ) const

Definition at line 4555 of file hexrays.hpp.

◆ is_snippet()

bool mba_t::is_snippet ( ) const

Definition at line 4759 of file hexrays.hpp.

◆ is_stkarg()

bool mba_t::is_stkarg ( const lvar_t v) const

Definition at line 4655 of file hexrays.hpp.

◆ is_thunk()

bool mba_t::is_thunk ( ) const

Definition at line 4556 of file hexrays.hpp.

◆ loaded_gdl()

bool mba_t::loaded_gdl ( ) const

Definition at line 4548 of file hexrays.hpp.

◆ lvar_names_ok()

bool mba_t::lvar_names_ok ( ) const

Definition at line 4568 of file hexrays.hpp.

◆ lvars_allocated()

bool mba_t::lvars_allocated ( ) const

Definition at line 4560 of file hexrays.hpp.

◆ lvars_renamed()

bool mba_t::lvars_renamed ( ) const

Definition at line 4569 of file hexrays.hpp.

◆ map_fict_ea()

ea_t mba_t::map_fict_ea ( ea_t  fict_ea) const

Resolve a fictional address.

This function provides a reverse of the mapping made by alloc_fict_ea().

Parameters
fict_eafictional definition address
Returns
the real instruction address

Definition at line 11425 of file hexrays.hpp.

◆ mark_chains_dirty()

void mba_t::mark_chains_dirty ( )

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.

Examples
hexrays_sample11.cpp.

Definition at line 11339 of file hexrays.hpp.

◆ may_refine_rettype()

bool mba_t::may_refine_rettype ( ) const

Definition at line 4551 of file hexrays.hpp.

◆ optimize_global()

merror_t mba_t::optimize_global ( )

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

Definition at line 11303 of file hexrays.hpp.

◆ optimize_local()

int mba_t::optimize_local ( int  locopt_bits)

Optimize each basic block locally.

Parameters
locopt_bitscombination 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.

Definition at line 11279 of file hexrays.hpp.

◆ optimized()

bool mba_t::optimized ( ) const

Definition at line 4544 of file hexrays.hpp.

◆ precise_defeas()

bool mba_t::precise_defeas ( ) const

Definition at line 4543 of file hexrays.hpp.

◆ print()

void mba_t::print ( vd_printer_t vp) const

Print microcode to any destination.

Parameters
vpprint sink
Examples
hexrays_sample13.cpp, and hexrays_sample9.cpp.

Definition at line 11327 of file hexrays.hpp.

◆ prop_complex()

bool mba_t::prop_complex ( ) const

Definition at line 4580 of file hexrays.hpp.

◆ propagated_asserts()

bool mba_t::propagated_asserts ( ) const

Definition at line 4565 of file hexrays.hpp.

◆ range_contains()

bool mba_t::range_contains ( ea_t  ea) const

Definition at line 4758 of file hexrays.hpp.

◆ really_alloc()

bool mba_t::really_alloc ( ) const

Definition at line 4559 of file hexrays.hpp.

◆ regargs_is_not_aligned()

bool mba_t::regargs_is_not_aligned ( ) const

Definition at line 4741 of file hexrays.hpp.

◆ remove_block()

bool mba_t::remove_block ( mblock_t blk)

Delete a block.

Parameters
blkblock to delete
Returns
true if at least one of the other blocks became empty or unreachable

Definition at line 11351 of file hexrays.hpp.

◆ remove_empty_and_unreachable_blocks()

bool mba_t::remove_empty_and_unreachable_blocks ( )

Delete all empty and unreachable blocks.

Blocks marked with MBL_KEEP won't be deleted.

Definition at line 11363 of file hexrays.hpp.

◆ returns_fpval()

bool mba_t::returns_fpval ( ) const

Definition at line 4562 of file hexrays.hpp.

◆ rtype_refined()

bool mba_t::rtype_refined ( ) const

Definition at line 4550 of file hexrays.hpp.

◆ save_snapshot()

void mba_t::save_snapshot ( const char *  description)

Create and save microcode snapshot.

Definition at line 11445 of file hexrays.hpp.

◆ saverest_done()

bool mba_t::saverest_done ( ) const

Definition at line 4557 of file hexrays.hpp.

◆ serialize()

void mba_t::serialize ( bytevec_t &  vout) const

Serialize mbl array into a sequence of bytes.

Definition at line 11433 of file hexrays.hpp.

◆ set_lvar_name()

bool mba_t::set_lvar_name ( lvar_t v,
const char *  name,
int  flagbits 
)

Definition at line 11463 of file hexrays.hpp.

◆ set_maturity()

bool mba_t::set_maturity ( mba_maturity_t  mat)

Set maturity level.

Parameters
matnew 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.

Definition at line 11273 of file hexrays.hpp.

◆ set_mba_flags()

void mba_t::set_mba_flags ( int  f)

Definition at line 4583 of file hexrays.hpp.

◆ set_mba_flags2()

void mba_t::set_mba_flags2 ( int  f)

Definition at line 4585 of file hexrays.hpp.

◆ set_nice_lvar_name()

bool mba_t::set_nice_lvar_name ( lvar_t v,
const char *  name 
)

Definition at line 5024 of file hexrays.hpp.

◆ set_user_lvar_name()

bool mba_t::set_user_lvar_name ( lvar_t v,
const char *  name 
)

Definition at line 5025 of file hexrays.hpp.

◆ short_display()

bool mba_t::short_display ( ) const

Definition at line 4545 of file hexrays.hpp.

◆ should_beautify()

bool mba_t::should_beautify ( ) const

Definition at line 4549 of file hexrays.hpp.

◆ show_reduction()

bool mba_t::show_reduction ( ) const

Definition at line 4546 of file hexrays.hpp.

◆ stkoff_ida2vd()

sval_t mba_t::stkoff_ida2vd ( sval_t  off) const

Definition at line 11221 of file hexrays.hpp.

◆ stkoff_vd2ida()

sval_t mba_t::stkoff_vd2ida ( sval_t  off) const

Definition at line 11213 of file hexrays.hpp.

◆ term()

void mba_t::term ( )

Definition at line 11261 of file hexrays.hpp.

◆ use_frame()

bool mba_t::use_frame ( ) const

Definition at line 4757 of file hexrays.hpp.

◆ use_wingraph32()

bool mba_t::use_wingraph32 ( ) const

Definition at line 4552 of file hexrays.hpp.

◆ valranges_done()

bool mba_t::valranges_done ( ) const

Definition at line 4571 of file hexrays.hpp.

◆ vd2idaloc() [1/2]

argloc_t mba_t::vd2idaloc ( const vdloc_t loc,
int  width 
) const

Definition at line 11253 of file hexrays.hpp.

◆ vd2idaloc() [2/2]

argloc_t mba_t::vd2idaloc ( const vdloc_t loc,
int  width,
sval_t  spd 
)
static

Definition at line 11245 of file hexrays.hpp.

◆ vdump_mba()

void mba_t::vdump_mba ( bool  _verify,
const char *  title,
va_list  va 
) const

Definition at line 11321 of file hexrays.hpp.

◆ verify()

void mba_t::verify ( bool  always) const

Verify microcode consistency.

Parameters
alwaysif 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.
Examples
hexrays_sample11.cpp, and hexrays_sample18.cpp.

Definition at line 11333 of file hexrays.hpp.

◆ write_to_const_detected()

bool mba_t::write_to_const_detected ( ) const

Definition at line 4733 of file hexrays.hpp.

Member Data Documentation

◆ aliased_args

ivl_t mba_t::aliased_args = ivl_t(0, 0)

Aliased stkarg locations.

Definition at line 4694 of file hexrays.hpp.

◆ aliased_memory

ivlset_t mba_t::aliased_memory = ALLMEM

aliased_memory+restricted_memory=ALLMEM

Definition at line 4697 of file hexrays.hpp.

◆ aliased_vars

ivl_t mba_t::aliased_vars = ivl_t(0, 0)

Aliased stkvar locations.

Definition at line 4693 of file hexrays.hpp.

◆ argidx

intvec_t mba_t::argidx

input arguments (indexes into 'vars')

Definition at line 4717 of file hexrays.hpp.

◆ blocks

mblock_t* mba_t::blocks = nullptr

double linked list of blocks

Definition at line 4724 of file hexrays.hpp.

◆ cc

cm_t mba_t::cc = CM_CC_UNKNOWN

calling convention

Definition at line 4671 of file hexrays.hpp.

◆ consumed_argregs

rlist_t mba_t::consumed_argregs

registers converted into stack arguments, should not be used as arguments

Definition at line 4699 of file hexrays.hpp.

◆ deprecated_idb_node

netnode mba_t::deprecated_idb_node

netnode with additional decompiler info.

deprecated, do not use it anymore. it may get stale after undo.

Definition at line 4710 of file hexrays.hpp.

◆ entry_ea

ea_t mba_t::entry_ea = BADADDR

Definition at line 4666 of file hexrays.hpp.

◆ error_ea

ea_t mba_t::error_ea = BADADDR

during microcode generation holds ins.ea

Definition at line 4721 of file hexrays.hpp.

◆ error_strarg

qstring mba_t::error_strarg

Definition at line 4722 of file hexrays.hpp.

◆ final_type

bool mba_t::final_type = false

is the function type final? (specified by the user)

Definition at line 4704 of file hexrays.hpp.

◆ first_epilog_ea

ea_t mba_t::first_epilog_ea = BADADDR

Definition at line 4668 of file hexrays.hpp.

◆ fpd

sval_t mba_t::fpd = 0

frame pointer delta

Definition at line 4676 of file hexrays.hpp.

◆ frregs

sval_t mba_t::frregs = 0

size of saved registers range in the stack frame

Definition at line 4675 of file hexrays.hpp.

◆ frsize

sval_t mba_t::frsize = 0

size of local stkvars range in the stack frame

Definition at line 4674 of file hexrays.hpp.

◆ fti_flags

int mba_t::fti_flags = 0

FTI_... constants for the current function.

Definition at line 4708 of file hexrays.hpp.

◆ fullsize

sval_t mba_t::fullsize = 0

Full stack size including incoming args.

Definition at line 4680 of file hexrays.hpp.

◆ gotoff_stkvars

ivlset_t mba_t::gotoff_stkvars

stkvars that hold .got offsets. considered to be unaliasable

Definition at line 4695 of file hexrays.hpp.

◆ idb_spoiled

reginfovec_t mba_t::idb_spoiled

MBA_SPLINFO && final_type: info in ida format.

Definition at line 4706 of file hexrays.hpp.

◆ idb_type

tinfo_t mba_t::idb_type

function type as retrieved from the database

Definition at line 4705 of file hexrays.hpp.

◆ inargoff

sval_t mba_t::inargoff = 0

offset of the first stack argument; after fix_scattered_movs() INARGOFF may be less than STACKSIZE

Definition at line 4684 of file hexrays.hpp.

◆ label

qstring mba_t::label

name of the function or pattern (colored)

Definition at line 4715 of file hexrays.hpp.

◆ last_prolog_ea

ea_t mba_t::last_prolog_ea = BADADDR

Definition at line 4667 of file hexrays.hpp.

◆ maturity

mba_maturity_t mba_t::maturity = MMAT_ZERO

current maturity level

Definition at line 4701 of file hexrays.hpp.

◆ mbr

mba_ranges_t mba_t::mbr

Definition at line 4665 of file hexrays.hpp.

◆ minargref

sval_t mba_t::minargref = 0

The lowest stack argument location whose address was taken This location and locations above it can be aliased It controls locations >= inargoff-shadow_args.

Definition at line 4689 of file hexrays.hpp.

◆ minstkref

sval_t mba_t::minstkref = 0

The lowest stack location whose address was taken.

Definition at line 4687 of file hexrays.hpp.

◆ minstkref_ea

ea_t mba_t::minstkref_ea = BADADDR

address with lowest minstkref (for debugging)

Definition at line 4688 of file hexrays.hpp.

◆ natural

mblock_t** mba_t::natural = nullptr

natural order of blocks

Definition at line 4725 of file hexrays.hpp.

◆ nodel_memory

mlist_t mba_t::nodel_memory

global dead elimination may not delete references to this area

Definition at line 4698 of file hexrays.hpp.

◆ notes

hexwarns_t mba_t::notes
mutable

Definition at line 4730 of file hexrays.hpp.

◆ npurged

int mba_t::npurged = -1

-1 - unknown

Definition at line 4670 of file hexrays.hpp.

◆ occurred_warns

uchar mba_t::occurred_warns[32]
mutable

Definition at line 4731 of file hexrays.hpp.

◆ pfn_flags

int mba_t::pfn_flags = 0

copy of func_t::flags

Definition at line 4677 of file hexrays.hpp.

◆ qty

int mba_t::qty = 0

number of basic blocks

Definition at line 4669 of file hexrays.hpp.

◆ reqmat

mba_maturity_t mba_t::reqmat = MMAT_ZERO

required maturity level

Definition at line 4702 of file hexrays.hpp.

◆ reserved

char mba_t::reserved[]

Definition at line 4751 of file hexrays.hpp.

◆ restricted_memory

ivlset_t mba_t::restricted_memory

Definition at line 4696 of file hexrays.hpp.

◆ retsize

int mba_t::retsize = 0

size of return address in the stack frame

Definition at line 4678 of file hexrays.hpp.

◆ retvaridx

int mba_t::retvaridx = -1

index of variable holding the return value -1 means none

Definition at line 4718 of file hexrays.hpp.

◆ shadow_args

int mba_t::shadow_args = 0

size of shadow argument area

Definition at line 4679 of file hexrays.hpp.

◆ spd_adjust

sval_t mba_t::spd_adjust = 0

If sp>0, the max positive sp value.

Definition at line 4692 of file hexrays.hpp.

◆ spoiled_list

mlist_t mba_t::spoiled_list

MBA_SPLINFO && !final_type: info in vd format.

Definition at line 4707 of file hexrays.hpp.

◆ stacksize

sval_t mba_t::stacksize = 0

The maximal size of the function stack including bytes allocated for outgoing call arguments (up to retaddr)

Definition at line 4681 of file hexrays.hpp.

◆ std_ivls

ivl_with_name_t mba_t::std_ivls[6]

we treat memory as consisting of 6 parts see memreg_index_t

Definition at line 4727 of file hexrays.hpp.

Referenced by get_std_region().

◆ tmpstk_size

sval_t mba_t::tmpstk_size = 0

size of the temporary stack part (which dynamically changes with push/pops)

Definition at line 4672 of file hexrays.hpp.

◆ vars

lvars_t mba_t::vars

local variables

Definition at line 4716 of file hexrays.hpp.