44#define FRAME_UDM_NAME_R "__return_address"
46#define FRAME_UDM_NAME_S "__saved_registers"
198 return pfn !=
nullptr ? soff - pfn->
frsize + pfn->
fpd : soff;
245#define STKVAR_VALID_SIZE 0x0001
249#define STKVAR_KEEP_EXISTING 0x0002
294 return name ==
nullptr
295 || strncmp(name,
"anonymous", 9) == 0;
303 return name ==
nullptr
304 || strncmp(name,
"arg_", 4) == 0
305 || strncmp(name,
"var_", 4) == 0
385 const insn_t *insn =
nullptr,
386 const op_t *op =
nullptr);
403 bool idaapi should_reanalyze(
const insn_t &insn));
410#define DECLARE_REGVAR_T_HELPERS(decl)\
411decl int ida_export regvar_t__compare(const regvar_t &l, const regvar_t &r); \
413DECLARE_REGVAR_T_HELPERS(idaman)
419idaman
void ida_export free_regvar(
struct regvar_t *v);
459 DECLARE_REGVAR_T_HELPERS(
friend)
506 if ( pfn ==
nullptr )
835 ? frameoff <
args.end_ea
836 : frameoff >=
args.start_ea;
850 : lvars.
end_ea - frameoff;
878 if ( pfn ==
nullptr )
884 ? frameoff <
args.end_ea
885 : frameoff >=
args.start_ea;
893 if ( pfn ==
nullptr )
900 : lvars.
end_ea - frameoff;
1036 const insn_t *insn=
nullptr,
1037 const op_t *op=
nullptr);
1053 bool idaapi should_reanalyze(
const insn_t &insn));
1097#define REGVAR_ERROR_OK 0
1098#define REGVAR_ERROR_ARG (-1)
1099#define REGVAR_ERROR_RANGE (-2)
1100#define REGVAR_ERROR_NAME (-3)
1144 return find_func_regvar(
nullptr, func_ea, ea, ea+1,
nullptr,
nullptr) != -1;
A function is a set of continuous ranges of addresses with characteristics.
Definition funcs.hpp:106
asize_t fpd
frame pointer delta.
Definition funcs.hpp:198
asize_t frsize
size of local variables part of frame in bytes.
Definition funcs.hpp:190
Operand of an instruction.
Definition ua.hpp:170
Reimplementation of vector class from STL.
Definition pro.h:2262
qvector(void)
Definition pro.h:2374
Primary mechanism for managing type information.
Definition typeinf.hpp:3077
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 int ida_export del_regvar(func_t *pfn, ea_t ea1, ea_t ea2, const char *canon)
Delete a register variable definition.
idaman DEPRECATED int ida_export get_frame_retsize(const func_t *pfn)
Get size of function return address.
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.
THREAD_SAFE bool is_dummy_member_name(const char *name)
Is member name an auto-generated name?
Definition frame.hpp:301
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 stac...
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 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).
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 sval_t soff_to_fpoff(func_t *pfn, uval_t soff)
Convert struct offsets into fp-relative offsets.
Definition frame.hpp:196
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 bool ida_export del_frame(func_t *pfn)
Delete a function frame.
idaman DEPRECATED asize_t ida_export get_frame_size(const func_t *pfn)
Get full size of a function frame.
qvector< llabel_t > llabels_t
Definition frame.hpp:95
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 int ida_export delete_wrong_frame_info(func_t *pfn, bool idaapi should_reanalyze(const insn_t &insn))
Find and delete wrong frame info.
frame_part_t
Parts of a frame.
Definition frame.hpp:166
@ FPC_LVARS
Definition frame.hpp:170
@ FPC_ARGS
Definition frame.hpp:167
@ FPC_RETADDR
Definition frame.hpp:168
@ FPC_SAVREGS
Definition frame.hpp:169
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).
qvector< xreflist_entry_t > xreflist_t
vector of xrefs to variables in a function's stack frame
Definition frame.hpp:682
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 bool ida_export set_frame_size(func_t *pfn, asize_t frsize, ushort frregs, asize_t argsize)
Set size of function frame.
idaman DEPRECATED bool ida_export del_stkpnt(func_t *pfn, ea_t ea)
Delete SP register change point.
idaman DEPRECATED bool ida_export recalc_spd_for_basic_block(func_t *pfn, ea_t cur_ea)
Recalculate SP delta for the current instruction.
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,...
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 get_effective_spd(func_t *pfn, ea_t ea)
Get effective difference between the initial and current values of ESP.
idaman DEPRECATED bool ida_export update_fpd(func_t *pfn, asize_t fpd)
Update frame pointer delta.
idaman bool ida_export add_user_stkpnt(ea_t ea, sval_t delta)
Add user-defined SP register change point.
qvector< regvar_t > regvars_t
Definition frame.hpp:462
THREAD_SAFE bool is_anonymous_member_name(const char *name)
Is member name prefixed with "anonymous"?
Definition frame.hpp:292
idaman DEPRECATED bool ida_export add_auto_stkpnt(func_t *pfn, ea_t ea, sval_t delta)
Add automatic SP register change point.
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.
DECLARE_TYPE_AS_MOVABLE(stkpnt_t)
idaman DEPRECATED bool ida_export get_func_frame(tinfo_t *out, const func_t *pfn)
Get type of function frame.
idaman DEPRECATED int ida_export rename_regvar(func_t *pfn, regvar_t *v, const char *user)
Rename a register variable.
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 set_regvar_cmt(func_t *pfn, regvar_t *v, const char *cmt)
Set comment for a register variable.
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 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.
idaman bool ida_export recalc_spd(ea_t cur_ea)
Recalculate SP delta for an instruction that stops execution.
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 add_frame(func_t *pfn, sval_t frsize, ushort frregs, asize_t argsize)
Add function frame.
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.
idaman bool ida_export del_frame_ea(ea_t func_ea)
Delete a function frame.
DEPRECATED ea_t frame_off_retaddr(const func_t *pfn)
Get starting address of return address section.
Definition frame.hpp:861
DEPRECATED ea_t frame_off_lvars(const func_t *pfn)
Get start address of local variables section.
Definition frame.hpp:871
idaman int ida_export get_frame_retsize_ea(ea_t func_ea)
Get size of function return address.
idaman bool ida_export get_func_frame_ea(tinfo_t *out, ea_t func_ea)
Get type of function frame.
bool is_funcarg_off_ea(ea_t func_ea, uval_t frameoff) const
Does the given offset lie within the arguments section?
Definition frame.hpp:829
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 bool ida_export add_frame_ea(ea_t func_ea, sval_t frsize, ushort frregs, asize_t argsize)
Add function frame.
ea_t frame_off_retaddr_ea(ea_t func_ea)
Get starting address of return address section.
Definition frame.hpp:793
sval_t lvar_off(const func_t *pfn, uval_t frameoff) const
Does the given offset lie within the local variables section?
Definition frame.hpp:891
idaman sval_t ida_export soff_to_fpoff_ea(ea_t func_ea, uval_t soff)
Convert struct offsets into fp-relative offsets.
bool is_funcarg_off(const func_t *pfn, uval_t frameoff) const
Does the given offset lie within the arguments section?
Definition frame.hpp:876
ea_t frame_off_lvars_ea(ea_t func_ea)
Get start address of local variables section.
Definition frame.hpp:817
DEPRECATED ea_t frame_off_savregs(const func_t *pfn)
Get starting address of saved registers section.
Definition frame.hpp:866
sval_t lvar_off_ea(ea_t func_ea, uval_t frameoff) const
Does the given offset lie within the local variables section?
Definition frame.hpp:843
DEPRECATED ea_t frame_off_args(const func_t *pfn)
Get starting address of arguments section.
Definition frame.hpp:856
ea_t frame_off_args_ea(ea_t func_ea)
Get starting address of arguments section.
Definition frame.hpp:781
ea_t frame_off_savregs_ea(ea_t func_ea)
Get starting address of saved registers section.
Definition frame.hpp:805
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.
idaman bool ida_export update_fpd_ea(ea_t func_ea, asize_t fpd)
Update frame pointer delta.
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 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.
DEPRECATED bool has_regvar(func_t *pfn, ea_t ea)
Is there a register variable definition?
Definition frame.hpp:1153
idaman bool ida_export get_func_regvars(regvars_t *out, ea_t func_ea)
Get all register variables for a function.
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 size_t ida_export get_func_regvar_qty(ea_t func_ea)
Get the number of register variables for a function.
idaman int ida_export rename_func_regvar(ea_t func_ea, ssize_t index, const char *user)
Rename 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).
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 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.
bool has_func_regvar(ea_t func_ea, ea_t ea)
Is there a register variable definition?
Definition frame.hpp:1142
idaman bool ida_export get_func_stkpnts(stkpnts_t *out, ea_t func_ea)
Get all SP change points for a function.
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 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 bool ida_export del_func_stkpnt(ea_t func_ea, ea_t ea)
Delete SP register change point.
idaman size_t ida_export get_func_stkpnt_qty(ea_t func_ea)
Get the number of SP change points for a function.
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 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 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 recalc_func_spd_for_basic_block(ea_t func_ea, ea_t cur_ea)
Recalculate SP delta for the current instruction.
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 ssize_t ida_export build_stkvar_name_ea(qstring *buf, ea_t func_ea, sval_t v)
Build automatic stack variable name.
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 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 stac...
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 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 bool ida_export delete_frame_members_ea(ea_t func_ea, uval_t start_offset, uval_t end_offset)
Delete frame members.
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 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.
int code
Definition fpro.h:88
idaman size_t n
Definition pro.h:1000
GCC_DIAG_OFF(format-nonliteral)
GCC_DIAG_ON(format-nonliteral)
MSC_DIAG_ON(4996) GCC_DIAG_ON(deprecated-declarations) struct decomp_item_iterator_t
Item iterator for decomp_ranges_t.
Definition hexrays.hpp:5068
carglist_t * args
Definition hexrays.hpp:7720
Contains definition of the interface to IDP modules.
int nbytes
Definition kernwin.hpp:3037
uval_t uval_t
Definition kernwin.hpp:1926
MSC_DIAG_OFF(4826) struct cast_t
Preprocessor cast.
Definition lex.hpp:78
uint64 asize_t
Definition pro.h:427
adiff_t sval_t
signed value used by the processor.
Definition pro.h:450
uint64 ea_t
Definition pro.h:425
unsigned char uchar
unsigned 8 bit value
Definition pro.h:341
idaman THREAD_SAFE char *ida_export qstrdup(const char *string)
System independent strdup.
unsigned int uint
unsigned 32 bit value
Definition pro.h:343
ptrdiff_t ssize_t
Signed size_t - used to check for size overflows when the counter becomes negative.
Definition pro.h:385
unsigned short ushort
unsigned 16 bit value
Definition pro.h:342
ea_t tid_t
type id (for enums, structs, etc)
Definition pro.h:5107
int compare_containers(const T &l, const T &r)
Template to compare any 2 containers of the same type. Returns -1/0/1.
Definition pro.h:4648
_qstring< char > qstring
regular string
Definition pro.h:3771
int compare(const T &a, const T &b)
Definition pro.h:4607
Local label.
Definition frame.hpp:81
DECLARE_COMPARISONS(llabel_t)
Definition frame.hpp:85
ea_t ea
linear address
Definition frame.hpp:82
qstring name
label name
Definition frame.hpp:83
bool stkup(void) const
PR_STACK_UP
Definition idp.hpp:645
Base class for an range.
Definition range.hpp:35
ea_t end_ea
end_ea excluded
Definition range.hpp:38
ea_t start_ea
start_ea included
Definition range.hpp:37
range_t(ea_t ea1=0, ea_t ea2=0)
Definition range.hpp:39
A register variable allows the user to rename a general processor register to a meaningful name.
Definition frame.hpp:426
char * canon
canonical register name (case-insensitive)
Definition frame.hpp:427
char * cmt
comment to appear near definition
Definition frame.hpp:429
regvar_t & operator=(const regvar_t &r)
Definition frame.hpp:439
~regvar_t()
Definition frame.hpp:438
char * user
user-defined register name
Definition frame.hpp:428
void swap(regvar_t &r)
Definition frame.hpp:448
regvar_t()
Definition frame.hpp:431
DECLARE_COMPARISONS(regvar_t)
Definition frame.hpp:457
regvar_t(const regvar_t &r)
Definition frame.hpp:432
ea_t ea
Definition frame.hpp:60
sval_t spd
Definition frame.hpp:61
DECLARE_COMPARISONS(stkpnt_t)
Definition frame.hpp:63
DECLARE_COMPARISONS(stkpnts_t)
Definition frame.hpp:76
Visual representation of a member of a complex type (struct/union/enum)
Definition typeinf.hpp:5294
An xref to an argument or variable located in a function's stack frame.
Definition frame.hpp:664
ea_t ea
Location of the insn referencing the stack frame member.
Definition frame.hpp:665
uchar type
The type of xref (cref_t & dref_t)
Definition frame.hpp:667
DECLARE_COMPARISONS(xreflist_entry_t)
Definition frame.hpp:669
uchar opnum
Number of the operand of that instruction.
Definition frame.hpp:666