IDA C++ SDK 9.2
Loading...
Searching...
No Matches
ea-based stack variables

Functions

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.

Detailed Description

Function Documentation

◆ define_stkvar_ea()

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.

Parameters
func_eaany address of the 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_ea()

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.

Parameters
func_eaany address of the 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

◆ set_frame_member_type_ea()

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.

Parameters
func_eaany address of the 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_ea()

idaman bool ida_export delete_frame_members_ea ( ea_t func_ea,
uval_t start_offset,
uval_t end_offset )

Delete frame members.

Parameters
func_eaany address of the 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_ea()

idaman ssize_t ida_export build_stkvar_name_ea ( qstring * buf,
ea_t func_ea,
sval_t v )

Build automatic stack variable name.

Parameters
bufpointer to buffer
func_eaany address of the function
vvalue of variable offset
Returns
length of stack variable name or -1

◆ calc_stkvar_struc_offset_ea()

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.

Parameters
func_eaany address of the function
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_ea()

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.

Parameters
func_eaany address of the function
offthe offset relative to stack pointer or frame pointer
insnthe instruction
opthe operand
Returns
the offset in the frame

◆ delete_wrong_frame_info_ea()

idaman int ida_export delete_wrong_frame_info_ea ( ea_t func_ea,
bool idaapi should_reanalyzeconst insn_t &insn )

Find and delete wrong frame info.

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
func_eaany address of the function
should_reanalyzecallback to determine which instructions to reanalyze
Returns
number of deleted definitions or -1 if no function

◆ build_stkvar_xrefs_ea()

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.

Parameters
outthe list of xrefs to fill
func_eaany address of the function
start_offsetstart frame structure offset, in bytes
end_offsetend frame structure offset, in bytes