Micro block array (internal representation of the decompiled code). More...
#include <hexrays.hpp>
Public Member Functions | |
bool | precise_defeas (void) const |
bool | optimized (void) const |
bool | short_display (void) const |
bool | show_reduction (void) const |
bool | graph_insns (void) const |
bool | loaded_gdl (void) const |
bool | should_beautify (void) const |
bool | rtype_refined (void) const |
bool | may_refine_rettype (void) const |
bool | use_wingraph32 (void) const |
bool | display_numaddrs (void) const |
bool | display_valnums (void) const |
bool | is_pattern (void) const |
bool | is_thunk (void) const |
bool | saverest_done (void) const |
bool | callinfo_built (void) const |
bool | really_alloc (void) const |
bool | lvars_allocated (void) const |
bool | chain_varnums_ok (void) const |
bool | returns_fpval (void) const |
bool | has_passregs (void) const |
bool | generated_asserts (void) const |
bool | propagated_asserts (void) const |
bool | deleted_pairs (void) const |
bool | common_stkvars_stkargs (void) const |
bool | lvar_names_ok (void) const |
bool | lvars_renamed (void) const |
bool | has_over_chains (void) const |
bool | valranges_done (void) const |
bool | argidx_ok (void) const |
bool | argidx_sorted (void) const |
bool | code16_bit_removed (void) const |
bool | has_stack_retval (void) const |
bool | has_outlines (void) const |
bool | is_ctr (void) const |
bool | is_dtr (void) const |
bool | is_cdtr (void) const |
bool | prop_complex (void) const |
int | get_mba_flags (void) const |
int | get_mba_flags2 (void) 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 (void) |
int | calc_shins_flags (void) 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 (void) const |
bool | bad_call_sp_detected (void) const |
bool | regargs_is_not_aligned (void) const |
bool | has_bad_sp (void) const |
void | term (void) |
func_t * | get_curfunc () const |
bool | use_frame (void) const |
bool | range_contains (ea_t ea) const |
bool | is_snippet (void) 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 (void) |
Build control flow graph. More... | |
mbl_graph_t * | get_graph (void) |
Get control graph. More... | |
int | analyze_calls (int acflags) |
Analyze calls and determine calling conventions. More... | |
merror_t | optimize_global (void) |
Optimize microcode globally. More... | |
void | alloc_lvars (void) |
Allocate local variables. More... | |
void | dump (void) 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 (void) |
Mark the microcode use-def chains dirty. More... | |
const mblock_t * | get_mblock (int n) const |
Get basic block by its serial number. More... | |
mblock_t * | get_mblock (int n) |
mblock_t * | insert_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_t * | copy_block (mblock_t *blk, int new_serial, int cpblk_flags=3) |
Make a copy of a block. More... | |
bool | remove_empty_and_unreachable_blocks (void) |
Delete all empty and unreachable blocks. More... | |
bool | combine_blocks (void) |
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_t * | find_mop (op_parent_info_t *ctx, ea_t ea, bool is_dest, const mlist_t &list) |
Find an operand in the microcode. More... | |
minsn_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. 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_t & | arg (int n) |
Get input argument of the decompiled function. More... | |
const lvar_t & | arg (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_t & | get_std_region (memreg_index_t idx) const |
Get information about various memory regions. More... | |
const ivl_t & | get_lvars_region (void) const |
const ivl_t & | get_shadow_region (void) const |
const ivl_t & | get_args_region (void) const |
ivl_t | get_stack_region (void) 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_t * | deserialize (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_t * | blocks = 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 4749 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_ea real instruction address (BADADDR is ok too)
- Returns
- a unique fictional address
Definition at line 11364 of file hexrays.hpp.
◆ alloc_kreg()
mreg_t mba_t::alloc_kreg | ( | size_t | size, |
bool | check_size = true |
||
) |
Allocate a kernel register.
- Parameters
-
size size of the register in bytes 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.
Definition at line 11398 of file hexrays.hpp.
◆ alloc_lvars()
void mba_t::alloc_lvars | ( | void | ) |
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 11256 of file hexrays.hpp.
◆ analyze_calls()
int mba_t::analyze_calls | ( | int | acflags | ) |
Analyze calls and determine calling conventions.
- Parameters
-
acflags permitted 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 11244 of file hexrays.hpp.
◆ arg() [1/2]
lvar_t & mba_t::arg | ( | int | n | ) |
Get input argument of the decompiled function.
- Parameters
-
n argument number (0..nargs-1)
Definition at line 11358 of file hexrays.hpp.
◆ arg() [2/2]
const lvar_t & mba_t::arg | ( | int | n | ) | const |
Definition at line 4957 of file hexrays.hpp.
◆ argbase()
sval_t mba_t::argbase | ( | ) | const |
Definition at line 4641 of file hexrays.hpp.
◆ argidx_ok()
bool mba_t::argidx_ok | ( | void | ) | const |
Definition at line 4568 of file hexrays.hpp.
◆ argidx_sorted()
bool mba_t::argidx_sorted | ( | void | ) | const |
Definition at line 4569 of file hexrays.hpp.
◆ bad_call_sp_detected()
bool mba_t::bad_call_sp_detected | ( | void | ) | const |
Definition at line 4733 of file hexrays.hpp.
◆ build_graph()
merror_t mba_t::build_graph | ( | void | ) |
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 11232 of file hexrays.hpp.
◆ calc_shins_flags()
int mba_t::calc_shins_flags | ( | void | ) | const |
Definition at line 4584 of file hexrays.hpp.
◆ callinfo_built()
bool mba_t::callinfo_built | ( | void | ) | const |
Definition at line 4554 of file hexrays.hpp.
◆ chain_varnums_ok()
bool mba_t::chain_varnums_ok | ( | void | ) | const |
Definition at line 4557 of file hexrays.hpp.
◆ clr_cdtr()
void mba_t::clr_cdtr | ( | void | ) |
Definition at line 4583 of file hexrays.hpp.
◆ clr_mba_flags()
void mba_t::clr_mba_flags | ( | int | f | ) |
Definition at line 4580 of file hexrays.hpp.
◆ clr_mba_flags2()
void mba_t::clr_mba_flags2 | ( | int | f | ) |
Definition at line 4582 of file hexrays.hpp.
◆ code16_bit_removed()
bool mba_t::code16_bit_removed | ( | void | ) | const |
Definition at line 4570 of file hexrays.hpp.
◆ combine_blocks()
bool mba_t::combine_blocks | ( | void | ) |
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 11316 of file hexrays.hpp.
◆ common_stkvars_stkargs()
bool mba_t::common_stkvars_stkargs | ( | void | ) | const |
Definition at line 4563 of file hexrays.hpp.
◆ copy_block()
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
-
blk block to copy new_serial position of the copied block cpblk_flags combination of Batch decompilation bits... bits
- Returns
- pointer to the new copy
Definition at line 11304 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
-
ea The desired address of the instruction helper The helper name rettype The return type (nullptr or empty type means 'void') callargs The helper arguments (nullptr-no arguments) 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
Definition at line 11346 of file hexrays.hpp.
◆ deleted_pairs()
bool mba_t::deleted_pairs | ( | void | ) | const |
Definition at line 4562 of file hexrays.hpp.
◆ deserialize()
|
static |
Deserialize a byte sequence into mbl array.
- Parameters
-
bytes pointer to the beginning of the byte sequence. nbytes number of bytes in the byte sequence.
- Returns
- new mbl array
Definition at line 11386 of file hexrays.hpp.
◆ display_numaddrs()
bool mba_t::display_numaddrs | ( | void | ) | const |
Definition at line 4549 of file hexrays.hpp.
◆ display_valnums()
bool mba_t::display_valnums | ( | void | ) | const |
Definition at line 4550 of file hexrays.hpp.
◆ dump()
void mba_t::dump | ( | void | ) | 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 11262 of file hexrays.hpp.
◆ dump_mba()
void mba_t::dump_mba | ( | bool | _verify, |
const char * | title, | ||
... | |||
) | const |
Definition at line 4822 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] ctx context information for the result ea desired address of the operand. BADADDR means to accept any address. is_dest search for destination operand? this argument may be ignored if the exact match could not be found list list of locations the correspond to the operand
- Returns
- pointer to the operand or nullptr.
- Examples
- hexrays_sample12.cpp.
Definition at line 11340 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
-
mv instruction visitor
- Returns
- non-zero value returned by mv.visit_mop() or zero
Definition at line 11328 of file hexrays.hpp.
◆ for_all_ops()
int mba_t::for_all_ops | ( | mop_visitor_t & | mv | ) |
Visit all operands of all instructions.
- Parameters
-
mv operand visitor
- Returns
- non-zero value returned by mv.visit_mop() or zero
Definition at line 11322 of file hexrays.hpp.
◆ for_all_topinsns()
int mba_t::for_all_topinsns | ( | minsn_visitor_t & | mv | ) |
Visit all top level instructions.
- Parameters
-
mv instruction visitor
- Returns
- non-zero value returned by mv.visit_mop() or zero
- Examples
- hexrays_sample15.cpp, and hexrays_sample18.cpp.
Definition at line 11334 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
-
reg a previously allocated kernel register size size of the register in bytes
Definition at line 11404 of file hexrays.hpp.
◆ generated_asserts()
bool mba_t::generated_asserts | ( | void | ) | const |
Definition at line 4560 of file hexrays.hpp.
◆ get_args_region()
const ivl_t & mba_t::get_args_region | ( | void | ) | const |
Definition at line 5346 of file hexrays.hpp.
◆ get_curfunc()
func_t * mba_t::get_curfunc | ( | void | ) | const |
- Examples
- hexrays_sample18.cpp.
Definition at line 11214 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_regs defined regs to return (eax,edx) [out] spoiled spoiled regs (flags,ecx,mem) type the function type call_ea the call insn address (if known) tail_call is it the tail call?
Definition at line 11352 of file hexrays.hpp.
◆ get_graph()
mbl_graph_t * mba_t::get_graph | ( | void | ) |
Get control graph.
Call build_graph() if you need the graph before MMAT_LOCOPT.
- Examples
- hexrays_sample12.cpp.
Definition at line 11238 of file hexrays.hpp.
◆ get_ida_argloc()
argloc_t mba_t::get_ida_argloc | ( | const lvar_t & | v | ) | const |
Definition at line 4657 of file hexrays.hpp.
◆ get_lvars_region()
const ivl_t & mba_t::get_lvars_region | ( | void | ) | const |
Definition at line 5336 of file hexrays.hpp.
◆ get_mba_flags()
int mba_t::get_mba_flags | ( | void | ) | const |
Definition at line 4577 of file hexrays.hpp.
◆ get_mba_flags2()
int mba_t::get_mba_flags2 | ( | void | ) | const |
Definition at line 4578 of file hexrays.hpp.
◆ get_mblock() [1/2]
mblock_t * mba_t::get_mblock | ( | int | n | ) |
Definition at line 4853 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 4852 of file hexrays.hpp.
◆ get_shadow_region()
const ivl_t & mba_t::get_shadow_region | ( | void | ) | const |
Definition at line 5341 of file hexrays.hpp.
◆ get_stack_region()
ivl_t mba_t::get_stack_region | ( | void | ) | const |
Definition at line 5351 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 5331 of file hexrays.hpp.
References std_ivls.
◆ graph_insns()
bool mba_t::graph_insns | ( | void | ) | const |
Definition at line 4543 of file hexrays.hpp.
◆ has_bad_sp()
bool mba_t::has_bad_sp | ( | void | ) | const |
Definition at line 4741 of file hexrays.hpp.
◆ has_outlines()
bool mba_t::has_outlines | ( | void | ) | const |
Definition at line 4572 of file hexrays.hpp.
◆ has_over_chains()
bool mba_t::has_over_chains | ( | void | ) | const |
Definition at line 4566 of file hexrays.hpp.
◆ has_passregs()
bool mba_t::has_passregs | ( | void | ) | const |
Definition at line 4559 of file hexrays.hpp.
◆ has_stack_retval()
bool mba_t::has_stack_retval | ( | void | ) | const |
Definition at line 4571 of file hexrays.hpp.
◆ idaloc2vd() [1/2]
vdloc_t mba_t::idaloc2vd | ( | const argloc_t & | loc, |
int | width | ||
) | const |
Definition at line 11184 of file hexrays.hpp.
◆ idaloc2vd() [2/2]
|
static |
Definition at line 11176 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
-
bblk the new block will be inserted before BBLK
- Returns
- ptr to the new block
Definition at line 11292 of file hexrays.hpp.
◆ is_cdtr()
bool mba_t::is_cdtr | ( | void | ) | const |
Definition at line 4575 of file hexrays.hpp.
◆ is_ctr()
bool mba_t::is_ctr | ( | void | ) | const |
Definition at line 4573 of file hexrays.hpp.
◆ is_dtr()
bool mba_t::is_dtr | ( | void | ) | const |
Definition at line 4574 of file hexrays.hpp.
◆ is_pattern()
bool mba_t::is_pattern | ( | void | ) | const |
Definition at line 4551 of file hexrays.hpp.
◆ is_snippet()
bool mba_t::is_snippet | ( | void | ) | const |
Definition at line 4755 of file hexrays.hpp.
◆ is_stkarg()
bool mba_t::is_stkarg | ( | const lvar_t & | v | ) | const |
Definition at line 4651 of file hexrays.hpp.
◆ is_thunk()
bool mba_t::is_thunk | ( | void | ) | const |
Definition at line 4552 of file hexrays.hpp.
◆ loaded_gdl()
bool mba_t::loaded_gdl | ( | void | ) | const |
Definition at line 4544 of file hexrays.hpp.
◆ lvar_names_ok()
bool mba_t::lvar_names_ok | ( | void | ) | const |
Definition at line 4564 of file hexrays.hpp.
◆ lvars_allocated()
bool mba_t::lvars_allocated | ( | void | ) | const |
Definition at line 4556 of file hexrays.hpp.
◆ lvars_renamed()
bool mba_t::lvars_renamed | ( | void | ) | const |
Definition at line 4565 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_ea fictional definition address
- Returns
- the real instruction address
Definition at line 11372 of file hexrays.hpp.
◆ mark_chains_dirty()
void mba_t::mark_chains_dirty | ( | void | ) |
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 11286 of file hexrays.hpp.
◆ may_refine_rettype()
bool mba_t::may_refine_rettype | ( | void | ) | const |
Definition at line 4547 of file hexrays.hpp.
◆ optimize_global()
merror_t mba_t::optimize_global | ( | void | ) |
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 11250 of file hexrays.hpp.
◆ optimize_local()
int mba_t::optimize_local | ( | int | locopt_bits | ) |
Optimize each basic block locally.
- Parameters
-
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.
Definition at line 11226 of file hexrays.hpp.
◆ optimized()
bool mba_t::optimized | ( | void | ) | const |
Definition at line 4540 of file hexrays.hpp.
◆ precise_defeas()
bool mba_t::precise_defeas | ( | void | ) | const |
Definition at line 4539 of file hexrays.hpp.
◆ print()
void mba_t::print | ( | vd_printer_t & | vp | ) | const |
Print microcode to any destination.
- Parameters
-
vp print sink
- Examples
- hexrays_sample13.cpp, and hexrays_sample9.cpp.
Definition at line 11274 of file hexrays.hpp.
◆ prop_complex()
bool mba_t::prop_complex | ( | void | ) | const |
Definition at line 4576 of file hexrays.hpp.
◆ propagated_asserts()
bool mba_t::propagated_asserts | ( | void | ) | const |
Definition at line 4561 of file hexrays.hpp.
◆ range_contains()
bool mba_t::range_contains | ( | ea_t | ea | ) | const |
Definition at line 4754 of file hexrays.hpp.
◆ really_alloc()
bool mba_t::really_alloc | ( | void | ) | const |
Definition at line 4555 of file hexrays.hpp.
◆ regargs_is_not_aligned()
bool mba_t::regargs_is_not_aligned | ( | void | ) | const |
Definition at line 4737 of file hexrays.hpp.
◆ remove_block()
bool mba_t::remove_block | ( | mblock_t * | blk | ) |
Delete a block.
- Parameters
-
blk block to delete
- Returns
- true if at least one of the other blocks became empty or unreachable
Definition at line 11298 of file hexrays.hpp.
◆ remove_empty_and_unreachable_blocks()
bool mba_t::remove_empty_and_unreachable_blocks | ( | void | ) |
Delete all empty and unreachable blocks.
Blocks marked with MBL_KEEP won't be deleted.
Definition at line 11310 of file hexrays.hpp.
◆ returns_fpval()
bool mba_t::returns_fpval | ( | void | ) | const |
Definition at line 4558 of file hexrays.hpp.
◆ rtype_refined()
bool mba_t::rtype_refined | ( | void | ) | const |
Definition at line 4546 of file hexrays.hpp.
◆ save_snapshot()
void mba_t::save_snapshot | ( | const char * | description | ) |
Create and save microcode snapshot.
Definition at line 11392 of file hexrays.hpp.
◆ saverest_done()
bool mba_t::saverest_done | ( | void | ) | const |
Definition at line 4553 of file hexrays.hpp.
◆ serialize()
void mba_t::serialize | ( | bytevec_t & | vout | ) | const |
Serialize mbl array into a sequence of bytes.
Definition at line 11380 of file hexrays.hpp.
◆ set_lvar_name()
bool mba_t::set_lvar_name | ( | lvar_t & | v, |
const char * | name, | ||
int | flagbits | ||
) |
Definition at line 11410 of file hexrays.hpp.
◆ set_maturity()
bool mba_t::set_maturity | ( | mba_maturity_t | mat | ) |
Set maturity level.
- Parameters
-
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.
Definition at line 11220 of file hexrays.hpp.
◆ set_mba_flags()
void mba_t::set_mba_flags | ( | int | f | ) |
Definition at line 4579 of file hexrays.hpp.
◆ set_mba_flags2()
void mba_t::set_mba_flags2 | ( | int | f | ) |
Definition at line 4581 of file hexrays.hpp.
◆ set_nice_lvar_name()
bool mba_t::set_nice_lvar_name | ( | lvar_t & | v, |
const char * | name | ||
) |
Definition at line 5020 of file hexrays.hpp.
◆ set_user_lvar_name()
bool mba_t::set_user_lvar_name | ( | lvar_t & | v, |
const char * | name | ||
) |
Definition at line 5021 of file hexrays.hpp.
◆ short_display()
bool mba_t::short_display | ( | void | ) | const |
Definition at line 4541 of file hexrays.hpp.
◆ should_beautify()
bool mba_t::should_beautify | ( | void | ) | const |
Definition at line 4545 of file hexrays.hpp.
◆ show_reduction()
bool mba_t::show_reduction | ( | void | ) | const |
Definition at line 4542 of file hexrays.hpp.
◆ stkoff_ida2vd()
sval_t mba_t::stkoff_ida2vd | ( | sval_t | off | ) | const |
Definition at line 11168 of file hexrays.hpp.
◆ stkoff_vd2ida()
sval_t mba_t::stkoff_vd2ida | ( | sval_t | off | ) | const |
Definition at line 11160 of file hexrays.hpp.
◆ term()
void mba_t::term | ( | void | ) |
Definition at line 11208 of file hexrays.hpp.
◆ use_frame()
bool mba_t::use_frame | ( | void | ) | const |
Definition at line 4753 of file hexrays.hpp.
◆ use_wingraph32()
bool mba_t::use_wingraph32 | ( | void | ) | const |
Definition at line 4548 of file hexrays.hpp.
◆ valranges_done()
bool mba_t::valranges_done | ( | void | ) | const |
Definition at line 4567 of file hexrays.hpp.
◆ vd2idaloc() [1/2]
argloc_t mba_t::vd2idaloc | ( | const vdloc_t & | loc, |
int | width | ||
) | const |
Definition at line 11200 of file hexrays.hpp.
◆ vd2idaloc() [2/2]
|
static |
Definition at line 11192 of file hexrays.hpp.
◆ vdump_mba()
void mba_t::vdump_mba | ( | bool | _verify, |
const char * | title, | ||
va_list | va | ||
) | const |
Definition at line 11268 of file hexrays.hpp.
◆ verify()
void mba_t::verify | ( | bool | always | ) | const |
Verify microcode consistency.
- Parameters
-
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.
- Examples
- hexrays_sample11.cpp, and hexrays_sample18.cpp.
Definition at line 11280 of file hexrays.hpp.
◆ write_to_const_detected()
bool mba_t::write_to_const_detected | ( | void | ) | const |
Definition at line 4729 of file hexrays.hpp.
Member Data Documentation
◆ aliased_args
Aliased stkarg locations.
Definition at line 4690 of file hexrays.hpp.
◆ aliased_memory
ivlset_t mba_t::aliased_memory = ALLMEM |
aliased_memory+restricted_memory=ALLMEM
Definition at line 4693 of file hexrays.hpp.
◆ aliased_vars
Aliased stkvar locations.
Definition at line 4689 of file hexrays.hpp.
◆ argidx
intvec_t mba_t::argidx |
input arguments (indexes into 'vars')
Definition at line 4713 of file hexrays.hpp.
◆ blocks
mblock_t* mba_t::blocks = nullptr |
double linked list of blocks
Definition at line 4720 of file hexrays.hpp.
◆ cc
cm_t mba_t::cc = CM_CC_UNKNOWN |
calling convention
Definition at line 4667 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 4695 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 4706 of file hexrays.hpp.
◆ entry_ea
ea_t mba_t::entry_ea = BADADDR |
Definition at line 4662 of file hexrays.hpp.
◆ error_ea
ea_t mba_t::error_ea = BADADDR |
during microcode generation holds ins.ea
Definition at line 4717 of file hexrays.hpp.
◆ error_strarg
qstring mba_t::error_strarg |
Definition at line 4718 of file hexrays.hpp.
◆ final_type
bool mba_t::final_type = false |
is the function type final? (specified by the user)
Definition at line 4700 of file hexrays.hpp.
◆ first_epilog_ea
ea_t mba_t::first_epilog_ea = BADADDR |
Definition at line 4664 of file hexrays.hpp.
◆ fpd
sval_t mba_t::fpd = 0 |
frame pointer delta
Definition at line 4672 of file hexrays.hpp.
◆ frregs
sval_t mba_t::frregs = 0 |
size of saved registers range in the stack frame
Definition at line 4671 of file hexrays.hpp.
◆ frsize
sval_t mba_t::frsize = 0 |
size of local stkvars range in the stack frame
Definition at line 4670 of file hexrays.hpp.
◆ fti_flags
int mba_t::fti_flags = 0 |
FTI_... constants for the current function.
Definition at line 4704 of file hexrays.hpp.
◆ fullsize
sval_t mba_t::fullsize = 0 |
Full stack size including incoming args.
Definition at line 4676 of file hexrays.hpp.
◆ gotoff_stkvars
ivlset_t mba_t::gotoff_stkvars |
stkvars that hold .got offsets. considered to be unaliasable
Definition at line 4691 of file hexrays.hpp.
◆ idb_spoiled
reginfovec_t mba_t::idb_spoiled |
MBA_SPLINFO && final_type: info in ida format.
Definition at line 4702 of file hexrays.hpp.
◆ idb_type
tinfo_t mba_t::idb_type |
function type as retrieved from the database
Definition at line 4701 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 4680 of file hexrays.hpp.
◆ label
qstring mba_t::label |
name of the function or pattern (colored)
Definition at line 4711 of file hexrays.hpp.
◆ last_prolog_ea
ea_t mba_t::last_prolog_ea = BADADDR |
Definition at line 4663 of file hexrays.hpp.
◆ maturity
mba_maturity_t mba_t::maturity = MMAT_ZERO |
current maturity level
Definition at line 4697 of file hexrays.hpp.
◆ mbr
mba_ranges_t mba_t::mbr |
Definition at line 4661 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 4685 of file hexrays.hpp.
◆ minstkref
sval_t mba_t::minstkref = 0 |
The lowest stack location whose address was taken.
Definition at line 4683 of file hexrays.hpp.
◆ minstkref_ea
ea_t mba_t::minstkref_ea = BADADDR |
address with lowest minstkref (for debugging)
Definition at line 4684 of file hexrays.hpp.
◆ natural
mblock_t** mba_t::natural = nullptr |
natural order of blocks
Definition at line 4721 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 4694 of file hexrays.hpp.
◆ notes
|
mutable |
Definition at line 4726 of file hexrays.hpp.
◆ npurged
int mba_t::npurged = -1 |
-1 - unknown
Definition at line 4666 of file hexrays.hpp.
◆ occurred_warns
|
mutable |
Definition at line 4727 of file hexrays.hpp.
◆ pfn_flags
int mba_t::pfn_flags = 0 |
copy of func_t::flags
Definition at line 4673 of file hexrays.hpp.
◆ qty
int mba_t::qty = 0 |
number of basic blocks
Definition at line 4665 of file hexrays.hpp.
◆ reqmat
mba_maturity_t mba_t::reqmat = MMAT_ZERO |
required maturity level
Definition at line 4698 of file hexrays.hpp.
◆ reserved
char mba_t::reserved[] |
Definition at line 4747 of file hexrays.hpp.
◆ restricted_memory
ivlset_t mba_t::restricted_memory |
Definition at line 4692 of file hexrays.hpp.
◆ retsize
int mba_t::retsize = 0 |
size of return address in the stack frame
Definition at line 4674 of file hexrays.hpp.
◆ retvaridx
int mba_t::retvaridx = -1 |
index of variable holding the return value -1 means none
Definition at line 4714 of file hexrays.hpp.
◆ shadow_args
int mba_t::shadow_args = 0 |
size of shadow argument area
Definition at line 4675 of file hexrays.hpp.
◆ spd_adjust
sval_t mba_t::spd_adjust = 0 |
If sp>0, the max positive sp value.
Definition at line 4688 of file hexrays.hpp.
◆ spoiled_list
mlist_t mba_t::spoiled_list |
MBA_SPLINFO && !final_type: info in vd format.
Definition at line 4703 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 4677 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 4723 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 4668 of file hexrays.hpp.
◆ vars
lvars_t mba_t::vars |
local variables
Definition at line 4712 of file hexrays.hpp.