IDA C++ SDK 9.2
Loading...
Searching...
No Matches
ea-based SP change points

Functions

idaman bool ida_export add_func_auto_stkpnt (ea_t func_ea, ea_t ea, sval_t delta)
 Add automatic SP register change point.
idaman bool ida_export del_func_stkpnt (ea_t func_ea, ea_t ea)
 Delete SP register change point.
idaman sval_t ida_export get_func_spd (ea_t func_ea, ea_t ea)
 Get difference between the initial and current values of ESP.
idaman sval_t ida_export get_func_effective_spd (ea_t func_ea, ea_t ea)
 Get effective difference between the initial and current values of ESP.
idaman sval_t ida_export get_func_sp_delta (ea_t func_ea, ea_t ea)
 Get modification of SP made at the specified location.
idaman bool ida_export set_func_auto_spd (ea_t func_ea, ea_t ea, sval_t new_spd)
 Set the cumulative SP delta at the given address.
idaman bool ida_export recalc_func_spd_for_basic_block (ea_t func_ea, ea_t cur_ea)
 Recalculate SP delta for the current instruction.
idaman size_t ida_export get_func_stkpnt_qty (ea_t func_ea)
 Get the number of SP change points for a function.
idaman bool ida_export get_func_stkpnts (stkpnts_t *out, ea_t func_ea)
 Get all SP change points for a function.

Detailed Description

Function Documentation

◆ add_func_auto_stkpnt()

idaman bool ida_export add_func_auto_stkpnt ( ea_t func_ea,
ea_t ea,
sval_t delta )

Add automatic SP register change point.

Parameters
func_eaany address of the function, may be BADADDR to auto-resolve
ealinear address where SP changes. usually this is the end of the instruction which modifies the stack pointer ( insn_t::ea+ insn_t::size)
deltadifference between old and new values of SP
Returns
success

◆ del_func_stkpnt()

idaman bool ida_export del_func_stkpnt ( ea_t func_ea,
ea_t ea )

Delete SP register change point.

Parameters
func_eaany address of the function, may be BADADDR to auto-resolve
ealinear address
Returns
success

◆ get_func_spd()

idaman sval_t ida_export get_func_spd ( ea_t func_ea,
ea_t ea )

Get difference between the initial and current values of ESP.

Parameters
func_eaany address of the function, may be BADADDR to auto-resolve
ealinear address of the instruction
Returns
0 or the difference, usually a negative number. returns the sp-diff before executing the instruction.

◆ get_func_effective_spd()

idaman sval_t ida_export get_func_effective_spd ( ea_t func_ea,
ea_t ea )

Get effective difference between the initial and current values of ESP.

This function returns the sp-diff used by the instruction. The difference between get_func_spd() and get_func_effective_spd() is present only for instructions like "pop [esp+N]": they modify sp and use the modified value.

Parameters
func_eaany address of the function, may be BADADDR to auto-resolve
ealinear address
Returns
0 or the difference, usually a negative number

◆ get_func_sp_delta()

idaman sval_t ida_export get_func_sp_delta ( ea_t func_ea,
ea_t ea )

Get modification of SP made at the specified location.

Parameters
func_eaany address of the function, may be BADADDR to auto-resolve
ealinear address
Returns
0 if the specified location doesn't contain a SP change point. otherwise return delta of SP modification.

◆ set_func_auto_spd()

idaman bool ida_export set_func_auto_spd ( ea_t func_ea,
ea_t ea,
sval_t new_spd )

Set the cumulative SP delta at the given address.

Parameters
func_eaany address of the function, may be BADADDR to auto-resolve
ealinear address of the instruction
new_spdnew value of the cumulative SP delta
Returns
success

◆ recalc_func_spd_for_basic_block()

idaman bool ida_export recalc_func_spd_for_basic_block ( ea_t func_ea,
ea_t cur_ea )

Recalculate SP delta for the current instruction.

The typical code snippet to calculate SP delta in a proc module is:

ea_t func_ea = get_func_start(insn.ea);
if ( may_trace_sp() && func_ea != BADADDR )
  if ( !recalc_func_spd_for_basic_block(func_ea, insn.ea) )
    trace_sp(func_ea, insn);
Parameters
func_eaany address of the function
cur_ealinear address of the current instruction
Return values
truethe cumulative SP delta is set
falsethe instruction at CUR_EA passes flow to the next instruction. SP delta must be set as a result of emulating the current instruction.

◆ get_func_stkpnt_qty()

idaman size_t ida_export get_func_stkpnt_qty ( ea_t func_ea)

Get the number of SP change points for a function.

Parameters
func_eafunction start address
Returns
number of SP change points, or 0 if no function / no points

◆ get_func_stkpnts()

idaman bool ida_export get_func_stkpnts ( stkpnts_t * out,
ea_t func_ea )

Get all SP change points for a function.

Parameters
outoutput vector of stkpnt_t
func_eafunction start address
Returns
success