IDA C++ SDK 9.2
Loading...
Searching...
No Matches
frame.hpp
Go to the documentation of this file.
1/*
2 * Interactive disassembler (IDA).
3 * Copyright (c) 1990-2026 Hex-Rays
4 * ALL RIGHTS RESERVED.
5 *
6 */
7
8#ifndef _FRAME_HPP
9#define _FRAME_HPP
10#include <idp.hpp>
11
42
43// name of stkvar to denote the return address slot
44#define FRAME_UDM_NAME_R "__return_address"
45// name of stkvar to denote the saved register slots
46#define FRAME_UDM_NAME_S "__saved_registers"
47
48class op_t;
49
50// We need to trace value of SP register. For this we introduce
51// an array of SP register change points.
52
53// SP register change point
54//
55// NOTE: To manipulate/modify stack points, please use the specialized
56// functions provided below in this file (stack pointer change points)
57
59{
60 ea_t ea; // linear address
61 sval_t spd; // here we keep a cumulative difference from [BP-frsize]
62
64 {
65 if ( ea < r.ea )
66 return -1;
67 if ( ea > r.ea )
68 return 1;
69 return 0;
70 }
71};
73// we declare a struct to be able to forward declare it in other files
74struct stkpnts_t : public qvector<stkpnt_t>
75{
77};
78
81{
82 ea_t ea = BADADDR;
84
86 {
87 if ( ea < r.ea )
88 return -1;
89 if ( ea > r.ea )
90 return 1;
91 return 0;
92 }
93};
96
97//--------------------------------------------------------------------------
98// F R A M E M A N I P U L A T I O N
99//--------------------------------------------------------------------------
100
111
112idaman DEPRECATED bool ida_export add_frame(
113 func_t *pfn,
114 sval_t frsize,
115 ushort frregs,
116 asize_t argsize);
117
118
123
124idaman DEPRECATED bool ida_export del_frame(func_t *pfn);
125
126
138
139idaman DEPRECATED bool ida_export set_frame_size(
140 func_t *pfn,
141 asize_t frsize,
142 ushort frregs,
143 asize_t argsize);
144
145
154
155idaman DEPRECATED asize_t ida_export get_frame_size(const func_t *pfn);
156
157
161
162idaman DEPRECATED int ida_export get_frame_retsize(const func_t *pfn);
163
172
179
180idaman DEPRECATED void ida_export get_frame_part(range_t *range, const func_t *pfn, frame_part_t part);
181
187
188idaman DEPRECATED bool ida_export get_func_frame(tinfo_t *out, const func_t *pfn);
189
190
195
196DEPRECATED inline sval_t soff_to_fpoff(func_t *pfn, uval_t soff)
197{
198 return pfn != nullptr ? soff - pfn->frsize + pfn->fpd : soff;
199}
200
201
208
209idaman DEPRECATED bool ida_export update_fpd(func_t *pfn, asize_t fpd);
210
211
220
221idaman bool ida_export set_purged(ea_t ea, int nbytes, bool override_old_value);
222
223
224//--------------------------------------------------------------------------
225// S T A C K V A R I A B L E S
226//--------------------------------------------------------------------------
227
235
236idaman bool ida_export add_stkvar(
237 const insn_t &insn,
238 const op_t &x,
239 sval_t v,
240 int stkvar_flags);
241
245#define STKVAR_VALID_SIZE 0x0001
249#define STKVAR_KEEP_EXISTING 0x0002
252
262
263idaman DEPRECATED bool ida_export define_stkvar(
264 func_t *pfn,
265 const char *name,
266 sval_t off,
267 const tinfo_t &tif,
268 const struct value_repr_t *repr=nullptr);
269
270
280
281idaman DEPRECATED bool ida_export add_frame_member(
282 const func_t *pfn,
283 const char *name,
284 uval_t offset,
285 const tinfo_t &tif,
286 const struct value_repr_t *repr=nullptr,
287 uint etf_flags=0);
288
289
291
292inline THREAD_SAFE bool is_anonymous_member_name(const char *name)
293{
294 return name == nullptr
295 || strncmp(name, "anonymous", 9) == 0;
296}
297
298
300
301inline THREAD_SAFE bool is_dummy_member_name(const char *name)
302{
303 return name == nullptr
304 || strncmp(name, "arg_", 4) == 0
305 || strncmp(name, "var_", 4) == 0
307}
308
309
313
314idaman bool ida_export is_special_frame_member(tid_t tid);
315
316
325
326idaman DEPRECATED bool ida_export set_frame_member_type(
327 const func_t *pfn,
328 uval_t offset,
329 const tinfo_t &tif,
330 const struct value_repr_t *repr=nullptr,
331 uint etf_flags=0);
332
333
340
341idaman DEPRECATED bool ida_export delete_frame_members(
342 const func_t *pfn,
343 uval_t start_offset,
344 uval_t end_offset);
345
346
353
354idaman DEPRECATED ssize_t ida_export build_stkvar_name(
355 qstring *buf,
356 const func_t *pfn,
357 sval_t v);
358
359
367
368idaman DEPRECATED ea_t ida_export calc_stkvar_struc_offset(
369 func_t *pfn,
370 const insn_t &insn,
371 int n);
372
373
381
382idaman DEPRECATED sval_t ida_export calc_frame_offset(
383 func_t *pfn,
384 sval_t off,
385 const insn_t *insn = nullptr,
386 const op_t *op = nullptr);
387
388
400
401idaman DEPRECATED int ida_export delete_wrong_frame_info(
402 func_t *pfn,
403 bool idaapi should_reanalyze(const insn_t &insn));
404
405
406//--------------------------------------------------------------------------
407// R E G I S T E R V A R I A B L E S
408//--------------------------------------------------------------------------
409struct regvar_t;
410#define DECLARE_REGVAR_T_HELPERS(decl)\
411decl int ida_export regvar_t__compare(const regvar_t &l, const regvar_t &r); \
412
413DECLARE_REGVAR_T_HELPERS(idaman)
414
415
418
419idaman void ida_export free_regvar(struct regvar_t *v);
420
425struct regvar_t : public range_t
426{
427 char *canon = nullptr;
428 char *user = nullptr;
429 char *cmt = nullptr;
430
432 regvar_t(const regvar_t &r) : range_t(r)
433 {
434 canon = ::qstrdup(r.canon);
435 user = ::qstrdup(r.user);
436 cmt = ::qstrdup(r.cmt);
437 }
438 ~regvar_t() { free_regvar(this); }
440 {
441 if ( this != &r )
442 {
443 free_regvar(this);
444 new (this) regvar_t(r);
445 }
446 return *this;
447 }
448 void swap(regvar_t &r)
449 {
450 std::swap(start_ea, r.start_ea);
451 std::swap(end_ea, r.end_ea);
452 std::swap(canon, r.canon);
453 std::swap(user, r.user);
454 std::swap(cmt, r.cmt);
455 }
456
457 DECLARE_COMPARISONS(regvar_t) { return regvar_t__compare(*this, r); }
458
459 DECLARE_REGVAR_T_HELPERS(friend)
460};
463
473
474idaman DEPRECATED int ida_export add_regvar(
475 func_t *pfn,
476 ea_t ea1,
477 ea_t ea2,
478 const char *canon,
479 const char *user,
480 const char *cmt);
481
493
494idaman DEPRECATED regvar_t *ida_export find_regvar(func_t *pfn, ea_t ea1, ea_t ea2, const char *canon, const char *user);
495
496
503
504DEPRECATED inline regvar_t *find_regvar(func_t *pfn, ea_t ea, const char *canon)
505{
506 if ( pfn == nullptr )
507 return nullptr;
508GCC_DIAG_OFF(deprecated-declarations)
509MSC_DIAG_OFF(4996)
510 return find_regvar(pfn, ea, ea+1, canon, nullptr);
511MSC_DIAG_ON(4996)
512GCC_DIAG_ON(deprecated-declarations)
513}
514
515
522
523idaman DEPRECATED int ida_export rename_regvar(func_t *pfn, regvar_t *v, const char *user);
524
525
532
533idaman DEPRECATED int ida_export set_regvar_cmt(func_t *pfn, regvar_t *v, const char *cmt);
534
535
542
543idaman DEPRECATED int ida_export del_regvar(func_t *pfn, ea_t ea1, ea_t ea2, const char *canon);
544
546
547//--------------------------------------------------------------------------
548// S P R E G I S T E R C H A N G E P O I N T S
549//--------------------------------------------------------------------------
550
559
560idaman DEPRECATED bool ida_export add_auto_stkpnt(func_t *pfn, ea_t ea, sval_t delta);
561
562
567
568idaman bool ida_export add_user_stkpnt(ea_t ea, sval_t delta);
569
570
576
577idaman DEPRECATED bool ida_export del_stkpnt(func_t *pfn, ea_t ea);
578
579
586
587idaman DEPRECATED sval_t ida_export get_spd(func_t *pfn, ea_t ea);
588
589
598
599idaman DEPRECATED sval_t ida_export get_effective_spd(func_t *pfn, ea_t ea);
600
601
608
609idaman DEPRECATED sval_t ida_export get_sp_delta(func_t *pfn, ea_t ea);
610
611
620
621idaman DEPRECATED bool ida_export set_auto_spd(func_t *pfn, ea_t ea, sval_t new_spd);
622
623
635
636idaman bool ida_export recalc_spd(ea_t cur_ea);
637
638
658
659idaman DEPRECATED bool ida_export recalc_spd_for_basic_block(func_t *pfn, ea_t cur_ea);
660
661
664{
668
670 {
671 int code = ::compare(ea, r.ea);
672 if ( code == 0 )
673 {
674 code = ::compare(type, r.type);
675 if ( code == 0 )
676 code = ::compare(opnum, r.opnum);
677 }
678 return code;
679 }
680};
683
691
692idaman DEPRECATED void ida_export build_stkvar_xrefs(xreflist_t *out, func_t *pfn, uval_t start_offset, uval_t end_offset);
693
694
695//--------------------------------------------------------------------
696// E A - B A S E D F R A M E A P I
697//--------------------------------------------------------------------
705
706//--------------------------------------------------------------------------
707// E A - B A S E D F R A M E M A N I P U L A T I O N
708//--------------------------------------------------------------------------
711
721
722idaman bool ida_export add_frame_ea(
723 ea_t func_ea,
724 sval_t frsize,
725 ushort frregs,
726 asize_t argsize);
727
728
732
733idaman bool ida_export del_frame_ea(ea_t func_ea);
734
735
743
744idaman bool ida_export set_frame_size_ea(
745 ea_t func_ea,
746 asize_t frsize,
747 ushort frregs,
748 asize_t argsize);
749
750
756
757idaman asize_t ida_export get_frame_size_ea(ea_t func_ea);
758
759
763
764idaman int ida_export get_frame_retsize_ea(ea_t func_ea);
765
766
773
774idaman bool ida_export get_frame_part_ea(range_t *range, ea_t func_ea, frame_part_t part);
775
776
780
782{
783 range_t range;
784 if ( !get_frame_part_ea(&range, func_ea, FPC_ARGS) )
785 return BADADDR;
786 return range.start_ea;
787}
788
792
794{
795 range_t range;
796 if ( !get_frame_part_ea(&range, func_ea, FPC_RETADDR) )
797 return BADADDR;
798 return range.start_ea;
799}
800
804
806{
807 range_t range;
808 if ( !get_frame_part_ea(&range, func_ea, FPC_SAVREGS) )
809 return BADADDR;
810 return range.start_ea;
811}
812
816
818{
819 range_t range;
820 if ( !get_frame_part_ea(&range, func_ea, FPC_LVARS) )
821 return BADADDR;
822 return range.start_ea;
823}
824
828
829inline bool processor_t::is_funcarg_off_ea(ea_t func_ea, uval_t frameoff) const
830{
832 if ( !get_frame_part_ea(&args, func_ea, FPC_ARGS) )
833 return false;
834 return stkup()
835 ? frameoff < args.end_ea
836 : frameoff >= args.start_ea;
837}
838
842
843inline sval_t processor_t::lvar_off_ea(ea_t func_ea, uval_t frameoff) const
844{
845 range_t lvars;
846 if ( !get_frame_part_ea(&lvars, func_ea, FPC_LVARS) )
847 return 0;
848 return stkup()
849 ? frameoff - lvars.start_ea
850 : lvars.end_ea - frameoff;
851}
852
855
856DEPRECATED inline ea_t frame_off_args(const func_t *pfn) { return pfn != nullptr ? frame_off_args_ea(pfn->start_ea) : BADADDR; }
857
860
861DEPRECATED inline ea_t frame_off_retaddr(const func_t *pfn) { return pfn != nullptr ? frame_off_retaddr_ea(pfn->start_ea) : BADADDR; }
862
865
866DEPRECATED inline ea_t frame_off_savregs(const func_t *pfn) { return pfn != nullptr ? frame_off_savregs_ea(pfn->start_ea) : BADADDR; }
867
870
871DEPRECATED inline ea_t frame_off_lvars(const func_t *pfn) { return pfn != nullptr ? frame_off_lvars_ea(pfn->start_ea) : BADADDR; }
872
875
876DEPRECATED inline bool processor_t::is_funcarg_off(const func_t *pfn, uval_t frameoff) const
877{
878 if ( pfn == nullptr )
879 return false;
881 if ( !get_frame_part_ea(&args, pfn->start_ea, FPC_ARGS) )
882 return false;
883 return stkup()
884 ? frameoff < args.end_ea
885 : frameoff >= args.start_ea;
886}
887
890
891DEPRECATED inline sval_t processor_t::lvar_off(const func_t *pfn, uval_t frameoff) const
892{
893 if ( pfn == nullptr )
894 return 0;
895 range_t lvars;
896 if ( !get_frame_part_ea(&lvars, pfn->start_ea, FPC_LVARS) )
897 return 0;
898 return stkup()
899 ? frameoff - lvars.start_ea
900 : lvars.end_ea - frameoff;
901}
902
907
908idaman bool ida_export get_func_frame_ea(tinfo_t *out, ea_t func_ea);
909
910inline bool get_func_frame(tinfo_t *tif, ea_t ea) { return get_func_frame_ea(tif, ea); }
911
912
917
918idaman sval_t ida_export soff_to_fpoff_ea(ea_t func_ea, uval_t soff);
919
920
926
927idaman bool ida_export update_fpd_ea(ea_t func_ea, asize_t fpd);
928
930
931
932//--------------------------------------------------------------------------
933// E A - B A S E D S T A C K V A R I A B L E S
934//--------------------------------------------------------------------------
937
946
947idaman bool ida_export define_stkvar_ea(
948 ea_t func_ea,
949 const char *name,
950 sval_t off,
951 const tinfo_t &tif,
952 const struct value_repr_t *repr=nullptr);
953
954
963
964idaman bool ida_export add_frame_member_ea(
965 ea_t func_ea,
966 const char *name,
967 uval_t offset,
968 const tinfo_t &tif,
969 const struct value_repr_t *repr=nullptr,
970 uint etf_flags=0);
971
972
980
981idaman bool ida_export set_frame_member_type_ea(
982 ea_t func_ea,
983 uval_t offset,
984 const tinfo_t &tif,
985 const struct value_repr_t *repr=nullptr,
986 uint etf_flags=0);
987
988
994
995idaman bool ida_export delete_frame_members_ea(
996 ea_t func_ea,
997 uval_t start_offset,
998 uval_t end_offset);
999
1000
1006
1008 qstring *buf,
1009 ea_t func_ea,
1010 sval_t v);
1011
1012
1019
1021 ea_t func_ea,
1022 const insn_t &insn,
1023 int n);
1024
1025
1032
1034 ea_t func_ea,
1035 sval_t off,
1036 const insn_t *insn=nullptr,
1037 const op_t *op=nullptr);
1038
1039
1050
1051idaman int ida_export delete_wrong_frame_info_ea(
1052 ea_t func_ea,
1053 bool idaapi should_reanalyze(const insn_t &insn));
1054
1055
1062
1063idaman void ida_export build_stkvar_xrefs_ea(
1064 xreflist_t *out,
1065 ea_t func_ea,
1066 uval_t start_offset,
1067 uval_t end_offset);
1068
1070
1071
1072//--------------------------------------------------------------------------
1073// E A - B A S E D R E G I S T E R V A R I A B L E S
1074//--------------------------------------------------------------------------
1077
1086
1087idaman int ida_export add_func_regvar(
1088 ea_t func_ea,
1089 ea_t ea1,
1090 ea_t ea2,
1091 const char *canon,
1092 const char *user,
1093 const char *cmt);
1097#define REGVAR_ERROR_OK 0
1098#define REGVAR_ERROR_ARG (-1)
1099#define REGVAR_ERROR_RANGE (-2)
1100#define REGVAR_ERROR_NAME (-3)
1102
1103
1115
1116idaman ssize_t ida_export find_func_regvar(
1117 regvar_t *rv,
1118 ea_t func_ea,
1119 ea_t ea1,
1120 ea_t ea2,
1121 const char *canon,
1122 const char *user);
1123
1124
1131
1132inline ssize_t find_func_regvar(regvar_t *rv, ea_t func_ea, ea_t ea, const char *canon)
1133{
1134 return find_func_regvar(rv, func_ea, ea, ea+1, canon, nullptr);
1135}
1136
1137
1141
1142inline bool has_func_regvar(ea_t func_ea, ea_t ea)
1143{
1144 return find_func_regvar(nullptr, func_ea, ea, ea+1, nullptr, nullptr) != -1;
1145}
1146
1147
1152
1153DEPRECATED inline bool has_regvar(func_t *pfn, ea_t ea) { return pfn != nullptr && has_func_regvar(pfn->start_ea, ea); }
1154
1155
1161
1162idaman int ida_export rename_func_regvar(ea_t func_ea, ssize_t index, const char *user);
1163
1164
1170
1171idaman int ida_export set_func_regvar_cmt(ea_t func_ea, ssize_t index, const char *cmt);
1172
1173
1183
1184idaman int ida_export set_func_regvar_range(ea_t func_ea, ssize_t index, const range_t &range);
1185
1186
1192
1193idaman int ida_export del_func_regvar(ea_t func_ea, ea_t ea1, ea_t ea2, const char *canon);
1194
1195
1199
1200idaman size_t ida_export get_func_regvar_qty(ea_t func_ea);
1201
1202
1207
1208idaman bool ida_export get_func_regvars(regvars_t *out, ea_t func_ea);
1209
1210
1216
1217idaman bool ida_export get_func_regvar(regvar_t *out, ea_t func_ea, ssize_t index);
1218
1219
1221
1222
1223//--------------------------------------------------------------------------
1224// E A - B A S E D S P C H A N G E P O I N T S
1225//--------------------------------------------------------------------------
1228
1236
1237idaman bool ida_export add_func_auto_stkpnt(ea_t func_ea, ea_t ea, sval_t delta);
1238
1239
1244
1245idaman bool ida_export del_func_stkpnt(ea_t func_ea, ea_t ea);
1246
1247
1253
1254idaman sval_t ida_export get_func_spd(ea_t func_ea, ea_t ea);
1255
1256
1264
1265idaman sval_t ida_export get_func_effective_spd(ea_t func_ea, ea_t ea);
1266
1267
1273
1274idaman sval_t ida_export get_func_sp_delta(ea_t func_ea, ea_t ea);
1275
1276
1282
1283idaman bool ida_export set_func_auto_spd(ea_t func_ea, ea_t ea, sval_t new_spd);
1284
1285
1302
1303idaman bool ida_export recalc_func_spd_for_basic_block(ea_t func_ea, ea_t cur_ea);
1304
1305
1309
1310idaman size_t ida_export get_func_stkpnt_qty(ea_t func_ea);
1311
1312
1317
1318idaman bool ida_export get_func_stkpnts(stkpnts_t *out, ea_t func_ea);
1319
1321
1322
1323//--------------------------------------------------------------------------
1324// E A - B A S E D L O C A L L A B E L S
1325//--------------------------------------------------------------------------
1328
1332
1333idaman size_t ida_export get_func_llabel_qty(ea_t func_ea);
1334
1335
1340
1341idaman bool ida_export get_func_llabels(llabels_t *out, ea_t func_ea);
1342
1344
1346
1347#endif // _FRAME_HPP
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
Definition frame.hpp:59
ea_t ea
Definition frame.hpp:60
sval_t spd
Definition frame.hpp:61
DECLARE_COMPARISONS(stkpnt_t)
Definition frame.hpp:63
Definition frame.hpp:75
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