Module ida_frame
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, use:
tinfo_t::get_func_frame(const func_t *pfn) (the preferred way)
get_func_frame(tinfo_t *out, const func_t *pfn)
Global Variables
FPC_ARGS
FPC_LVARS
FPC_RETADDR
FPC_SAVREGS
FRAME_UDM_NAME_R
FRAME_UDM_NAME_S
REGVAR_ERROR_ARG
REGVAR_ERROR_NAME
REGVAR_ERROR_OK
REGVAR_ERROR_RANGE
STKVAR_VALID_SIZE
Functions
add_auto_stkpnt(pfn: func_t *, ea: ea_t, delta: sval_t) ‑> bool
add_auto_stkpnt(pfn, ea, delta) -> bool Add automatic SP register change point.
add_frame(pfn: func_t *, frsize: sval_t, frregs: ushort, argsize: asize_t) ‑> bool
add_frame(pfn, frsize, frregs, argsize) -> bool Add function frame.
add_frame_member(pfn: func_t const *, name: char const *, offset: uval_t, tif: tinfo_t, repr: value_repr_t = None, etf_flags: uint = 0) ‑> bool
add_frame_member(pfn, name, offset, tif, repr=None, etf_flags=0) -> bool Add member to the frame type
@see: type changing flags return: success
add_regvar(pfn: func_t *, ea1: ea_t, ea2: ea_t, canon: char const *, user: char const *, cmt: char const *) ‑> int
add_regvar(pfn, ea1, ea2, canon, user, cmt) -> int Define a register variable.
add_user_stkpnt(ea: ea_t, delta: sval_t) ‑> bool
add_user_stkpnt(ea, delta) -> bool Add user-defined SP register change point.
build_stkvar_name(pfn: func_t const *, v: sval_t) ‑> qstring *
build_stkvar_name(pfn, v) -> str Build automatic stack variable name.
build_stkvar_xrefs(out: xreflist_t, pfn: func_t *, start_offset: uval_t, end_offset: uval_t) ‑> void
build_stkvar_xrefs(out, pfn, start_offset, end_offset) Fill 'out' with a list of all the xrefs made from function 'pfn' to specified range of the pfn's stack frame.
calc_frame_offset(pfn: func_t *, off: sval_t, insn: insn_t const * = None, op: op_t const * = None) ‑> sval_t
calc_frame_offset(pfn, off, insn=None, op=None) -> sval_t Calculate the offset of stack variable in the frame.
calc_stkvar_struc_offset(pfn: func_t *, insn: insn_t const &, n: int) ‑> ea_t
calc_stkvar_struc_offset(pfn, insn, n) -> ea_t Calculate offset of stack variable in the frame structure.
define_stkvar(pfn: func_t *, name: char const *, off: sval_t, tif: tinfo_t, repr: value_repr_t = None) ‑> bool
define_stkvar(pfn, name, off, tif, repr=None) -> bool Define/redefine a stack variable.
del_frame(pfn: func_t *) ‑> bool
del_frame(pfn) -> bool Delete a function frame.
del_regvar(pfn: func_t *, ea1: ea_t, ea2: ea_t, canon: char const *) ‑> int
del_regvar(pfn, ea1, ea2, canon) -> int Delete a register variable definition.
del_stkpnt(pfn: func_t *, ea: ea_t) ‑> bool
del_stkpnt(pfn, ea) -> bool Delete SP register change point.
delete_frame_members(pfn: func_t const *, start_offset: uval_t, end_offset: uval_t) ‑> bool
delete_frame_members(pfn, start_offset, end_offset) -> bool Delete frame members
find_regvar(*args) ‑> regvar_t *
find_regvar(pfn, ea1, ea2, canon, user) -> regvar_t Find a register variable definition.
find_regvar(pfn, ea, canon) -> regvar_t
frame_off_args(pfn: func_t const *) ‑> ea_t
frame_off_args(pfn) -> ea_t Get starting address of arguments section.
frame_off_lvars(pfn: func_t const *) ‑> ea_t
frame_off_lvars(pfn) -> ea_t Get start address of local variables section.
frame_off_retaddr(pfn: func_t const *) ‑> ea_t
frame_off_retaddr(pfn) -> ea_t Get starting address of return address section.
frame_off_savregs(pfn: func_t const *) ‑> ea_t
frame_off_savregs(pfn) -> ea_t Get starting address of saved registers section.
free_regvar(v: regvar_t) ‑> void
free_regvar(v)
get_effective_spd(pfn: func_t *, ea: ea_t) ‑> sval_t
get_effective_spd(pfn, ea) -> sval_t 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_spd() and get_effective_spd() is present only for instructions like "pop [esp+N]": they modify sp and use the modified value.
get_frame_part(range: range_t, pfn: func_t const *, part: frame_part_t) ‑> void
get_frame_part(range, pfn, part) Get offsets of the frame part in the frame.
get_frame_retsize(pfn: func_t const *) ‑> int
get_frame_retsize(pfn) -> int Get size of function return address.
get_frame_size(pfn: func_t const *) ‑> asize_t
get_frame_size(pfn) -> asize_t Get full size of a function frame. 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.
get_func_frame(out: tinfo_t, pfn: func_t const *) ‑> bool
get_func_frame(out, pfn) -> bool
get_sp_delta(pfn: func_t *, ea: ea_t) ‑> sval_t
get_sp_delta(pfn, ea) -> sval_t Get modification of SP made at the specified location
get_spd(pfn: func_t *, ea: ea_t) ‑> sval_t
get_spd(pfn, ea) -> sval_t Get difference between the initial and current values of ESP.
has_regvar(pfn: func_t *, ea: ea_t) ‑> bool
has_regvar(pfn, ea) -> bool Is there a register variable definition?
is_anonymous_member_name(name: char const *) ‑> bool
is_anonymous_member_name(name) -> bool Is member name prefixed with "anonymous"?
is_dummy_member_name(name: char const *) ‑> bool
is_dummy_member_name(name) -> bool Is member name an auto-generated name?
is_funcarg_off(pfn: func_t const *, frameoff: uval_t) ‑> bool
is_funcarg_off(pfn, frameoff) -> bool
is_special_frame_member(tid: tid_t) ‑> bool
is_special_frame_member(tid) -> bool Is stkvar with TID the return address slot or the saved registers slot ?
lvar_off(pfn: func_t const *, frameoff: uval_t) ‑> sval_t
lvar_off(pfn, frameoff) -> sval_t
recalc_spd(cur_ea: ea_t) ‑> bool
recalc_spd(cur_ea) -> bool 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.
recalc_spd_for_basic_block(pfn: func_t *, cur_ea: ea_t) ‑> bool
recalc_spd_for_basic_block(pfn, cur_ea) -> bool Recalculate SP delta for the current instruction. 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.
rename_regvar(pfn: func_t *, v: regvar_t, user: char const *) ‑> int
rename_regvar(pfn, v, user) -> int Rename a register variable.
set_auto_spd(pfn: func_t *, ea: ea_t, new_spd: sval_t) ‑> bool
set_auto_spd(pfn, ea, new_spd) -> bool 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.
set_frame_member_type(pfn: func_t const *, offset: uval_t, tif: tinfo_t, repr: value_repr_t = None, etf_flags: uint = 0) ‑> bool
set_frame_member_type(pfn, offset, tif, repr=None, etf_flags=0) -> bool Change type of the frame member
@see: type changing flags return: success
set_frame_size(pfn: func_t *, frsize: asize_t, frregs: ushort, argsize: asize_t) ‑> bool
set_frame_size(pfn, frsize, frregs, argsize) -> bool Set size of function frame. 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()
set_purged(ea: ea_t, nbytes: int, override_old_value: bool) ‑> bool
set_purged(ea, nbytes, override_old_value) -> bool 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.
set_regvar_cmt(pfn: func_t *, v: regvar_t, cmt: char const *) ‑> int
set_regvar_cmt(pfn, v, cmt) -> int Set comment for a register variable.
soff_to_fpoff(pfn: func_t *, soff: uval_t) ‑> sval_t
soff_to_fpoff(pfn, soff) -> sval_t Convert struct offsets into fp-relative offsets. This function converts the offsets inside the udt_type_data_t object into the frame pointer offsets (for example, EBP-relative).
update_fpd(pfn: func_t *, fpd: asize_t) ‑> bool
update_fpd(pfn, fpd) -> bool Update frame pointer delta.
Classes
regvar_t(*args)
: Proxy of C++ regvar_t class.
Ancestors (in MRO)
Instance variables
canon: char *
canon
cmt: char *
cmt
user: char *
user
Methods
swap(self, r: regvar_t) ‑> void swap(self, r)
r: regvar_t &
stkpnt_t()
: Proxy of C++ stkpnt_t class.
Instance variables
ea: ea_t
ea
spd: sval_t
spd
Methods
compare(self, r: stkpnt_t) ‑> int compare(self, r) -> int
r: stkpnt_t const &
stkpnts_t()
: Proxy of C++ stkpnts_t class.
Methods
compare(self, r: stkpnts_t) ‑> int compare(self, r) -> int
r: stkpnts_t const &
xreflist_entry_t()
: Proxy of C++ xreflist_entry_t class.
Instance variables
ea: ea_t
ea
opnum: uchar
opnum
type: uchar
type
Methods
compare(self, r: xreflist_entry_t) ‑> int compare(self, r) -> int
r: xreflist_entry_t const &
xreflist_t(*args)
: Proxy of C++ qvector< xreflist_entry_t > class.
Methods
add_unique(self, x: xreflist_entry_t) ‑> bool add_unique(self, x) -> bool
x: xreflist_entry_t const &
at(self, _idx: size_t) ‑> xreflist_entry_t const & at(self, _idx) -> xreflist_entry_t
_idx: size_t
back(self)
begin(self, *args) ‑> qvector< xreflist_entry_t >::const_iterator begin(self) -> xreflist_entry_t
capacity(self) ‑> size_t capacity(self) -> size_t
clear(self) ‑> void clear(self)
empty(self) ‑> bool empty(self) -> bool
end(self, *args) ‑> qvector< xreflist_entry_t >::const_iterator end(self) -> xreflist_entry_t
erase(self, *args) ‑> qvector< xreflist_entry_t >::iterator erase(self, it) -> xreflist_entry_t
it: qvector< xreflist_entry_t >::iterator
erase(self, first, last) -> xreflist_entry_t
first: qvector< xreflist_entry_t >::iterator last: qvector< xreflist_entry_t >::iterator
extract(self) ‑> xreflist_entry_t * extract(self) -> xreflist_entry_t
find(self, *args) ‑> qvector< xreflist_entry_t >::const_iterator find(self, x) -> xreflist_entry_t
x: xreflist_entry_t const &
front(self)
grow(self, *args) ‑> void grow(self, x=xreflist_entry_t())
x: xreflist_entry_t const &
has(self, x: xreflist_entry_t) ‑> bool has(self, x) -> bool
x: xreflist_entry_t const &
inject(self, s: xreflist_entry_t, len: size_t) ‑> void inject(self, s, len)
s: xreflist_entry_t * len: size_t
insert(self, it: xreflist_entry_t, x: xreflist_entry_t) ‑> qvector< xreflist_entry_t >::iterator insert(self, it, x) -> xreflist_entry_t
it: qvector< xreflist_entry_t >::iterator x: xreflist_entry_t const &
pop_back(self) ‑> void pop_back(self)
push_back(self, *args) ‑> xreflist_entry_t & push_back(self, x)
x: xreflist_entry_t const &
push_back(self) -> xreflist_entry_t
qclear(self) ‑> void qclear(self)
reserve(self, cnt: size_t) ‑> void reserve(self, cnt)
cnt: size_t
resize(self, *args) ‑> void resize(self, _newsize, x)
_newsize: size_t x: xreflist_entry_t const &
resize(self, _newsize)
_newsize: size_t
size(self) ‑> size_t size(self) -> size_t
swap(self, r: xreflist_t) ‑> void swap(self, r)
r: qvector< xreflist_entry_t > &
truncate(self) ‑> void truncate(self)
Last updated