IDA C++ SDK 9.2
Loading...
Searching...
No Matches
funcs.hpp
Go to the documentation of this file.
1/*
2 * Interactive disassembler (IDA).
3 * Copyright (c) 1990-2025 Hex-Rays
4 * ALL RIGHTS RESERVED.
5 *
6 */
7
8#ifndef FUNCS_HPP
9#define FUNCS_HPP
10#include <range.hpp>
11#include <bytes.hpp>
12
37
38struct stkpnt_t; // #include <frame.hpp>
39struct regvar_t; // #include <frame.hpp>
40struct llabel_t; // #include <frame.hpp>
41class insn_t; // #include <ua.hpp>
42
43idaman void ida_export free_regarg(struct regarg_t *v);
44
48{
49 int reg = 0;
50 type_t *type = nullptr;
51 char *name = nullptr;
52
54 regarg_t(const regarg_t &r) : reg(r.reg)
55 {
56 type = (type_t *)::qstrdup((char *)r.type);
57 name = ::qstrdup(r.name);
58 }
61 {
62 if ( this != &r )
63 {
64 free_regarg(this);
65 new (this) regarg_t(r);
66 }
67 return *this;
68 }
69 void swap(regarg_t &r)
70 {
71 std::swap(reg, r.reg);
72 std::swap(type, r.type);
73 std::swap(name, r.name);
74 }
75#ifndef SWIG
77#endif
78
79};
81
82//------------------------------------------------------------------------
84class func_t : public range_t
85{
86public:
91#define FUNC_NORET 0x00000001
92#define FUNC_FAR 0x00000002
93#define FUNC_LIB 0x00000004
94
95#define FUNC_STATICDEF 0x00000008
96
97#define FUNC_FRAME 0x00000010
98#define FUNC_USERFAR 0x00000020
100#define FUNC_HIDDEN 0x00000040
101#define FUNC_THUNK 0x00000080
102#define FUNC_BOTTOMBP 0x00000100
103#define FUNC_NORET_PENDING 0x00200
105#define FUNC_SP_READY 0x00000400
110#define FUNC_FUZZY_SP 0x00000800
112#define FUNC_PROLOG_OK 0x00001000
114#define FUNC_PURGED_OK 0x00004000
120#define FUNC_TAIL 0x00008000
123#define FUNC_LUMINA 0x00010000
124#define FUNC_OUTLINE 0x00020000
125#define FUNC_REANALYZE 0x00040000
128#define FUNC_UNWIND 0x00080000
129#define FUNC_CATCH 0x00100000
130
131#define FUNC_RESERVED 0x8000000000000000LL
133
135 bool is_far(void) const { return (flags & FUNC_FAR) != 0; }
137 bool does_return(void) const { return (flags & FUNC_NORET) == 0; }
139 bool analyzed_sp(void) const { return (flags & FUNC_SP_READY) != 0; }
141 bool need_prolog_analysis(void) const { return (flags & FUNC_PROLOG_OK) == 0; }
142#ifndef SWIG
143 union
144 {
146 struct
147 {
148#endif // SWIG
149 //
150 // Stack frame of the function. It is represented as a structure:
151 //
152 // +------------------------------------------------+
153 // | function arguments |
154 // +------------------------------------------------+
155 // | return address (isn't stored in func_t) |
156 // +------------------------------------------------+
157 // | saved registers (SI, DI, etc - func_t::frregs) |
158 // +------------------------------------------------+ <- typical BP
159 // | | |
160 // | | | func_t::fpd
161 // | | |
162 // | | <- real BP
163 // | local variables (func_t::frsize) |
164 // | |
165 // | |
166 // +------------------------------------------------+ <- SP
167 //
179
181
182 // the following fields should not be accessed directly:
183
187
193
195 llabel_t *llabels;
198
208
212#ifndef SWIG
213 };
215 struct
216 {
217#endif // SWIG
219 int refqty;
222#ifndef SWIG
223 };
224 };
225#endif // SWIG
226
227 func_t(ea_t start=0, ea_t end=0, flags64_t f=0)
228 : range_t(start, end), flags(f|FUNC_NORET_PENDING), frame(BADNODE),
229 frsize(0), frregs(0), argsize(0), fpd(0), color(DEFCOLOR),
230 pntqty(0), points(nullptr),
231 regvarqty(0), regvars(nullptr),
232 llabelqty(0), llabels(nullptr),
233 regargqty(0), regargs(nullptr),
234 tailqty(0), tails(nullptr)
235 {
236 }
237#ifndef SWIG
239#endif
240};
242
244inline bool is_func_entry(const func_t *pfn) { return pfn != nullptr && (pfn->flags & FUNC_TAIL) == 0; }
246inline bool is_func_tail(const func_t *pfn) { return pfn != nullptr && (pfn->flags & FUNC_TAIL) != 0; }
247
248
252
253idaman void ida_export lock_func_range(const func_t *pfn, bool lock);
254
257{
258 const func_t *pfn;
259public:
260 lock_func(const func_t *_pfn) : pfn(_pfn)
261 {
262 lock_func_range(pfn, true);
263 }
265 {
266 lock_func_range(pfn, false);
267 }
268};
269
270//lint -esym(1788, lock_func_with_tails_t) referenced only by ctr/dtr
272{
273 rangeset_t func_ranges;
274 void lock_ranges(bool lock);
275
276public:
278 ~lock_func_with_tails_t() { lock_ranges(false); }
279};
280
282
283idaman bool ida_export is_func_locked(const func_t *pfn);
284
285//--------------------------------------------------------------------
286// F U N C T I O N S
287//--------------------------------------------------------------------
292
293idaman func_t *ida_export get_func(ea_t ea);
294
295
300
301idaman int ida_export get_func_chunknum(func_t *pfn, ea_t ea);
302
304
305inline bool func_contains(func_t *pfn, ea_t ea)
306{
307 return get_func_chunknum(pfn, ea) >= 0;
308}
309
311inline bool is_same_func(ea_t ea1, ea_t ea2)
312{
313 func_t *pfn = get_func(ea1);
314 return pfn != nullptr && func_contains(pfn, ea2);
315}
316
321
322idaman func_t *ida_export getn_func(size_t n);
323
324
326
327idaman size_t ida_export get_func_qty(void);
328
329
334
335idaman int ida_export get_func_num(ea_t ea);
336
337
341
342idaman func_t *ida_export get_prev_func(ea_t ea);
343
344
348
349idaman func_t *ida_export get_next_func(ea_t ea);
350
351
356
357idaman ea_t ida_export get_func_ranges(rangeset_t *ranges, func_t *pfn);
358
359
366
367idaman ssize_t ida_export get_func_cmt(qstring *buf, const func_t *pfn, bool repeatable);
368
369
376
377idaman bool ida_export set_func_cmt(const func_t *pfn, const char *cmt, bool repeatable);
378
379
385
386idaman bool ida_export update_func(func_t *pfn);
387
388
394
395idaman bool ida_export add_func_ex(func_t *pfn);
396
397
404
405inline bool add_func(ea_t ea1, ea_t ea2=BADADDR)
406{
407 func_t fn(ea1, ea2);
408 return add_func_ex(&fn);
409}
410
411
415
416idaman bool ida_export del_func(ea_t ea);
417
418
423
424idaman int ida_export set_func_start(ea_t ea, ea_t newstart);
428#define MOVE_FUNC_OK 0
429#define MOVE_FUNC_NOCODE 1
430#define MOVE_FUNC_BADSTART 2
431#define MOVE_FUNC_NOFUNC 3
432#define MOVE_FUNC_REFUSED 4
434
435
440
441idaman bool ida_export set_func_end(ea_t ea, ea_t newend);
442
443
453
454idaman void ida_export reanalyze_function(
455 func_t *pfn,
456 ea_t ea1=0,
457 ea_t ea2=BADADDR,
458 bool analyze_parents=false);
459
460
469
470idaman int ida_export find_func_bounds(func_t *nfn, int flags);
471
475#define FIND_FUNC_NORMAL 0x0000
476#define FIND_FUNC_DEFINE 0x0001
477#define FIND_FUNC_IGNOREFN 0x0002
480#define FIND_FUNC_KEEPBD 0x0004
483
487#define FIND_FUNC_UNDEF 0
489#define FIND_FUNC_OK 1
490#define FIND_FUNC_EXIST 2
493
494
499
500idaman ssize_t ida_export get_func_name(qstring *out, ea_t ea);
501
502
506
507idaman asize_t ida_export calc_func_size(func_t *pfn);
508
509
515
516idaman int ida_export get_func_bitness(const func_t *pfn);
517
519inline int idaapi get_func_bits(const func_t *pfn) { return 1 << (get_func_bitness(pfn)+4); }
520
522inline int idaapi get_func_bytes(const func_t *pfn) { return get_func_bits(pfn)/8; }
523
524
526
527inline bool is_visible_func(func_t *pfn) { return pfn != nullptr && (pfn->flags & FUNC_HIDDEN) == 0; }
528
531{
532 return (inf_get_cmtflg() & SCF_SHHID_FUNC) != 0 || is_visible_func(pfn);
533}
534
536
537idaman void ida_export set_visible_func(func_t *pfn, bool visible);
538
539
547
548idaman int ida_export set_func_name_if_jumpfunc(func_t *pfn, const char *oldname);
549
550
555
556idaman ea_t ida_export calc_thunk_func_target(func_t *pfn, ea_t *fptr);
557
558
564
565idaman bool ida_export func_does_return(ea_t callee);
566
567
571
572idaman bool ida_export reanalyze_noret_flag(ea_t ea);
573
574
581
582idaman bool ida_export set_noret_insn(ea_t insn_ea, bool noret);
583
584
585//--------------------------------------------------------------------
586// F U N C T I O N C H U N K S
587//--------------------------------------------------------------------
592
593idaman func_t *ida_export get_fchunk(ea_t ea);
594
595
600
601idaman func_t *ida_export getn_fchunk(int n);
602
603
605
606idaman size_t ida_export get_fchunk_qty(void);
607
608
613
614idaman int ida_export get_fchunk_num(ea_t ea);
615
616
620
621idaman func_t *ida_export get_prev_fchunk(ea_t ea);
622
623
627
628idaman func_t *ida_export get_next_fchunk(ea_t ea);
629
630
631//--------------------------------------------------------------------
632// Functions to manipulate function chunks
633
644
645idaman bool ida_export append_func_tail(func_t *pfn, ea_t ea1, ea_t ea2);
646
647
654
655idaman bool ida_export remove_func_tail(func_t *pfn, ea_t tail_ea);
656
657
662
663idaman bool ida_export set_tail_owner(func_t *fnt, ea_t new_owner);
664
665
666// Auxiliary function(s) to be used in func_..._iterator_t
667
671
673#define DECLARE_FUNC_ITERATORS(prefix) \
674prefix bool ida_export func_tail_iterator_set(func_tail_iterator_t *fti, func_t *pfn, ea_t ea);\
675prefix bool ida_export func_tail_iterator_set_ea(func_tail_iterator_t *fti, ea_t ea);\
676prefix bool ida_export func_parent_iterator_set(func_parent_iterator_t *fpi, func_t *pfn);\
677prefix bool ida_export func_item_iterator_next(func_item_iterator_t *fii, testf_t *testf, void *ud);\
678prefix bool ida_export func_item_iterator_prev(func_item_iterator_t *fii, testf_t *testf, void *ud);\
679prefix bool ida_export func_item_iterator_decode_prev_insn(func_item_iterator_t *fii, insn_t *out); \
680prefix bool ida_export func_item_iterator_decode_preceding_insn(func_item_iterator_t *fii, eavec_t *visited, bool *p_farref, insn_t *out); \
681prefix bool ida_export func_item_iterator_succ(func_item_iterator_t *fii, testf_t *testf, void *ud);
683
684
685inline THREAD_SAFE bool idaapi f_any(flags64_t, void *) { return true; }
686
713{
714 func_t *pfn;
715 int idx;
716 range_t seglim; // valid and used only if pfn == nullptr
717public:
718 func_tail_iterator_t(void) : pfn(nullptr), idx(-1) {}
719 func_tail_iterator_t(func_t *_pfn, ea_t ea=BADADDR) : pfn(nullptr) { set(_pfn, ea); }
721 {
722 // if was iterating over function chunks, unlock the main chunk
723 if ( pfn != nullptr )
724 lock_func_range(pfn, false);
725 }
726 bool set(func_t *_pfn, ea_t ea=BADADDR) { return func_tail_iterator_set(this, _pfn, ea); }
727 bool set_ea(ea_t ea) { return func_tail_iterator_set_ea(this, ea); }
728 // set an arbitrary range
729 bool set_range(ea_t ea1, ea_t ea2)
730 {
731 this->~func_tail_iterator_t();
732 pfn = nullptr;
733 idx = -1;
734 seglim = range_t(ea1, ea2);
735 return !seglim.empty();
736 }
737 const range_t &chunk(void) const
738 {
739 if ( pfn == nullptr )
740 return seglim;
741 return idx >= 0 && idx < pfn->tailqty ? pfn->tails[idx] : *(range_t*)pfn;
742 }
743 bool first(void) { if ( pfn != nullptr ) { idx = 0; return pfn->tailqty > 0; } return false; } // get only tail chunks
744 bool last(void) { if ( pfn != nullptr ) { idx = pfn->tailqty - 1; return true; } return false; } // get all chunks (the entry chunk last)
745 bool next(void) { if ( pfn != nullptr && idx+1 < pfn->tailqty ) { idx++; return true; } return false; }
746 bool prev(void) { if ( idx >= 0 ) { idx--; return true; } return false; }
747 bool main(void) { idx = -1; return pfn != nullptr; } // get all chunks (the entry chunk first)
748};
749
750
758
759idaman void ida_export iterate_func_chunks(
760 func_t *pfn,
761 void (idaapi *func)(ea_t ea1, ea_t ea2, void *ud),
762 void *ud=nullptr,
763 bool include_parents=false);
764
765
784{
786 ea_t ea;
787public:
788 func_item_iterator_t(void) : ea(BADADDR) {}
789 func_item_iterator_t(func_t *pfn, ea_t _ea=BADADDR) { set(pfn, _ea); }
791 bool set(func_t *pfn, ea_t _ea=BADADDR)
792 {
793 ea = (_ea != BADADDR || pfn == nullptr) ? _ea : pfn->start_ea;
794 return fti.set(pfn, _ea);
795 }
796
797 bool set_range(ea_t ea1, ea_t ea2) { ea = ea1; return fti.set_range(ea1, ea2); }
798 bool first(void) { if ( !fti.main() ) return false; ea=fti.chunk().start_ea; return true; }
799 bool last(void) { if ( !fti.last() ) return false; ea=fti.chunk().end_ea; return true; }
800 ea_t current(void) const { return ea; }
801 bool set_ea(ea_t _ea)
802 {
803 if ( !fti.set_ea(_ea) )
804 return false;
805 ea = _ea;
806 return true;
807 }
808 const range_t &chunk(void) const { return fti.chunk(); }
809 bool next(testf_t *func, void *ud) { return func_item_iterator_next(this, func, ud); }
810 bool prev(testf_t *func, void *ud) { return func_item_iterator_prev(this, func, ud); }
811 bool next_addr(void) { return next(f_any, nullptr); }
812 bool next_head(void) { return next(f_is_head, nullptr); }
813 bool next_code(void) { return next(f_is_code, nullptr); }
814 bool next_data(void) { return next(f_is_data, nullptr); }
815 bool next_not_tail(void) { return next(f_is_not_tail, nullptr); }
816 bool prev_addr(void) { return prev(f_any, nullptr); }
817 bool prev_head(void) { return prev(f_is_head, nullptr); }
818 bool prev_code(void) { return prev(f_is_code, nullptr); }
819 bool prev_data(void) { return prev(f_is_data, nullptr); }
820 bool prev_not_tail(void) { return prev(f_is_not_tail, nullptr); }
821 bool decode_prev_insn(insn_t *out) { return func_item_iterator_decode_prev_insn(this, out); }
822 bool decode_preceding_insn(eavec_t *visited, bool *p_farref, insn_t *out)
823 { return func_item_iterator_decode_preceding_insn(this, visited, p_farref, out); }
824
827 bool succ(testf_t *func, void *ud) { return func_item_iterator_succ(this, func, ud); }
828 bool succ_code(void) { return succ(f_is_code, nullptr); }
829};
830
845{
846 func_t *fnt;
847 int idx;
848public:
849 func_parent_iterator_t(void) : fnt(nullptr), idx(0) {}
850 func_parent_iterator_t(func_t *_fnt) : fnt(nullptr) { set(_fnt); }
852 {
853 if ( fnt != nullptr )
854 lock_func_range(fnt, false);
855 }
856 bool set(func_t *_fnt) { return func_parent_iterator_set(this, _fnt); }
857 ea_t parent(void) const { return fnt->referers[idx]; }
858 bool first(void) { idx = 0; return is_func_tail(fnt) && fnt->refqty > 0; }
859 bool last(void) { idx = fnt->refqty - 1; return idx >= 0; }
860 bool next(void) { if ( idx+1 < fnt->refqty ) { idx++; return true; } return false; }
861 bool prev(void) { if ( idx > 0 ) { idx--; return true; } return false; }
862 void reset_fnt(func_t *_fnt) { fnt = _fnt; } // for internal use only!
863};
864
865
870idaman ea_t ida_export get_prev_func_addr(func_t *pfn, ea_t ea);
871idaman ea_t ida_export get_next_func_addr(func_t *pfn, ea_t ea);
873
874//--------------------------------------------------------------------
878idaman void ida_export read_regargs(func_t *pfn);
879idaman void ida_export add_regarg(func_t *pfn, int reg, const tinfo_t &tif, const char *name);
881
882//--------------------------------------------------------------------
883// L I B R A R Y M O D U L E S I G N A T U R E S
884//--------------------------------------------------------------------
885
889#define IDASGN_OK 0
890#define IDASGN_BADARG 1
891#define IDASGN_APPLIED 2
892#define IDASGN_CURRENT 3
893#define IDASGN_PLANNED 4
895
899
900idaman int ida_export plan_to_apply_idasgn(const char *fname); // plan to use library
901
902
910
911idaman int ida_export apply_idasgn_to(const char *signame, ea_t ea, bool is_startup);
912
913
916
917idaman int ida_export get_idasgn_qty(void);
918
919
922
923idaman int ida_export get_current_idasgn(void);
924
925
929
930idaman int ida_export calc_idasgn_state(int n);
931
932
936
937idaman int ida_export del_idasgn(int n);
938
939
951
952idaman int32 ida_export get_idasgn_desc(
953 qstring *signame,
954 qstring *optlibs,
955 int n);
956
961
962idaman ssize_t ida_export get_idasgn_title(
963 qstring *buf,
964 const char *name);
965
969
970idaman void ida_export determine_rtl(void);
971
972
977
978idaman bool ida_export apply_startup_sig(ea_t ea, const char *startup);
979
980
986
987idaman int ida_export try_to_add_libfunc(ea_t ea);
988
989
993#define LIBFUNC_FOUND 0
994#define LIBFUNC_NONE 1
995#define LIBFUNC_DELAY 2
997
999{
1000 get_func_ranges(&func_ranges, pfn);
1001 lock_ranges(true);
1002}
1003
1004inline void lock_func_with_tails_t::lock_ranges(bool lock)
1005{
1006 for ( const auto &r : func_ranges )
1007 lock_func_range(get_fchunk(r.start_ea), lock);
1008}
1009
1010
1011#endif
Contains functions that deal with individual byte characteristics.
bool idaapi testf_t(flags64_t flags, void *ud)
Flag tester - see next_that(), prev_that()
Definition bytes.hpp:109
Class to enumerate all function instructions and data sorted by addresses.
Definition funcs.hpp:784
bool prev_data(void)
Definition funcs.hpp:819
bool prev_code(void)
Definition funcs.hpp:818
bool decode_preceding_insn(eavec_t *visited, bool *p_farref, insn_t *out)
Definition funcs.hpp:822
bool first(void)
Definition funcs.hpp:798
bool set_ea(ea_t _ea)
Definition funcs.hpp:801
ea_t current(void) const
Definition funcs.hpp:800
bool prev(testf_t *func, void *ud)
Definition funcs.hpp:810
bool set(func_t *pfn, ea_t _ea=BADADDR)
Set a function range. if pfn == nullptr then a segment range will be set.
Definition funcs.hpp:791
bool last(void)
Definition funcs.hpp:799
bool next_head(void)
Definition funcs.hpp:812
const range_t & chunk(void) const
Definition funcs.hpp:808
bool prev_addr(void)
Definition funcs.hpp:816
func_item_iterator_t(void)
Definition funcs.hpp:788
bool next_addr(void)
Definition funcs.hpp:811
bool next_not_tail(void)
Definition funcs.hpp:815
bool decode_prev_insn(insn_t *out)
Definition funcs.hpp:821
bool prev_head(void)
Definition funcs.hpp:817
bool next_data(void)
Definition funcs.hpp:814
bool next(testf_t *func, void *ud)
Definition funcs.hpp:809
func_item_iterator_t(func_t *pfn, ea_t _ea=BADADDR)
Definition funcs.hpp:789
bool set_range(ea_t ea1, ea_t ea2)
Set an arbitrary range.
Definition funcs.hpp:797
bool next_code(void)
Definition funcs.hpp:813
bool prev_not_tail(void)
Definition funcs.hpp:820
bool succ(testf_t *func, void *ud)
Similar to next(), but succ() iterates the chunks from low to high addresses, while next() iterates t...
Definition funcs.hpp:827
bool succ_code(void)
Definition funcs.hpp:828
Class to enumerate all function parents sorted by addresses.
Definition funcs.hpp:845
bool last(void)
Definition funcs.hpp:859
void reset_fnt(func_t *_fnt)
Definition funcs.hpp:862
func_parent_iterator_t(void)
Definition funcs.hpp:849
bool prev(void)
Definition funcs.hpp:861
bool set(func_t *_fnt)
Definition funcs.hpp:856
bool next(void)
Definition funcs.hpp:860
~func_parent_iterator_t(void)
Definition funcs.hpp:851
func_parent_iterator_t(func_t *_fnt)
Definition funcs.hpp:850
ea_t parent(void) const
Definition funcs.hpp:857
bool first(void)
Definition funcs.hpp:858
A function is a set of continuous ranges of addresses with characteristics.
Definition funcs.hpp:85
int tailqty
number of function tails
Definition funcs.hpp:209
range_t * tails
array of tails, sorted by ea.
Definition funcs.hpp:210
func_t(ea_t start=0, ea_t end=0, flags64_t f=0)
Definition funcs.hpp:227
uint64 flags
Function flags
Definition funcs.hpp:87
regarg_t * regargs
unsorted array of register arguments.
Definition funcs.hpp:204
uval_t frame
netnode id of frame structure - see frame.hpp
Definition funcs.hpp:168
stkpnt_t * points
array of SP change points.
Definition funcs.hpp:185
DECLARE_COMPARISONS(func_t)
int refqty
number of referers
Definition funcs.hpp:219
bool need_prolog_analysis(void) const
Needs prolog analysis?
Definition funcs.hpp:141
llabel_t * llabels
local labels array.
Definition funcs.hpp:195
asize_t fpd
frame pointer delta.
Definition funcs.hpp:177
bool analyzed_sp(void) const
Has SP-analysis been performed?
Definition funcs.hpp:139
asize_t argsize
number of bytes purged from the stack upon returning
Definition funcs.hpp:175
int regargqty
number of register arguments.
Definition funcs.hpp:199
bgcolor_t color
user defined function color
Definition funcs.hpp:180
int llabelqty
number of local labels
Definition funcs.hpp:194
int regvarqty
number of register variables (-1-not read in yet) use find_regvar() to read register variables
Definition funcs.hpp:188
bool does_return(void) const
Does function return?
Definition funcs.hpp:137
regvar_t * regvars
array of register variables.
Definition funcs.hpp:190
uint32 pntqty
number of SP change points
Definition funcs.hpp:184
ushort frregs
size of saved registers in frame.
Definition funcs.hpp:173
bool is_far(void) const
Is a far function?
Definition funcs.hpp:135
asize_t frsize
size of local variables part of frame in bytes.
Definition funcs.hpp:169
ea_t * referers
array of referers (function start addresses).
Definition funcs.hpp:220
ea_t owner
the address of the main function possessing this tail
Definition funcs.hpp:218
Class to enumerate all function tails sorted by addresses.
Definition funcs.hpp:713
bool set_ea(ea_t ea)
Definition funcs.hpp:727
bool set_range(ea_t ea1, ea_t ea2)
Definition funcs.hpp:729
bool last(void)
Definition funcs.hpp:744
bool prev(void)
Definition funcs.hpp:746
bool main(void)
Definition funcs.hpp:747
~func_tail_iterator_t(void)
Definition funcs.hpp:720
bool next(void)
Definition funcs.hpp:745
bool first(void)
Definition funcs.hpp:743
func_tail_iterator_t(void)
Definition funcs.hpp:718
bool set(func_t *_pfn, ea_t ea=BADADDR)
Definition funcs.hpp:726
const range_t & chunk(void) const
Definition funcs.hpp:737
func_tail_iterator_t(func_t *_pfn, ea_t ea=BADADDR)
Definition funcs.hpp:719
lock_func_with_tails_t(func_t *pfn)
Definition funcs.hpp:998
~lock_func_with_tails_t()
Definition funcs.hpp:278
~lock_func(void)
Definition funcs.hpp:264
lock_func(const func_t *_pfn)
Definition funcs.hpp:260
Primary mechanism for managing type information.
Definition typeinf.hpp:3046
idaman func_t *ida_export getn_func(size_t n)
Get pointer to function structure by number.
idaman int ida_export get_idasgn_qty(void)
Get number of signatures in the list of planned and applied signatures.
idaman ea_t ida_export get_next_func_addr(func_t *pfn, ea_t ea)
idaman func_t *ida_export get_next_fchunk(ea_t ea)
Get pointer to the next function chunk in the global list.
idaman int ida_export apply_idasgn_to(const char *signame, ea_t ea, bool is_startup)
Apply a signature file to the specified address.
idaman ea_t ida_export get_func_ranges(rangeset_t *ranges, func_t *pfn)
Get function ranges.
idaman bool ida_export update_func(func_t *pfn)
Update information about a function in the database (func_t).
idaman int ida_export get_current_idasgn(void)
Get number of the the current signature.
idaman int ida_export set_func_name_if_jumpfunc(func_t *pfn, const char *oldname)
Give a meaningful name to function if it consists of only 'jump' instruction.
idaman bool ida_export set_noret_insn(ea_t insn_ea, bool noret)
Signal a non-returning instruction.
idaman int ida_export plan_to_apply_idasgn(const char *fname)
Add a signature file to the list of planned signature files.
idaman size_t ida_export get_func_qty(void)
Get total number of functions in the program.
idaman int32 ida_export get_idasgn_desc(qstring *signame, qstring *optlibs, int n)
Get information about a signature in the list.
idaman bool ida_export set_tail_owner(func_t *fnt, ea_t new_owner)
Set a new owner of a function tail.
idaman bool ida_export apply_startup_sig(ea_t ea, const char *startup)
Apply a startup signature file to the specified address.
idaman void ida_export add_regarg(func_t *pfn, int reg, const tinfo_t &tif, const char *name)
idaman ea_t ida_export get_prev_func_addr(func_t *pfn, ea_t ea)
idaman int ida_export del_idasgn(int n)
Remove signature from the list of planned signatures.
idaman ea_t ida_export calc_thunk_func_target(func_t *pfn, ea_t *fptr)
Calculate target of a thunk function.
idaman void ida_export lock_func_range(const func_t *pfn, bool lock)
Lock function pointer Locked pointers are guaranteed to remain valid until they are unlocked.
idaman int ida_export get_func_chunknum(func_t *pfn, ea_t ea)
Get the containing tail chunk of 'ea'.
bool add_func(ea_t ea1, ea_t ea2=BADADDR)
Add a new function.
Definition funcs.hpp:405
idaman bool ida_export set_func_cmt(const func_t *pfn, const char *cmt, bool repeatable)
Set function comment.
DECLARE_TYPE_AS_MOVABLE(regarg_t)
idaman bool ida_export append_func_tail(func_t *pfn, ea_t ea1, ea_t ea2)
Append a new tail chunk to the function definition.
idaman bool ida_export add_func_ex(func_t *pfn)
Add a new function.
idaman void ida_export read_regargs(func_t *pfn)
idaman func_t *ida_export get_prev_fchunk(ea_t ea)
Get pointer to the previous function chunk in the global list.
idaman bool ida_export is_func_locked(const func_t *pfn)
Is the function pointer locked?
idaman bool ida_export reanalyze_noret_flag(ea_t ea)
Plan to reanalyze noret flag.
idaman func_t *ida_export get_func(ea_t ea)
Get pointer to function structure by address.
idaman bool ida_export set_func_end(ea_t ea, ea_t newend)
Move function chunk end address.
idaman func_t *ida_export getn_fchunk(int n)
Get pointer to function chunk structure by number.
idaman void ida_export free_regarg(struct regarg_t *v)
idaman func_t *ida_export get_prev_func(ea_t ea)
Get pointer to the previous function.
int idaapi get_func_bits(const func_t *pfn)
Get number of bits in the function addressing.
Definition funcs.hpp:519
bool func_contains(func_t *pfn, ea_t ea)
Does the given function contain the given address?
Definition funcs.hpp:305
idaman size_t ida_export get_fchunk_qty(void)
Get total number of function chunks in the program.
idaman int ida_export get_func_num(ea_t ea)
Get ordinal number of a function.
idaman int ida_export get_fchunk_num(ea_t ea)
Get ordinal number of a function chunk in the global list of function chunks.
idaman ssize_t ida_export get_func_name(qstring *out, ea_t ea)
Get function name.
bool is_func_entry(const func_t *pfn)
Does function describe a function entry chunk?
Definition funcs.hpp:244
idaman int ida_export get_func_bitness(const func_t *pfn)
Get function bitness (which is equal to the function segment bitness).
idaman func_t *ida_export get_fchunk(ea_t ea)
Get pointer to function chunk structure by address.
bool is_func_tail(const func_t *pfn)
Does function describe a function tail chunk?
Definition funcs.hpp:246
idaman void ida_export iterate_func_chunks(func_t *pfn, void(idaapi *func)(ea_t ea1, ea_t ea2, void *ud), void *ud=nullptr, bool include_parents=false)
Function to iterate function chunks (all of them including the entry chunk)
idaman bool ida_export del_func(ea_t ea)
Delete a function.
idaman asize_t ida_export calc_func_size(func_t *pfn)
Calculate function size.
idaman ssize_t ida_export get_idasgn_title(qstring *buf, const char *name)
Get full description of the signature by its short name.
idaman int ida_export calc_idasgn_state(int n)
Get state of a signature in the list of planned signatures.
bool is_finally_visible_func(func_t *pfn)
Is the function visible (event after considering SCF_SHHID_FUNC)?
Definition funcs.hpp:530
bool is_same_func(ea_t ea1, ea_t ea2)
Do two addresses belong to the same function?
Definition funcs.hpp:311
idaman bool ida_export func_does_return(ea_t callee)
Does the function return?
idaman void ida_export set_visible_func(func_t *pfn, bool visible)
Set visibility of function.
DECLARE_FUNC_ITERATORS(idaman) inline THREAD_SAFE bool idaapi f_any(flags64_t
Helper function to accept any address.
idaman bool ida_export remove_func_tail(func_t *pfn, ea_t tail_ea)
Remove a function tail.
idaman int ida_export set_func_start(ea_t ea, ea_t newstart)
Move function chunk start address.
idaman ssize_t ida_export get_func_cmt(qstring *buf, const func_t *pfn, bool repeatable)
Get function comment.
idaman func_t *ida_export get_next_func(ea_t ea)
Get pointer to the next function.
idaman void ida_export determine_rtl(void)
Determine compiler/vendor using the startup signatures.
idaman int ida_export find_func_bounds(func_t *nfn, int flags)
Determine the boundaries of a new function.
bool is_visible_func(func_t *pfn)
Is the function visible (not hidden)?
Definition funcs.hpp:527
int idaapi get_func_bytes(const func_t *pfn)
Get number of bytes in the function addressing.
Definition funcs.hpp:522
idaman void ida_export reanalyze_function(func_t *pfn, ea_t ea1=0, ea_t ea2=BADADDR, bool analyze_parents=false)
Reanalyze a function.
idaman int ida_export try_to_add_libfunc(ea_t ea)
Apply the currently loaded signature file to the specified address.
THREAD_SAFE constexpr bool idaapi f_is_head(flags64_t F, void *)
Does flag denote start of instruction OR data?
Definition bytes.hpp:811
THREAD_SAFE constexpr bool idaapi f_is_data(flags64_t F, void *)
Does flag denote start of data?
Definition bytes.hpp:792
THREAD_SAFE constexpr bool idaapi f_is_code(flags64_t F, void *)
Does flag denote start of an instruction?
Definition bytes.hpp:786
THREAD_SAFE constexpr bool idaapi f_is_not_tail(flags64_t F, void *)
Does flag denote tail byte?
Definition bytes.hpp:800
idaman const char * end
Definition pro.h:1001
idaman size_t n
Definition pro.h:997
uchar inf_get_cmtflg()
Definition ida.hpp:889
uval_t uval_t
Definition kernwin.hpp:1878
unsigned __int64 uint64
Definition llong.hpp:13
uchar type_t
In serialized form, a type is represented by a byte sequence.
Definition nalt.hpp:1317
unsigned int uint32
unsigned 32 bit value
Definition pro.h:348
uint64 asize_t
Definition pro.h:423
uint32 bgcolor_t
background color in RGB
Definition pro.h:5012
uint64 ea_t
Definition pro.h:421
int int32
signed 32 bit value
Definition pro.h:347
idaman THREAD_SAFE char *ida_export qstrdup(const char *string)
System independent strdup.
qvector< ea_t > eavec_t
vector of addresses
Definition pro.h:2764
uint64 flags64_t
64-bit flags for each address
Definition pro.h:5009
ptrdiff_t ssize_t
Signed size_t - used to check for size overflows when the counter becomes negative.
Definition pro.h:381
unsigned short ushort
unsigned 16 bit value
Definition pro.h:338
_qstring< char > qstring
regular string
Definition pro.h:3694
Contains the definition of range_t.
Base class for an range.
Definition range.hpp:35
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
Register argument description.
Definition funcs.hpp:48
regarg_t()
Definition funcs.hpp:53
int reg
Definition funcs.hpp:49
char * name
Definition funcs.hpp:51
DECLARE_COMPARISONS(regarg_t)
type_t * type
Definition funcs.hpp:50
void swap(regarg_t &r)
Definition funcs.hpp:69
~regarg_t()
Definition funcs.hpp:59
regarg_t(const regarg_t &r)
Definition funcs.hpp:54
regarg_t & operator=(const regarg_t &r)
Definition funcs.hpp:60
A register variable allows the user to rename a general processor register to a meaningful name.
Definition frame.hpp:440
Definition frame.hpp:59