IDA C++ SDK 9.2
Loading...
Searching...
No Matches
frame.hpp File Reference

Routines to manipulate function stack frames, stack variables, register variables and local labels. More...

Go to the source code of this file.

Classes

struct  stkpnt_t
struct  stkpnts_t
struct  llabel_t
 Local label. More...
struct  regvar_t
 A register variable allows the user to rename a general processor register to a meaningful name. More...
struct  xreflist_entry_t
 An xref to an argument or variable located in a function's stack frame. More...

Typedefs

typedef qvector< llabel_tllabels_t
typedef qvector< xreflist_entry_txreflist_t
 vector of xrefs to variables in a function's stack frame

Enumerations

enum  frame_part_t { FPC_ARGS , FPC_RETADDR , FPC_SAVREGS , FPC_LVARS }
 Parts of a frame. More...

Functions

 DECLARE_TYPE_AS_MOVABLE (stkpnt_t)
 DECLARE_TYPE_AS_MOVABLE (llabel_t)
idaman DEPRECATED bool ida_export add_frame (func_t *pfn, sval_t frsize, ushort frregs, asize_t argsize)
 Add function frame.
idaman DEPRECATED bool ida_export del_frame (func_t *pfn)
 Delete a function frame.
idaman DEPRECATED bool ida_export set_frame_size (func_t *pfn, asize_t frsize, ushort frregs, asize_t argsize)
 Set size of function frame.
idaman DEPRECATED asize_t ida_export get_frame_size (const func_t *pfn)
 Get full size of a function frame.
idaman DEPRECATED int ida_export get_frame_retsize (const func_t *pfn)
 Get size of function return address.
idaman DEPRECATED void ida_export get_frame_part (range_t *range, const func_t *pfn, frame_part_t part)
 Get offsets of the frame part in the frame.
idaman DEPRECATED bool ida_export get_func_frame (tinfo_t *out, const func_t *pfn)
 Get type of function frame.
DEPRECATED sval_t soff_to_fpoff (func_t *pfn, uval_t soff)
 Convert struct offsets into fp-relative offsets.
idaman DEPRECATED bool ida_export update_fpd (func_t *pfn, asize_t fpd)
 Update frame pointer delta.
idaman bool ida_export set_purged (ea_t ea, int nbytes, bool override_old_value)
 Set the number of purged bytes for a function or data item (funcptr).
idaman bool ida_export add_stkvar (const insn_t &insn, const op_t &x, sval_t v, int stkvar_flags)
 Automatically add stack variable.
idaman DEPRECATED bool ida_export define_stkvar (func_t *pfn, const char *name, sval_t off, const tinfo_t &tif, const struct value_repr_t *repr=nullptr)
 Define/redefine a stack variable.
idaman DEPRECATED bool ida_export add_frame_member (const func_t *pfn, const char *name, uval_t offset, const tinfo_t &tif, const struct value_repr_t *repr=nullptr, uint etf_flags=0)
 Add member to the frame type.
THREAD_SAFE bool is_anonymous_member_name (const char *name)
 Is member name prefixed with "anonymous"?
THREAD_SAFE bool is_dummy_member_name (const char *name)
 Is member name an auto-generated name?
idaman bool ida_export is_special_frame_member (tid_t tid)
 Is stkvar with TID the return address slot or the saved registers slot ?
idaman DEPRECATED bool ida_export set_frame_member_type (const func_t *pfn, uval_t offset, const tinfo_t &tif, const struct value_repr_t *repr=nullptr, uint etf_flags=0)
 Change type of the frame member.
idaman DEPRECATED bool ida_export delete_frame_members (const func_t *pfn, uval_t start_offset, uval_t end_offset)
 Delete frame members.
idaman DEPRECATED ssize_t ida_export build_stkvar_name (qstring *buf, const func_t *pfn, sval_t v)
 Build automatic stack variable name.
idaman DEPRECATED ea_t ida_export calc_stkvar_struc_offset (func_t *pfn, const insn_t &insn, int n)
 Calculate offset of stack variable in the frame structure.
idaman DEPRECATED sval_t ida_export calc_frame_offset (func_t *pfn, sval_t off, const insn_t *insn=nullptr, const op_t *op=nullptr)
 Calculate the offset of stack variable in the frame.
idaman DEPRECATED int ida_export delete_wrong_frame_info (func_t *pfn, bool idaapi should_reanalyze(const insn_t &insn))
 Find and delete wrong frame info.
idaman DEPRECATED bool ida_export add_auto_stkpnt (func_t *pfn, ea_t ea, sval_t delta)
 Add automatic SP register change point.
idaman bool ida_export add_user_stkpnt (ea_t ea, sval_t delta)
 Add user-defined SP register change point.
idaman DEPRECATED bool ida_export del_stkpnt (func_t *pfn, ea_t ea)
 Delete SP register change point.
idaman DEPRECATED sval_t ida_export get_spd (func_t *pfn, ea_t ea)
 Get difference between the initial and current values of ESP.
idaman DEPRECATED sval_t ida_export get_effective_spd (func_t *pfn, ea_t ea)
 Get effective difference between the initial and current values of ESP.
idaman DEPRECATED sval_t ida_export get_sp_delta (func_t *pfn, ea_t ea)
 Get modification of SP made at the specified location.
idaman DEPRECATED bool ida_export set_auto_spd (func_t *pfn, ea_t ea, sval_t new_spd)
 Add such an automatic SP register change point so that at EA the new cumulative SP delta (that is, the difference between the initial and current values of SP) would be equal to NEW_SPD.
idaman bool ida_export recalc_spd (ea_t cur_ea)
 Recalculate SP delta for an instruction that stops execution.
idaman DEPRECATED bool ida_export recalc_spd_for_basic_block (func_t *pfn, ea_t cur_ea)
 Recalculate SP delta for the current instruction.
 DECLARE_TYPE_AS_MOVABLE (xreflist_entry_t)
idaman DEPRECATED void ida_export build_stkvar_xrefs (xreflist_t *out, func_t *pfn, uval_t start_offset, uval_t end_offset)
 Fill 'out' with a list of all the xrefs made from function 'pfn' to specified range of the pfn's stack frame.
idaman bool ida_export add_frame_ea (ea_t func_ea, sval_t frsize, ushort frregs, asize_t argsize)
 Add function frame.
idaman bool ida_export del_frame_ea (ea_t func_ea)
 Delete a function frame.
idaman bool ida_export set_frame_size_ea (ea_t func_ea, asize_t frsize, ushort frregs, asize_t argsize)
 Set size of function frame.
idaman asize_t ida_export get_frame_size_ea (ea_t func_ea)
 Get full size of a function frame.
idaman int ida_export get_frame_retsize_ea (ea_t func_ea)
 Get size of function return address.
idaman bool ida_export get_frame_part_ea (range_t *range, ea_t func_ea, frame_part_t part)
 Get offsets of the frame part in the frame.
ea_t frame_off_args_ea (ea_t func_ea)
 Get starting address of arguments section.
ea_t frame_off_retaddr_ea (ea_t func_ea)
 Get starting address of return address section.
ea_t frame_off_savregs_ea (ea_t func_ea)
 Get starting address of saved registers section.
ea_t frame_off_lvars_ea (ea_t func_ea)
 Get start address of local variables section.
DEPRECATED ea_t frame_off_args (const func_t *pfn)
 Get starting address of arguments section.
DEPRECATED ea_t frame_off_retaddr (const func_t *pfn)
 Get starting address of return address section.
DEPRECATED ea_t frame_off_savregs (const func_t *pfn)
 Get starting address of saved registers section.
DEPRECATED ea_t frame_off_lvars (const func_t *pfn)
 Get start address of local variables section.
idaman bool ida_export get_func_frame_ea (tinfo_t *out, ea_t func_ea)
 Get type of function frame.
bool get_func_frame (tinfo_t *tif, ea_t ea)
idaman sval_t ida_export soff_to_fpoff_ea (ea_t func_ea, uval_t soff)
 Convert struct offsets into fp-relative offsets.
idaman bool ida_export update_fpd_ea (ea_t func_ea, asize_t fpd)
 Update frame pointer delta.
idaman bool ida_export define_stkvar_ea (ea_t func_ea, const char *name, sval_t off, const tinfo_t &tif, const struct value_repr_t *repr=nullptr)
 Define/redefine a stack variable.
idaman bool ida_export add_frame_member_ea (ea_t func_ea, const char *name, uval_t offset, const tinfo_t &tif, const struct value_repr_t *repr=nullptr, uint etf_flags=0)
 Add member to the frame type.
idaman bool ida_export set_frame_member_type_ea (ea_t func_ea, uval_t offset, const tinfo_t &tif, const struct value_repr_t *repr=nullptr, uint etf_flags=0)
 Change type of the frame member.
idaman bool ida_export delete_frame_members_ea (ea_t func_ea, uval_t start_offset, uval_t end_offset)
 Delete frame members.
idaman ssize_t ida_export build_stkvar_name_ea (qstring *buf, ea_t func_ea, sval_t v)
 Build automatic stack variable name.
idaman ea_t ida_export calc_stkvar_struc_offset_ea (ea_t func_ea, const insn_t &insn, int n)
 Calculate offset of stack variable in the frame structure.
idaman sval_t ida_export calc_frame_offset_ea (ea_t func_ea, sval_t off, const insn_t *insn=nullptr, const op_t *op=nullptr)
 Calculate the offset of stack variable in the frame.
idaman int ida_export delete_wrong_frame_info_ea (ea_t func_ea, bool idaapi should_reanalyze(const insn_t &insn))
 Find and delete wrong frame info.
idaman void ida_export build_stkvar_xrefs_ea (xreflist_t *out, ea_t func_ea, uval_t start_offset, uval_t end_offset)
 Fill 'out' with a list of all the xrefs from a function to the specified range of the function's stack frame.
idaman int ida_export add_func_regvar (ea_t func_ea, ea_t ea1, ea_t ea2, const char *canon, const char *user, const char *cmt)
 Define a register variable.
idaman ssize_t ida_export find_func_regvar (regvar_t *rv, ea_t func_ea, ea_t ea1, ea_t ea2, const char *canon, const char *user)
 Find a register variable definition (powerful version).
ssize_t find_func_regvar (regvar_t *rv, ea_t func_ea, ea_t ea, const char *canon)
 Find a register variable definition.
bool has_func_regvar (ea_t func_ea, ea_t ea)
 Is there a register variable definition?
DEPRECATED bool has_regvar (func_t *pfn, ea_t ea)
 Is there a register variable definition?
idaman int ida_export rename_func_regvar (ea_t func_ea, ssize_t index, const char *user)
 Rename a register variable.
idaman int ida_export set_func_regvar_cmt (ea_t func_ea, ssize_t index, const char *cmt)
 Set comment for a register variable.
idaman int ida_export set_func_regvar_range (ea_t func_ea, ssize_t index, const range_t &range)
 Update the address range of a register variable by index.
idaman int ida_export del_func_regvar (ea_t func_ea, ea_t ea1, ea_t ea2, const char *canon)
 Delete a register variable definition.
idaman size_t ida_export get_func_regvar_qty (ea_t func_ea)
 Get the number of register variables for a function.
idaman bool ida_export get_func_regvars (regvars_t *out, ea_t func_ea)
 Get all register variables for a function.
idaman bool ida_export get_func_regvar (regvar_t *out, ea_t func_ea, ssize_t index)
 Get a copy of a register variable by index.
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.
idaman size_t ida_export get_func_llabel_qty (ea_t func_ea)
 Get the number of local labels for a function.
idaman bool ida_export get_func_llabels (llabels_t *out, ea_t func_ea)
 Get all local labels for a function.
typedef qvector< regvar_tregvars_t
 DECLARE_TYPE_AS_MOVABLE (regvar_t)
idaman DEPRECATED int ida_export add_regvar (func_t *pfn, ea_t ea1, ea_t ea2, const char *canon, const char *user, const char *cmt)
 Define a register variable.
idaman DEPRECATED regvar_t *ida_export find_regvar (func_t *pfn, ea_t ea1, ea_t ea2, const char *canon, const char *user)
 Find a register variable definition (powerful version).
DEPRECATED regvar_tfind_regvar (func_t *pfn, ea_t ea, const char *canon)
 Find a register variable definition.
idaman DEPRECATED int ida_export rename_regvar (func_t *pfn, regvar_t *v, const char *user)
 Rename a register variable.
idaman DEPRECATED int ida_export set_regvar_cmt (func_t *pfn, regvar_t *v, const char *cmt)
 Set comment for a register variable.
idaman DEPRECATED int ida_export del_regvar (func_t *pfn, ea_t ea1, ea_t ea2, const char *canon)
 Delete a register variable definition.

Detailed Description

Routines to manipulate function stack frames, stack variables, register variables and local labels.

The frame is represented as a structure:

  +------------------------------------------------+
  | function arguments                             |
  +------------------------------------------------+
  | return address (isn't stored in func_t)        |
  +------------------------------------------------+
  | saved registers (SI, DI, etc - func_t::frregs) |
  +------------------------------------------------+ <- typical BP
  |                                                |  |
  |                                                |  | func_t::fpd
  |                                                |  |
  |                                                | <- real BP
  | local variables (func_t::frsize)               |
  |                                                |
  |                                                |
  +------------------------------------------------+ <- SP

To access the structure of a function frame and stack variables, use:

Typedef Documentation

◆ llabels_t

◆ regvars_t

◆ xreflist_t

vector of xrefs to variables in a function's stack frame

Enumeration Type Documentation

◆ frame_part_t

Parts of a frame.

Enumerator
FPC_ARGS 
FPC_RETADDR 
FPC_SAVREGS 
FPC_LVARS 

Function Documentation

◆ DECLARE_TYPE_AS_MOVABLE() [1/4]

DECLARE_TYPE_AS_MOVABLE ( stkpnt_t )

◆ DECLARE_TYPE_AS_MOVABLE() [2/4]

DECLARE_TYPE_AS_MOVABLE ( llabel_t )

◆ add_frame()

idaman DEPRECATED bool ida_export add_frame ( func_t * pfn,
sval_t frsize,
ushort frregs,
asize_t argsize )

Add function frame.

Deprecated
Use add_frame_ea() for safer access.
Parameters
pfnpointer to function structure
frsizesize of function local variables
frregssize of saved registers
argsizesize of function arguments range which will be purged upon return. this parameter is used for __stdcall and __pascal calling conventions. for other calling conventions please pass 0.
Return values
1ok
0failed (no function, frame already exists)

◆ del_frame()

idaman DEPRECATED bool ida_export del_frame ( func_t * pfn)

Delete a function frame.

Deprecated
Use del_frame_ea() for safer access.
Parameters
pfnpointer to function structure
Returns
success

◆ set_frame_size()

idaman DEPRECATED bool ida_export set_frame_size ( func_t * pfn,
asize_t frsize,
ushort frregs,
asize_t argsize )

Set size of function frame.

Deprecated
Use set_frame_size_ea() for safer access. Note: The returned size may not include all stack arguments. It does so only for __stdcall and __fastcall calling conventions. To get the entire frame size for all cases use frame.get_func_frame(pfn).get_size()
Parameters
pfnpointer to function structure
frsizesize of function local variables
frregssize of saved registers
argsizesize of function arguments that will be purged from the stack upon return
Returns
success

◆ get_frame_size()

idaman DEPRECATED asize_t ida_export get_frame_size ( const func_t * pfn)

Get full size of a function frame.

Deprecated
Use get_frame_size_ea() for safer access. This function takes into account size of local variables + size of saved registers + size of return address + number of purged bytes. The purged bytes correspond to the arguments of the functions with __stdcall and __fastcall calling conventions.
Parameters
pfnpointer to function structure, may be nullptr
Returns
size of frame in bytes or zero

◆ get_frame_retsize()

idaman DEPRECATED int ida_export get_frame_retsize ( const func_t * pfn)

Get size of function return address.

Deprecated
Use get_frame_retsize_ea() for safer access.
Parameters
pfnpointer to function structure, can't be nullptr

◆ get_frame_part()

idaman DEPRECATED void ida_export get_frame_part ( range_t * range,
const func_t * pfn,
frame_part_t part )

Get offsets of the frame part in the frame.

Deprecated
Use get_frame_part_ea() for safer access.
Parameters
rangepointer to the output buffer with the frame part start/end(exclusive) offsets, can't be nullptr
pfnpointer to function structure, can't be nullptr
partframe part

◆ get_func_frame()

idaman DEPRECATED bool ida_export get_func_frame ( tinfo_t * out,
const func_t * pfn )

Get type of function frame.

Deprecated
Use get_func_frame_ea() for safer access.
Parameters
[out]outtype info
pfnpointer to function structure
Returns
success

◆ soff_to_fpoff()

DEPRECATED sval_t soff_to_fpoff ( func_t * pfn,
uval_t soff )
inline

Convert struct offsets into fp-relative offsets.

Deprecated
Use soff_to_fpoff_ea() for safer access. This function converts the offsets inside the udt_type_data_t object into the frame pointer offsets (for example, EBP-relative).

◆ update_fpd()

idaman DEPRECATED bool ida_export update_fpd ( func_t * pfn,
asize_t fpd )

Update frame pointer delta.

Deprecated
Use update_fpd_ea() for safer access.
Parameters
pfnpointer to function structure
fpdnew fpd value. cannot be bigger than the local variable range size.
Returns
success

◆ set_purged()

idaman bool ida_export set_purged ( ea_t ea,
int nbytes,
bool override_old_value )

Set the number of purged bytes for a function or data item (funcptr).

This function will update the database and plan to reanalyze items referencing the specified address. It works only for processors with #PR_PURGING bit in 16 and 32 bit modes.

Parameters
eaaddress of the function of item
nbytesnumber of purged bytes
override_old_valuemay overwrite old information about purged bytes
Returns
success

◆ add_stkvar()

idaman bool ida_export add_stkvar ( const insn_t & insn,
const op_t & x,
sval_t v,
int stkvar_flags )

Automatically add stack variable.

Processor modules should use insn_t::create_stkvar().

Parameters
insnthe instruction
xreference to instruction operand
vimmediate value in the operand (usually x.addr)
stkvar_flagsAdd stkvar flags
Returns
success

◆ define_stkvar()

idaman DEPRECATED bool ida_export define_stkvar ( func_t * pfn,
const char * name,
sval_t off,
const tinfo_t & tif,
const struct value_repr_t * repr = nullptr )

Define/redefine a stack variable.

Deprecated
Use define_stkvar_ea() for safer access.
Parameters
pfnpointer to function
namevariable name, nullptr means autogenerate a name
offoffset of the stack variable in the frame. negative values denote local variables, positive - function arguments.
tifvariable type
reprvariable representation
Returns
success

◆ add_frame_member()

idaman DEPRECATED bool ida_export add_frame_member ( const func_t * pfn,
const char * name,
uval_t offset,
const tinfo_t & tif,
const struct value_repr_t * repr = nullptr,
uint etf_flags = 0 )

Add member to the frame type.

Deprecated
Use add_frame_member_ea() for safer access.
Parameters
pfnpointer to function
namevariable name, nullptr means autogenerate a name
offsetmember offset in the frame structure, in bytes
tifvariable type
reprvariable representation
etf_flags
See also
type changing flags
Returns
success

◆ is_anonymous_member_name()

THREAD_SAFE bool is_anonymous_member_name ( const char * name)
inline

Is member name prefixed with "anonymous"?

◆ is_dummy_member_name()

THREAD_SAFE bool is_dummy_member_name ( const char * name)
inline

Is member name an auto-generated name?

◆ is_special_frame_member()

idaman bool ida_export is_special_frame_member ( tid_t tid)

Is stkvar with TID the return address slot or the saved registers slot ?

Parameters
tidframe member type id return address or saved registers member?

◆ set_frame_member_type()

idaman DEPRECATED bool ida_export set_frame_member_type ( const func_t * pfn,
uval_t offset,
const tinfo_t & tif,
const struct value_repr_t * repr = nullptr,
uint etf_flags = 0 )

Change type of the frame member.

Deprecated
Use set_frame_member_type_ea() for safer access.
Parameters
pfnpointer to function
offsetmember offset in the frame structure, in bytes
tifvariable type
reprvariable representation
etf_flags
See also
type changing flags
Returns
success

◆ delete_frame_members()

idaman DEPRECATED bool ida_export delete_frame_members ( const func_t * pfn,
uval_t start_offset,
uval_t end_offset )

Delete frame members.

Deprecated
Use delete_frame_members_ea() for safer access.
Parameters
pfnpointer to function
start_offsetmember offset to start deletion from, in bytes
end_offsetmember offset which not included in the deletion, in bytes
Returns
success

◆ build_stkvar_name()

idaman DEPRECATED ssize_t ida_export build_stkvar_name ( qstring * buf,
const func_t * pfn,
sval_t v )

Build automatic stack variable name.

Deprecated
Use build_stkvar_name_ea() for safer access.
Parameters
bufpointer to buffer
pfnpointer to function (can't be nullptr!)
vvalue of variable offset
Returns
length of stack variable name or -1

◆ calc_stkvar_struc_offset()

idaman DEPRECATED ea_t ida_export calc_stkvar_struc_offset ( func_t * pfn,
const insn_t & insn,
int n )

Calculate offset of stack variable in the frame structure.

Deprecated
Use calc_stkvar_struc_offset_ea() for safer access.
Parameters
pfnpointer to function (cannot be nullptr)
insnthe instruction
n0..#UA_MAXOP-1 operand number -1 if error, return #BADADDR
Returns
#BADADDR if some error (issue a warning if stack frame is bad)

◆ calc_frame_offset()

idaman DEPRECATED sval_t ida_export calc_frame_offset ( func_t * pfn,
sval_t off,
const insn_t * insn = nullptr,
const op_t * op = nullptr )

Calculate the offset of stack variable in the frame.

Deprecated
Use calc_frame_offset_ea() for safer access.
Parameters
pfnpointer to function (cannot be nullptr)
offthe offset relative to stack pointer or frame pointer
insnthe instruction
opthe operand
Returns
the offset in the frame

◆ delete_wrong_frame_info()

idaman DEPRECATED int ida_export delete_wrong_frame_info ( func_t * pfn,
bool idaapi should_reanalyzeconst insn_t &insn )

Find and delete wrong frame info.

Deprecated
Use delete_wrong_frame_info_ea() for safer access. Namely, we delete:
  • unreferenced stack variable definitions
  • references to dead stack variables (i.e. operands displayed in red) these operands will be untyped and most likely displayed in hex.

We also plan to reanalyze instruction with the stack frame references

Parameters
pfnpointer to the function
should_reanalyzecallback to determine which instructions to reanalyze
Returns
number of deleted definitions

◆ DECLARE_TYPE_AS_MOVABLE() [3/4]

DECLARE_TYPE_AS_MOVABLE ( regvar_t )

◆ add_regvar()

idaman DEPRECATED int ida_export add_regvar ( func_t * pfn,
ea_t ea1,
ea_t ea2,
const char * canon,
const char * user,
const char * cmt )

Define a register variable.

Deprecated
Use add_func_regvar() for safer access.
Parameters
pfnfunction in which the definition will be created
ea1,ea2range of addresses within the function where the definition will be used
canonname of a general register
useruser-defined name for the register
cmtcomment for the definition
Returns
Register variable error codes

◆ find_regvar() [1/2]

idaman DEPRECATED regvar_t *ida_export find_regvar ( func_t * pfn,
ea_t ea1,
ea_t ea2,
const char * canon,
const char * user )

Find a register variable definition (powerful version).

Deprecated
Use find_func_regvar() for safer access. One of 'canon' and 'user' should be nullptr. If both 'canon' and 'user' are nullptr it returns the first regvar definition in the range.
Parameters
pfnfunction in question
ea1,ea2range of addresses to search. ea1==BADADDR means the entire function
canonname of a general register
useruser-defined name for the register
Returns
nullptr-not found, otherwise ptr to regvar_t

◆ find_regvar() [2/2]

DEPRECATED regvar_t * find_regvar ( func_t * pfn,
ea_t ea,
const char * canon )
inline

Find a register variable definition.

Deprecated
Use find_func_regvar() for safer access.
Parameters
pfnfunction in question
eacurrent address
canonname of a general register
Returns
nullptr-not found, otherwise ptr to regvar_t

◆ rename_regvar()

idaman DEPRECATED int ida_export rename_regvar ( func_t * pfn,
regvar_t * v,
const char * user )

Rename a register variable.

Deprecated
Use rename_func_regvar() for safer access.
Parameters
pfnfunction in question
vvariable to rename
usernew user-defined name for the register
Returns
Register variable error codes

◆ set_regvar_cmt()

idaman DEPRECATED int ida_export set_regvar_cmt ( func_t * pfn,
regvar_t * v,
const char * cmt )

Set comment for a register variable.

Deprecated
Use set_func_regvar_cmt() for safer access.
Parameters
pfnfunction in question
vvariable to rename
cmtnew comment
Returns
Register variable error codes

◆ del_regvar()

idaman DEPRECATED int ida_export del_regvar ( func_t * pfn,
ea_t ea1,
ea_t ea2,
const char * canon )

Delete a register variable definition.

Deprecated
Use del_func_regvar() for safer access.
Parameters
pfnfunction in question
ea1,ea2range of addresses within the function where the definition holds
canonname of a general register
Returns
Register variable error codes

◆ add_auto_stkpnt()

idaman DEPRECATED bool ida_export add_auto_stkpnt ( func_t * pfn,
ea_t ea,
sval_t delta )

Add automatic SP register change point.

Deprecated
Use add_func_auto_stkpnt() for safer access.
Parameters
pfnpointer to the function. may be nullptr.
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

◆ add_user_stkpnt()

idaman bool ida_export add_user_stkpnt ( ea_t ea,
sval_t delta )

Add user-defined SP register change point.

Parameters
ealinear address where SP changes
deltadifference between old and new values of SP
Returns
success

◆ del_stkpnt()

idaman DEPRECATED bool ida_export del_stkpnt ( func_t * pfn,
ea_t ea )

Delete SP register change point.

Deprecated
Use del_func_stkpnt() for safer access.
Parameters
pfnpointer to the function. may be nullptr.
ealinear address
Returns
success

◆ get_spd()

idaman DEPRECATED sval_t ida_export get_spd ( func_t * pfn,
ea_t ea )

Get difference between the initial and current values of ESP.

Deprecated
Use get_func_spd() for safer access.
Parameters
pfnpointer to the function. may be nullptr.
ealinear address of the instruction
Returns
0 or the difference, usually a negative number. returns the sp-diff before executing the instruction.

◆ get_effective_spd()

idaman DEPRECATED sval_t ida_export get_effective_spd ( func_t * pfn,
ea_t ea )

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

Deprecated
Use get_func_effective_spd() for safer access. This function returns the sp-diff used by the instruction. The difference between get_spd() and get_effective_spd() is present only for instructions like "pop [esp+N]": they modify sp and use the modified value.
Parameters
pfnpointer to the function. may be nullptr.
ealinear address
Returns
0 or the difference, usually a negative number

◆ get_sp_delta()

idaman DEPRECATED sval_t ida_export get_sp_delta ( func_t * pfn,
ea_t ea )

Get modification of SP made at the specified location.

Deprecated
Use get_func_sp_delta() for safer access.
Parameters
pfnpointer to the function. may be nullptr.
ealinear address
Returns
0 if the specified location doesn't contain a SP change point. otherwise return delta of SP modification.

◆ set_auto_spd()

idaman DEPRECATED bool ida_export set_auto_spd ( func_t * pfn,
ea_t ea,
sval_t new_spd )

Add such an automatic SP register change point so that at EA the new cumulative SP delta (that is, the difference between the initial and current values of SP) would be equal to NEW_SPD.

Deprecated
Use set_func_auto_spd() for safer access.
Parameters
pfnpointer to the function. may be nullptr.
ealinear address of the instruction
new_spdnew value of the cumulative SP delta
Returns
success

◆ recalc_spd()

idaman bool ida_export recalc_spd ( ea_t cur_ea)

Recalculate SP delta for an instruction that stops execution.

The next instruction is not reached from the current instruction. We need to recalculate SP for the next instruction.

This function will create a new automatic SP register change point if necessary. It should be called from the emulator (emu.cpp) when auto_state == AU_USED if the current instruction doesn't pass the execution flow to the next instruction.

Parameters
cur_ealinear address of the current instruction
Return values
1new stkpnt is added
0nothing is changed

◆ recalc_spd_for_basic_block()

idaman DEPRECATED bool ida_export recalc_spd_for_basic_block ( func_t * pfn,
ea_t cur_ea )

Recalculate SP delta for the current instruction.

Deprecated
Use recalc_func_spd_for_basic_block() for safer access. The typical code snippet to calculate SP delta in a proc module is:
if ( may_trace_sp() && pfn != nullptr )
  if ( !recalc_spd_for_basic_block(pfn, insn.ea) )
    trace_sp(pfn, insn);

where trace_sp() is a typical name for a function that emulates the SP change of an instruction.

Parameters
pfnpointer to 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.

◆ DECLARE_TYPE_AS_MOVABLE() [4/4]

DECLARE_TYPE_AS_MOVABLE ( xreflist_entry_t )

◆ build_stkvar_xrefs()

idaman DEPRECATED void ida_export build_stkvar_xrefs ( xreflist_t * out,
func_t * pfn,
uval_t start_offset,
uval_t end_offset )

Fill 'out' with a list of all the xrefs made from function 'pfn' to specified range of the pfn's stack frame.

Deprecated
Use build_stkvar_xrefs_ea() for safer access.
Parameters
outthe list of xrefs to fill.
pfnthe function to scan.
start_offsetstart frame structure offset, in bytes
end_offsetend frame structure offset, in bytes