IDA C++ SDK 9.2
Loading...
Searching...
No Matches
idp.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 _IDP_HPP
9#define _IDP_HPP
10
11#include <fpro.h>
12#include <ieee.h>
13#include <nalt.hpp>
14#include <segment.hpp>
15#include <funcs.hpp>
16#include <ua.hpp>
17#include <bitrange.hpp>
18#include <config.hpp>
19
39
40typedef int help_t;
41
42struct outctx_t;
43struct regval_t;
44struct stkpnts_t;
45struct simd_info_t;
46struct reg_accesses_t;
47struct call_stack_t;
49struct reg_finder_t;
50class merge_data_t;
51class idasgn_t;
52
55
56#define IDP_INTERFACE_VERSION 900
57
58//-----------------------------------------------------------------------
61struct bytes_t
62{
64 const uchar *bytes;
65};
66
67//-------------------------------------------------------------------------
71#define CF_STOP 0x00001
73#define CF_CALL 0x00002
74#define CF_CHG1 0x00004
75#define CF_CHG2 0x00008
76#define CF_CHG3 0x00010
77#define CF_CHG4 0x00020
78#define CF_CHG5 0x00040
79#define CF_CHG6 0x00080
80#define CF_USE1 0x00100
81#define CF_USE2 0x00200
82#define CF_USE3 0x00400
83#define CF_USE4 0x00800
84#define CF_USE5 0x01000
85#define CF_USE6 0x02000
86#define CF_JUMP 0x04000
88#define CF_SHFT 0x08000
89#define CF_HLL 0x10000
91#define CF_CHG7 0x020000
92#define CF_CHG8 0x040000
93#define CF_USE7 0x080000
94#define CF_USE8 0x100000
96
97//-----------------------------------------------------------------------
102{
103 const char *name;
105};
106
107
109
110inline THREAD_SAFE bool has_cf_chg(uint32 feature, uint opnum)
111{
112 static const int bits[] =
113 {
114 CF_CHG1, CF_CHG2, CF_CHG3, CF_CHG4,
115 CF_CHG5, CF_CHG6, CF_CHG7, CF_CHG8,
116 };
117 CASSERT(qnumber(bits) == UA_MAXOP);
118 return opnum < UA_MAXOP && (feature & bits[opnum]) != 0;
119}
120
121
123
124inline THREAD_SAFE bool has_cf_use(uint32 feature, uint opnum)
125{
126 static const int bits[] =
127 {
128 CF_USE1, CF_USE2, CF_USE3, CF_USE4,
129 CF_USE5, CF_USE6, CF_USE7, CF_USE8,
130 };
131 CASSERT(qnumber(bits) == UA_MAXOP);
132 return opnum < UA_MAXOP && (feature & bits[opnum]) != 0;
133}
134
135
137
138idaman bool ida_export has_insn_feature(uint16 icode, uint32 bit);
139
140
141
143
144idaman bool ida_export is_call_insn(const insn_t &insn);
145
146
148
150#define IRI_EXTENDED 0x00
152#define IRI_RET_LITERALLY 0x01
153#define IRI_SKIP_RETTARGET 0x02
155#define IRI_STRICT (IRI_RET_LITERALLY|IRI_SKIP_RETTARGET)
157idaman bool ida_export is_ret_insn(const insn_t &insn, uchar flags=IRI_STRICT);
158
159
161
162idaman bool ida_export is_indirect_jump_insn(const insn_t &insn);
163
164
166
167idaman bool ida_export is_basic_block_end(const insn_t &insn, bool call_insn_stops_block);
168
169
170//=====================================================================
175struct asm_t
176{
181#define AS_OFFST 0x00000001
182#define AS_COLON 0x00000002
183#define AS_UDATA 0x00000004
184
185#define AS_2CHRE 0x00000008
186#define AS_NCHRE 0x00000010
187#define AS_N2CHR 0x00000020
188
189 // String literals:
190#define AS_1TEXT 0x00000040
191#define AS_NHIAS 0x00000080
192#define AS_NCMAS 0x00000100
193
194#define AS_HEXFM 0x00000E00
195#define ASH_HEXF0 0x00000000
196#define ASH_HEXF1 0x00000200
197#define ASH_HEXF2 0x00000400
198#define ASH_HEXF3 0x00000600
199#define ASH_HEXF4 0x00000800
200#define ASH_HEXF5 0x00000A00
201#define AS_DECFM 0x00003000
202#define ASD_DECF0 0x00000000
203#define ASD_DECF1 0x00001000
204#define ASD_DECF2 0x00002000
205#define ASD_DECF3 0x00003000
206#define AS_OCTFM 0x0001C000
207#define ASO_OCTF0 0x00000000
208#define ASO_OCTF1 0x00004000
209#define ASO_OCTF2 0x00008000
210#define ASO_OCTF3 0x0000C000
211#define ASO_OCTF4 0x00010000
212#define ASO_OCTF5 0x00014000
213#define ASO_OCTF6 0x00018000
214#define ASO_OCTF7 0x0001C000
215#define AS_BINFM 0x000E0000
216#define ASB_BINF0 0x00000000
217#define ASB_BINF1 0x00020000
218#define ASB_BINF2 0x00040000
219#define ASB_BINF3 0x00060000
220#define ASB_BINF4 0x00080000
221#define ASB_BINF5 0x000A0000
222
223#define AS_UNEQU 0x00100000
224#define AS_ONEDUP 0x00200000
225#define AS_NOXRF 0x00400000
226#define AS_XTRNTYPE 0x00800000
227#define AS_RELSUP 0x01000000
228#define AS_LALIGN 0x02000000
229#define AS_NOCODECLN 0x04000000
230#define AS_NOSPACE 0x10000000
231#define AS_ALIGN2 0x20000000
233#define AS_ASCIIC 0x40000000
235#define AS_ASCIIZ 0x80000000
239 const char *name;
241 const char *const *header;
243 const char *origin;
244 const char *end;
245 const char *cmnt;
246 char ascsep;
247 char accsep;
248 const char *esccodes;
250
251 // Data representation (db,dw,...):
252 const char *a_ascii;
253 const char *a_byte;
254 const char *a_word;
255 const char *a_dword;
256 const char *a_qword;
257 const char *a_oword;
258 const char *a_float;
259 const char *a_double;
260 const char *a_tbyte;
261 const char *a_packreal;
262 const char *a_dups;
271 const char *a_bss;
274 const char *a_equ;
275 const char *a_seg;
276
277 const char *a_curip;
278
281 void (idaapi *out_func_header)(outctx_t &ctx, func_t *);
282
285 void (idaapi *out_func_footer)(outctx_t &ctx, func_t *);
286
287 const char *a_public;
288 const char *a_weak;
289 const char *a_extrn;
290 const char *a_comdef;
291
294 ssize_t (idaapi *get_type_name)(
295 qstring *buf,
298
299 const char *a_align;
300
301 char lbrace;
302 char rbrace;
303
304 const char *a_mod;
305 const char *a_band;
306 const char *a_bor;
307 const char *a_xor;
308 const char *a_bnot;
309 const char *a_shl;
310 const char *a_shr;
311 const char *a_sizeof_fmt;
312
317#define AS2_BRACE 0x00000001
318#define AS2_STRINV 0x00000002
320#define AS2_BYTE1CHAR 0x00000004
322#define AS2_IDEALDSCR 0x00000008
325#define AS2_TERSESTR 0x00000010
327#define AS2_COLONSUF 0x00000020
330#define AS2_YWORD 0x00000040
331#define AS2_ZWORD 0x00000080
333
334 const char *cmnt2;
339 const char *low8;
340 const char *high8;
341 const char *low16;
342 const char *high16;
343 const char *a_include_fmt;
344 const char *a_vstruc_fmt;
348 const char *a_rva;
350 const char *a_yword;
352 const char *a_zword;
354};
355#ifndef __X86__
356CASSERT(sizeof(asm_t) == 416);
357#else
358CASSERT(sizeof(asm_t) == 212);
359#endif
360
361// forward declarations for notification helpers
362struct proc_def_t;
363struct elf_loader_t;
364class reader_t;
365struct extlang_t;
366class qflow_chart_t;
367struct libfunc_t;
368struct fixup_data_t;
369struct idd_opinfo_t;
370class argloc_t;
371struct func_type_data_t;
372struct regobjs_t;
373class callregs_t;
374struct funcarg_t;
375
376//--------------------------------------------------------------------------
377struct event_listener_t;
378
391idaman bool ida_export hook_event_listener(
392 hook_type_t hook_type,
394 const void *owner,
395 int hkcb_flags=0);
398#define HKCB_GLOBAL 0x0001
405
412idaman bool ida_export unhook_event_listener(
413 hook_type_t hook_type,
414 event_listener_t *cb);
415
417idaman void ida_export remove_event_listener(event_listener_t *cb);
418
420{
421 size_t listener_flags = 0; // reserved
424 virtual ssize_t idaapi on_event(ssize_t code, va_list va) = 0;
426};
427
429#define DECLARE_LISTENER(listener_type, ctx_type, ctx_name) \
430 struct listener_type : public event_listener_t \
431 { \
432 ctx_type &ctx_name; \
433 listener_type(ctx_type &_ctx) : ctx_name(_ctx) {} \
434 virtual ssize_t idaapi on_event(ssize_t code, va_list va) override; \
435 }
436
437//-------------------------------------------------------------------------
442#define PLFM_386 0
443#define PLFM_Z80 1
444#define PLFM_I860 2
445#define PLFM_8051 3
446#define PLFM_TMS 4
447#define PLFM_6502 5
448#define PLFM_PDP 6
449#define PLFM_68K 7
450#define PLFM_JAVA 8
451#define PLFM_6800 9
452#define PLFM_ST7 10
453#define PLFM_MC6812 11
454#define PLFM_MIPS 12
455#define PLFM_ARM 13
456#define PLFM_TMSC6 14
457#define PLFM_PPC 15
458#define PLFM_80196 16
459#define PLFM_Z8 17
460#define PLFM_SH 18
461#define PLFM_NET 19
462#define PLFM_AVR 20
463#define PLFM_H8 21
464#define PLFM_PIC 22
465#define PLFM_SPARC 23
466#define PLFM_ALPHA 24
467#define PLFM_HPPA 25
468#define PLFM_H8500 26
469#define PLFM_TRICORE 27
470#define PLFM_DSP56K 28
471#define PLFM_C166 29
472#define PLFM_ST20 30
473#define PLFM_IA64 31
474#define PLFM_I960 32
475#define PLFM_F2MC 33
476#define PLFM_TMS320C54 34
477#define PLFM_TMS320C55 35
478#define PLFM_TRIMEDIA 36
479#define PLFM_M32R 37
480#define PLFM_NEC_78K0 38
481#define PLFM_NEC_78K0S 39
482#define PLFM_M740 40
483#define PLFM_M7700 41
484#define PLFM_ST9 42
485#define PLFM_FR 43
486#define PLFM_MC6816 44
487#define PLFM_M7900 45
488#define PLFM_TMS320C3 46
489#define PLFM_KR1878 47
490#define PLFM_AD218X 48
491#define PLFM_OAKDSP 49
492#define PLFM_TLCS900 50
493#define PLFM_C39 51
494#define PLFM_CR16 52
495#define PLFM_MN102L00 53
496#define PLFM_TMS320C1X 54
497#define PLFM_NEC_V850X 55
498#define PLFM_SCR_ADPT 56
499#define PLFM_EBC 57
500#define PLFM_MSP430 58
501#define PLFM_SPU 59
502#define PLFM_DALVIK 60
503#define PLFM_65C816 61
504#define PLFM_M16C 62
505#define PLFM_ARC 63
506#define PLFM_UNSP 64
507#define PLFM_TMS320C28 65
508#define PLFM_DSP96K 66
509#define PLFM_SPC700 67
510#define PLFM_AD2106X 68
511#define PLFM_PIC16 69
512#define PLFM_S390 70
513#define PLFM_XTENSA 71
514#define PLFM_RISCV 72
515#define PLFM_RL78 73
516#define PLFM_RX 74
517#define PLFM_WASM 75
519
520//-------------------------------------------------------------------------
524#define PR_SEGS 0x000001
525#define PR_USE32 0x000002
526#define PR_DEFSEG32 0x000004
527#define PR_RNAMESOK 0x000008
528//#define PR_DB2CSEG 0x0010 // .byte directive in code segments
529// // should define even number of bytes
530// // (used by AVR processor)
531#define PR_ADJSEGS 0x000020
532#define PR_DEFNUM 0x0000C0
533#define PRN_HEX 0x000000
534#define PRN_OCT 0x000040
535#define PRN_DEC 0x000080
536#define PRN_BIN 0x0000C0
537#define PR_WORD_INS 0x000100
538#define PR_NOCHANGE 0x000200
540#define PR_ASSEMBLE 0x000400
541#define PR_ALIGN 0x000800
542#define PR_TYPEINFO 0x001000
545#define PR_USE64 0x002000
546#define PR_SGROTHER 0x004000
547#define PR_STACK_UP 0x008000
548#define PR_BINMEM 0x010000
551#define PR_SEGTRANS 0x020000
554#define PR_CHK_XREF 0x040000
555#define PR_NO_SEGMOVE 0x080000
557//#define PR_FULL_HIFXP 0x100000 // ::REF_VHIGH operand value contains full operand
558// // (not only the high bits) Meaningful if \ph{high_fixup_bits}
559#define PR_USE_ARG_TYPES 0x200000
560#define PR_SCALE_STKVARS 0x400000
561#define PR_DELAYED 0x800000
564#define PR_ALIGN_INSN 0x1000000
567#define PR_PURGING 0x2000000
568#define PR_CNDINSNS 0x4000000
569#define PR_USE_TBYTE 0x8000000
570#define PR_DEFSEG64 0x10000000
571#define PR_OUTER 0x20000000
573
574//-------------------------------------------------------------------------
578#define PR2_MAPPINGS 0x000001
579#define PR2_IDP_OPTS 0x000002
580#define PR2_CODE16_BIT 0x000008
582#define PR2_MACRO 0x000010
583#define PR2_USE_CALCREL 0x000020
584#define PR2_REL_BITS 0x000040
585#define PR2_FORCE_16BIT 0x000080
587
588//-------------------------------------------------------------------------
592#define OP_FP_BASED 0x00000000
593#define OP_SP_BASED 0x00000001
594#define OP_SP_ADD 0x00000000
595#define OP_SP_SUB 0x00000002
597
598//-------------------------------------------------------------------------
601#define CUSTOM_INSN_ITYPE 0x8000
602
603//-------------------------------------------------------------------------
606#define REG_SPOIL 0x80000000
607
608//=====================================================================
613{
619
620 bool has_idp_opts(void) const { return (flag2 & PR2_IDP_OPTS) != 0; }
621 bool has_segregs(void) const { return (flag & PR_SEGS) != 0; }
622 bool use32(void) const { return (flag & (PR_USE64|PR_USE32)) != 0; }
623 bool use64(void) const { return (flag & PR_USE64) != 0; }
624 bool ti(void) const { return (flag & PR_TYPEINFO) != 0; }
625 bool stkup(void) const { return (flag & PR_STACK_UP) != 0; }
626 bool use_tbyte(void) const { return (flag & PR_USE_TBYTE) != 0; }
627 bool use_mappings(void) const { return (flag2 & PR2_MAPPINGS) != 0; }
628 bool has_code16_bit(void) const { return (flag2 & PR2_CODE16_BIT) != 0; }
629 bool supports_macros(void) const { return (flag2 & PR2_MACRO) != 0; }
630 bool supports_calcrel(void) const { return (flag2 & PR2_USE_CALCREL) != 0; }
631 bool calcrel_in_bits(void) const { return (flag2 & PR2_REL_BITS) != 0; }
632
637
638 int get_default_segm_bitness(bool is_64bit_app) const
639 {
640 return is_64bit_app && (flag & PR_DEFSEG64) != 0 ? 2 : (flag & PR_DEFSEG32) != 0;
641 }
642
651
655 int cbsize(void) { return (cnbits+7)/8; }
656 int dbsize(void) { return (dnbits+7)/8; }
658
663 const char *const *psnames;
665 const char *const *plnames;
668
669 inline int get_proc_index();
670
671 const asm_t *const *assemblers;
676
677 typedef const regval_t &(idaapi regval_getter_t)(
678 const char *name,
679 const regval_t *regvalues);
680
681 //<hookgen IDP>
682
696 {
700
702
708
712
715
718
725
728
739
750
758
765
769
773
779
785
791
798
805
813
821
828
836
842
853
858
865
875
880
888
899
906
920
926
932
939
950
959
967
969
979
987
993
998
1003
1019
1030
1038
1045
1055
1062
1073
1082
1092
1099
1107
1114
1121
1125
1131
1142
1150
1161
1162 // the following 5 events are very low level
1163 // take care of possible recursion
1170
1177
1184
1190
1199
1206
1225
1230
1238
1249
1259
1268
1275
1288
1296
1302
1311
1317
1324
1334
1343
1352
1362
1366
1370
1378
1387
1391
1397
1407
1408
1419
1430
1438
1449
1462
1464
1477
1486
1496
1503
1510
1518
1525
1537
1552
1569
1570 // END OF DEBUGGER CALLBACKS
1571
1572 // START OF TYPEINFO CALLBACKS TODO: get this into doxygen output
1573 // The codes below will be called only if #PR_TYPEINFO is set.
1574 // Please note that some codes are optional but the more codes
1575 // are implemented, the better the analysis.
1576
1578
1587
1595
1599
1602
1616
1621
1627
1635
1643
1659
1671
1688
1696
1704
1717
1724
1731
1740
1747
1753
1755
1756 // END OF TYPEINFO CALLBACKS
1757
1762 };
1763
1766 static ssize_t notify(event_t event_code, ...)
1767 {
1768 va_list va;
1769 va_start(va, event_code);
1770 ssize_t code = invoke_callbacks(HT_IDP, event_code, va);
1771 va_end(va);
1772 return code;
1773 }
1774
1775 // Notification helpers, should be used instead of direct ph.notify(...) calls
1776 inline static ssize_t init(const char *idp_modname);
1777 inline static ssize_t term();
1778 inline static ssize_t newprc(int pnum, bool keep_cfg);
1779 inline static ssize_t newasm(int asmnum);
1780 inline static ssize_t asm_installed(int asmnum);
1781 inline static ssize_t newfile(const char *fname);
1782 inline static ssize_t oldfile(const char *fname);
1783 inline static ssize_t newbinary(const char *filename, qoff64_t fileoff, ea_t basepara, ea_t binoff, uint64 nbytes);
1784 inline static ssize_t endbinary(bool ok);
1785 inline static ssize_t creating_segm(segment_t *seg);
1786 inline static ssize_t assemble(uchar *_bin, ea_t ea, ea_t cs, ea_t ip, bool _use32, const char *line);
1787 inline static ssize_t ana_insn(insn_t *out);
1788 inline static ssize_t emu_insn(const insn_t &insn);
1789 inline static ssize_t out_header(outctx_t &ctx);
1790 inline static ssize_t out_footer(outctx_t &ctx);
1791 inline static ssize_t out_segstart(outctx_t &ctx, segment_t *seg);
1792 inline static ssize_t out_segend(outctx_t &ctx, segment_t *seg);
1793 inline static ssize_t out_assumes(outctx_t &ctx);
1794 inline static ssize_t out_insn(outctx_t &ctx);
1795 inline static ssize_t out_mnem(outctx_t &ctx);
1796 inline static ssize_t out_operand(outctx_t &ctx, const op_t &op);
1797 inline static ssize_t out_data(outctx_t &ctx, bool analyze_only);
1798 inline static ssize_t out_label(outctx_t &ctx, const char *colored_name);
1799 inline static ssize_t out_special_item(outctx_t &ctx, uchar segtype);
1800 inline static ssize_t gen_stkvar_def(outctx_t &ctx, const struct udm_t *mptr, sval_t v, tid_t tid);
1801 inline static ssize_t gen_regvar_def(outctx_t &ctx, regvar_t *v);
1802 inline static ssize_t gen_src_file_lnnum(outctx_t &ctx, const char *file, size_t lnnum);
1803 inline static ssize_t rename(ea_t ea, const char *new_name, int flags);
1804 inline static ssize_t may_show_sreg(ea_t current_ea);
1805 inline static ssize_t coagulate(ea_t start_ea);
1806 inline static void auto_queue_empty(/*atype_t*/ int type);
1807
1808 inline static ssize_t func_bounds(int *possible_return_code, func_t *pfn, ea_t max_func_end_ea);
1809 inline static ssize_t may_be_func(const insn_t &insn, int state);
1810 inline static ssize_t is_sane_insn(const insn_t &insn, int no_crefs);
1811 inline static ssize_t cmp_operands(const op_t &op1, const op_t &op2);
1812 inline static ssize_t is_jump_func(func_t *pfn, ea_t *jump_target, ea_t *func_pointer);
1813 inline static ssize_t is_basic_block_end(const insn_t &insn, bool call_insn_stops_block);
1814 inline static ssize_t getreg(uval_t *rv, int regnum);
1815 inline static ssize_t undefine(ea_t ea);
1816 inline static ssize_t moving_segm(segment_t *seg, ea_t to, int flags);
1817 inline static ssize_t is_sp_based(const insn_t &insn, const op_t &x);
1818 inline static ssize_t is_far_jump(int icode);
1819 inline static ssize_t is_call_insn(const insn_t &insn);
1820 inline static ssize_t is_ret_insn(const insn_t &insn, uchar iri_flags);
1821 inline static ssize_t is_align_insn(ea_t ea);
1822 inline static ssize_t is_addr_insn(int *type, const insn_t &insn);
1823 inline static ssize_t can_have_type(const op_t &op);
1824 inline static ssize_t get_stkvar_scale_factor();
1825 inline static ssize_t demangle_name(int32 *res, qstring *out, const char *name, uint32 disable_mask, /*demreq_type_t*/ int demreq);
1826 inline static ssize_t create_flat_group(ea_t image_base, int bitness, sel_t dataseg_sel);
1827 inline static ssize_t is_alloca_probe(ea_t ea);
1828 inline static ssize_t get_reg_name(qstring *buf, int reg, size_t width, int reghi);
1829 inline static ssize_t gen_asm_or_lst(bool starting, FILE *fp, bool is_asm, int flags, /*html_line_cb_t ** */ void *outline);
1830 inline static ssize_t gen_map_file(int *nlines, FILE *fp);
1831 inline static ssize_t get_autocmt(qstring *buf, const insn_t &insn);
1832 inline static ssize_t loader_elf_machine(linput_t *li, int machine_type, const char **p_procname, proc_def_t **p_pd, elf_loader_t *ldr, reader_t *reader);
1833 inline static ssize_t is_indirect_jump(const insn_t &insn);
1834 inline static ssize_t verify_noreturn(func_t *pfn);
1835 inline static ssize_t verify_sp(func_t *pfn);
1836 inline static ssize_t create_func_frame(func_t *pfn);
1837 inline static ssize_t get_frame_retsize(int *retsize, const func_t *pfn);
1838 inline static ssize_t analyze_prolog(ea_t fct_ea);
1839 inline static ssize_t calc_spdelta(sval_t *spdelta, const insn_t &ins);
1840 inline static ssize_t calcrel(bytevec_t *out_relbits, size_t *out_consumed, ea_t ea);
1841 inline static ssize_t get_reg_accesses(reg_accesses_t *accvec, const insn_t &insn, int flags);
1842 inline static ssize_t is_control_flow_guard(int *p_reg, const insn_t *insn);
1843 inline static ssize_t find_reg_value(uval_t *out, const insn_t &insn, int reg);
1844 inline static ssize_t find_op_value(uval_t *out, const insn_t &insn, int op);
1845 inline static ssize_t treat_hindering_item(ea_t hindering_item_ea, flags64_t new_item_flags, ea_t new_item_ea, asize_t new_item_length);
1846 inline static ssize_t extract_address(ea_t *out_ea, ea_t screen_ea, const char *string, size_t x);
1847 inline static ssize_t str2reg(const char *regname);
1848 inline static ssize_t is_switch(switch_info_t *si, const insn_t &insn);
1849 inline static ssize_t create_switch_xrefs(ea_t jumpea, const switch_info_t &si);
1850 inline static ssize_t calc_switch_cases(/*casevec_t * */void *casevec, eavec_t *targets, ea_t insn_ea, const switch_info_t &si);
1851 inline static ssize_t get_bg_color(bgcolor_t *color, ea_t ea);
1852 inline static ssize_t validate_flirt_func(ea_t start_ea, const char *funcname);
1853 inline static ssize_t get_operand_string(qstring *buf, const insn_t &insn, int opnum);
1854 inline static ssize_t add_cref(ea_t from, ea_t to, cref_t type);
1855 inline static ssize_t add_dref(ea_t from, ea_t to, dref_t type);
1856 inline static ssize_t del_cref(ea_t from, ea_t to, bool expand);
1857 inline static ssize_t del_dref(ea_t from, ea_t to);
1858 inline static ssize_t coagulate_dref(ea_t from, ea_t to, bool may_define, ea_t *code_ea);
1859 inline static const char *set_idp_options(const char *keyword, int vtype, const void *value, bool idb_loaded = true);
1860 inline static ssize_t set_proc_options(const char *options, int confidence);
1861 inline static ssize_t adjust_libfunc_ea(const idasgn_t &sig, const libfunc_t &libfun, ea_t *ea);
1862 inline static fpvalue_error_t realcvt(void *m, fpvalue_t *e, uint16 swt);
1863 inline bool delay_slot_insn(ea_t *ea, bool *bexec, bool *fexec);
1864 inline static ssize_t adjust_refinfo(refinfo_t *ri, ea_t ea, int n, const fixup_data_t &fd);
1865 inline static ssize_t is_cond_insn(const insn_t &insn);
1866 inline static ssize_t set_code16_mode(ea_t ea, bool code16 = true);
1867 inline static bool get_code16_mode(ea_t ea);
1868 inline static ssize_t next_exec_insn(ea_t *target, ea_t ea, int tid, regval_getter_t *_getreg, const regval_t &regvalues);
1869 inline static ssize_t calc_step_over(ea_t *target, ea_t ip);
1870 inline static ssize_t get_macro_insn_head(ea_t *head, ea_t ip);
1871 inline static ssize_t get_dbr_opnum(int *opnum, const insn_t &insn);
1872 inline static ssize_t insn_reads_tbit(const insn_t &insn, regval_getter_t *_getreg, const regval_t &regvalues);
1873 inline static ssize_t get_idd_opinfo(idd_opinfo_t *opinf, ea_t ea, int n, int thread_id, regval_getter_t *_getreg, const regval_t &regvalues);
1874 inline static ssize_t calc_next_eas(eavec_t *res, const insn_t &insn, bool over);
1875 inline static ssize_t clean_tbit(ea_t ea, regval_getter_t *_getreg, const regval_t &regvalues);
1876 inline static const char *get_reg_info(const char *regname, bitrange_t *bitrange);
1877 inline static ssize_t update_call_stack(call_stack_t *stack, int tid, regval_getter_t *_getreg, const regval_t &regvalues);
1878 inline static ssize_t setup_til();
1879 inline static ssize_t max_ptr_size();
1880 inline static ssize_t calc_cdecl_purged_bytes(ea_t ea);
1881 inline static ssize_t equal_reglocs(const argloc_t &a1, const argloc_t &a2);
1882 inline static ssize_t _decorate_name(qstring *outbuf, const char *name, bool mangle, callcnv_t cc, const tinfo_t &type);
1883 inline static ssize_t _calc_retloc(argloc_t *retloc, const tinfo_t &rettype, callcnv_t cc);
1884 inline static ssize_t _calc_varglocs(func_type_data_t *ftd, regobjs_t *regs, relobj_t *stkargs, int nfixed);
1885 inline static ssize_t _calc_arglocs(func_type_data_t *fti);
1886 inline static ssize_t use_stkarg_type(ea_t ea, const funcarg_t &arg);
1887 inline static ssize_t use_regarg_type(int *idx, ea_t ea, /*const funcargvec_t * */void *rargs);
1888 inline static ssize_t use_arg_types(ea_t ea, func_type_data_t *fti, /*funcargvec_t * */void *rargs);
1889 inline static ssize_t calc_purged_bytes(int *p_purged_bytes, const func_type_data_t &fti);
1890 inline static ssize_t get_cc_regs(callregs_t *regs, callcnv_t cc);
1891 inline static ssize_t get_simd_types(/*simd_info_vec_t * */void *out, const simd_info_t *simd_attrs, const argloc_t *argloc, bool create_tifs);
1892 inline static ssize_t arg_addrs_ready(ea_t caller, int n, const tinfo_t &tif, ea_t *addrs);
1893 inline static ssize_t adjust_argloc(argloc_t *argloc, const tinfo_t *type, int size);
1894 inline static ssize_t lower_func_type(intvec_t *argnums, func_type_data_t *fti);
1895 inline static ssize_t get_abi_info(qstrvec_t *abi_names, qstrvec_t *abi_opts, comp_t comp);
1896 inline static ssize_t arch_changed();
1897 inline static ssize_t create_merge_handlers(merge_data_t *md);
1898 inline ssize_t privrange_changed(const range_t &old_privrange, adiff_t delta, qstring *errbuf=nullptr);
1899 inline ssize_t cvt64_supval(nodeidx_t node, uchar tag, nodeidx_t idx, const uchar *data, size_t datlen, qstring *errbuf = nullptr);
1900 inline ssize_t cvt64_hashval(nodeidx_t node, uchar tag, const char *name, const uchar *data, size_t datlen, qstring *errbuf = nullptr);
1901 inline static reg_finder_t *get_regfinder();
1902
1907 {
1908 if ( (flag & PR_SCALE_STKVARS) == 0 )
1909 return 1;
1911 if ( scale == 0 )
1912 error("Request ph.get_stkvar_scale_factor should be implemented");
1913 else if ( scale <= 0 )
1914 error("Invalid return code from ph.get_stkvar_scale_factor request");
1915 return scale;
1916 }
1917
1918 // Processor register information:
1919 const char *const *reg_names;
1921
1930
1939
1940
1959
1964
1967 bool is_canon_insn(uint16 itype) const { return itype >= instruc_start && itype < instruc_end; }
1968
1970
1972 const char *get_canon_mnem(uint16 itype) const
1973 {
1974 return is_canon_insn(itype) ? instruc[itype-instruc_start].name : nullptr;
1975 }
1976
1979 {
1980 return is_canon_insn(itype) ? instruc[itype-instruc_start].feature : 0;
1981 }
1982
1983
1987
1998 char real_width[4];
1999
2002
2005
2006 inline void ensure_processor(void);
2007 inline size_t sizeof_ldbl() const;
2008 inline bool is_funcarg_off(const func_t *pfn, uval_t frameoff) const;
2009 inline sval_t lvar_off(const func_t *pfn, uval_t frameoff) const;
2010 inline bool is_lumina_usable() const;
2011};
2012#ifndef __X86__
2013CASSERT(sizeof(processor_t) == 144);
2014#else
2015CASSERT(sizeof(processor_t) == 104);
2016#endif
2017
2018// The following two structures contain information about the current
2019// processor and assembler.
2020
2021idaman processor_t *ida_export get_ph();
2022#define PH (*get_ph())
2023idaman asm_t *ida_export get_ash();
2024#define ASH (*get_ash())
2025idaman ea_helper_t *ida_export get_eah();
2026#define EAH (*get_eah())
2027
2030typedef void *hexdsp_t(int code, ...);
2031idaman hexdsp_t *ida_export get_hexdsp();
2032#ifndef HEXDSP
2033 #define HEXDSP get_hexdsp()
2034#endif
2035
2036
2037#ifndef SWIG
2038// ignore_micro manager: can be used in modules/plugins as a base class
2040{
2041 //--------------------------------------------------------------------------
2046
2047#define IM_NONE 0 // regular instruction
2048#define IM_PROLOG 1 // prolog instruction
2049#define IM_EPILOG 2 // epilog instruction
2050#define IM_SWITCH 3 // switch instruction (the indirect jump should not be marked)
2051
2052 inline void init_ignore_micro(void) { ignore_micro.create("$ ignore micro"); }
2053 inline void term_ignore_micro(void) { ignore_micro = BADNODE; }
2054 inline char get_ignore_micro(ea_t ea) const { return ignore_micro.charval_ea(ea, 0); }
2055 inline void set_ignore_micro(ea_t ea, uchar im_type) { ignore_micro.charset_ea(ea, im_type, 0); }
2056 inline void clr_ignore_micro(ea_t ea) { ignore_micro.chardel_ea(ea, 0); }
2057 inline ea_t next_marked_insn(ea_t ea) { return node2ea(ignore_micro.charnext(ea2node(ea), 0)); }
2058 inline void mark_prolog_insn(ea_t ea) { set_ignore_micro(ea, IM_PROLOG); }
2059 inline void mark_epilog_insn(ea_t ea) { set_ignore_micro(ea, IM_EPILOG); }
2060 inline void mark_switch_insn(ea_t ea) { set_ignore_micro(ea, IM_SWITCH); }
2061 inline bool is_prolog_insn(ea_t ea) const { return get_ignore_micro(ea) == IM_PROLOG; }
2062 inline bool is_epilog_insn(ea_t ea) const { return get_ignore_micro(ea) == IM_EPILOG; }
2063 inline bool is_switch_insn(ea_t ea) const { return get_ignore_micro(ea) == IM_SWITCH; }
2064 inline bool should_ignore_micro(ea_t ea) const { return get_ignore_micro(ea) != IM_NONE; }
2066};
2067#endif // SWIG
2068
2070{
2074 size_t reserved[8] = { 0 };
2075 modctx_t() : ph(PH), ash(ASH), _eah(EAH) {}
2076#ifndef SWIG
2077 DEFINE_EA_HELPER_FUNCS(_eah)
2078#endif
2079 // this class is freed by IDA kernel on unload so must be allocated by it
2080 DEFINE_MEMORY_ALLOCATION_FUNCS()
2081};
2082
2083// Each processor module subclasses this class and reacts to HT_IDP events
2084struct procmod_t : public modctx_t, public event_listener_t, public ignore_micro_t
2085{
2086 size_t procmod_flags = 0;
2087
2089 procmod_t(const procmod_t &) = delete;
2090
2092 const op_t *make_op_reg(op_t *op, int reg, int8 dtype = -1) const
2093 {
2094 op->type = o_reg;
2095 op->reg = reg;
2096 op->dtype = calc_op_dtype(dtype);
2097 return op;
2098 }
2099 const op_t *make_op_imm(op_t *op, uval_t val, int8 dtype = -1) const
2100 {
2101 op->type = o_imm;
2102 op->value = val;
2103 op->dtype = calc_op_dtype(dtype);
2104 return op;
2105 }
2107 op_t *op,
2108 int base_reg,
2109 uval_t displ,
2110 int8 dtype = -1) const
2111 {
2112 op->type = o_displ;
2113 op->phrase = base_reg;
2114 op->addr = displ;
2115 op->dtype = calc_op_dtype(dtype);
2116 return op;
2117 }
2118
2120 op_t *op,
2121 int base_reg,
2122 int index_reg,
2123 int8 dtype = -1) const
2124 {
2125 op->type = o_phrase;
2126 op->phrase = base_reg;
2127 op->value = index_reg;
2128 op->dtype = calc_op_dtype(dtype);
2129 return op;
2130 }
2131
2132protected:
2134 {
2135 return dtype != -1 ? op_dtype_t(dtype)
2136 : eah().ea_size == 4 ? dt_dword
2137 : dt_qword;
2138 }
2139};
2140
2141
2142struct plugmod_t : public modctx_t
2143{
2144 size_t owner = 0; // internal info used by the kernel
2145
2147 virtual bool idaapi run(size_t arg) = 0;
2148
2151 hook_type_t hook_type,
2152 event_listener_t *cb,
2153 int hkcb_flags=0)
2154 {
2155 return ::hook_event_listener(hook_type, cb, this, hkcb_flags);
2156 }
2157
2159 virtual ~plugmod_t() {}
2160};
2161
2162inline ssize_t processor_t::init(const char *idp_modname)
2163{
2164 return notify(ev_init, idp_modname);
2165}
2167{
2168 return notify(ev_term);
2169}
2170inline ssize_t processor_t::newprc(int pnum, bool keep_cfg)
2171{
2172 return notify(ev_newprc, pnum, keep_cfg);
2173}
2175{
2176 return notify(ev_newasm, asmnum);
2177}
2179{
2180 return notify(ev_asm_installed, asmnum);
2181}
2182inline ssize_t processor_t::get_reg_accesses(reg_accesses_t *accvec, const insn_t &insn, int flags)
2183{
2184 return notify(ev_get_reg_accesses, accvec, &insn, flags);
2185}
2186inline ssize_t processor_t::is_control_flow_guard(int *p_reg, const insn_t *insn)
2187{
2188 return processor_t::notify(ev_is_control_flow_guard, p_reg, insn);
2189}
2190inline ssize_t processor_t::newfile(const char *fname)
2191{
2192 return notify(ev_newfile, fname);
2193}
2194inline ssize_t processor_t::oldfile(const char *fname)
2195{
2196 return notify(ev_oldfile, fname);
2197}
2198inline ssize_t processor_t::newbinary(const char *filename, qoff64_t fileoff, ea_t basepara, ea_t binoff, uint64 nbytes)
2199{
2200 return notify(ev_newbinary, filename, fileoff, basepara, binoff, nbytes);
2201}
2203{
2204 return notify(ev_endbinary, ok);
2205}
2207{
2208 return notify(ev_creating_segm, seg);
2209}
2210inline ssize_t processor_t::assemble(uchar *_bin, ea_t ea, ea_t cs, ea_t ip, bool _use32, const char *line)
2211{
2212 return notify(ev_assemble, _bin, ea, cs, ip, _use32, line, _bin);
2213}
2215{
2216 return notify(ev_ana_insn, out);
2217}
2218inline ssize_t processor_t::emu_insn(const insn_t &insn)
2219{
2220 return notify(ev_emu_insn, &insn);
2221}
2223{
2224 return notify(ev_out_header, &ctx);
2225}
2227{
2228 return notify(ev_out_footer, &ctx);
2229}
2231{
2232 return notify(ev_out_segstart, &ctx, seg);
2233}
2235{
2236 return notify(ev_out_segend, &ctx, seg);
2237}
2239{
2240 return notify(ev_out_assumes, &ctx);
2241}
2243{
2244 return notify(ev_out_insn, &ctx);
2245}
2247{
2248 return notify(ev_out_mnem, &ctx);
2249}
2251{
2252 return notify(ev_out_operand, &ctx, &op);
2253}
2254inline ssize_t processor_t::out_data(outctx_t &ctx, bool analyze_only)
2255{
2256 return notify(ev_out_data, &ctx, analyze_only);
2257}
2258inline ssize_t processor_t::out_label(outctx_t &ctx, const char *colored_name)
2259{
2260 return notify(ev_out_label, &ctx, colored_name);
2261}
2266inline ssize_t processor_t::gen_stkvar_def(outctx_t &ctx, const struct udm_t *stkvar, sval_t v, tid_t tid)
2267{
2268 return notify(ev_gen_stkvar_def, &ctx, stkvar, v, tid);
2269}
2271{
2272 return notify(ev_gen_regvar_def, &ctx, v);
2273}
2274inline ssize_t processor_t::gen_src_file_lnnum(outctx_t &ctx, const char *file, size_t lnnum)
2275{
2276 return notify(ev_gen_src_file_lnnum, &ctx, file, lnnum);
2277}
2278inline ssize_t processor_t::rename(ea_t ea, const char *new_name, int flags)
2279{
2280 return notify(ev_rename, ea, new_name, flags);
2281}
2283{
2284 return notify(ev_may_show_sreg, current_ea);
2285}
2287{
2288 return notify(ev_coagulate, start_ea);
2289}
2290inline void processor_t::auto_queue_empty(/*atype_t*/ int type)
2291{
2293}
2294inline ssize_t processor_t::func_bounds(int *possible_return_code, func_t *pfn, ea_t max_func_end_ea)
2295{
2296 return notify(ev_func_bounds, possible_return_code, pfn, max_func_end_ea);
2297}
2298inline ssize_t processor_t::may_be_func(const insn_t &insn, int state)
2299{
2300 return notify(ev_may_be_func, &insn, state);
2301}
2302inline ssize_t processor_t::is_sane_insn(const insn_t &insn, int no_crefs)
2303{
2304 return notify(ev_is_sane_insn, &insn, no_crefs);
2305}
2306inline ssize_t processor_t::cmp_operands(const op_t &op1, const op_t &op2)
2307{
2308 return notify(ev_cmp_operands, &op1, &op2);
2309}
2310inline ssize_t processor_t::is_jump_func(func_t *pfn, ea_t *jump_target, ea_t *func_pointer)
2311{
2312 return notify(ev_is_jump_func, pfn, jump_target, func_pointer);
2313}
2314inline ssize_t processor_t::is_basic_block_end(const insn_t &insn, bool call_insn_stops_block)
2315{
2316 return notify(ev_is_basic_block_end, &insn, call_insn_stops_block);
2317}
2318inline ssize_t processor_t::getreg(uval_t *rv, int regnum)
2319{
2320 return notify(ev_getreg, rv, regnum);
2321}
2323{
2324 return notify(ev_undefine, ea);
2325}
2327{
2328 return notify(ev_moving_segm, seg, to, flags);
2329}
2330inline ssize_t processor_t::is_sp_based(const insn_t &insn, const op_t &x)
2331{
2332 int mode;
2333 int code = notify(ev_is_sp_based, &mode, &insn, &x);
2334 return code == 0 ? OP_SP_BASED : mode;
2335}
2337{
2338 return notify(ev_is_far_jump, icode);
2339}
2340inline ssize_t processor_t::is_call_insn(const insn_t &insn)
2341{
2342 return notify(ev_is_call_insn, &insn);
2343}
2344inline ssize_t processor_t::is_ret_insn(const insn_t &insn, uchar iri_flags)
2345{
2346 return notify(ev_is_ret_insn, &insn, iri_flags);
2347}
2349{
2350 return notify(ev_is_align_insn, ea);
2351}
2352inline ssize_t processor_t::is_addr_insn(int *type, const insn_t &insn)
2353{
2354 return notify(ev_is_addr_insn, type, &insn);
2355}
2357{
2359 return code != 0 ? code
2360 : op.type == o_void || op.type == o_reg ? -1
2361 : 1;
2362}
2367inline ssize_t processor_t::demangle_name(int32 *res, qstring *out, const char *name, uint32 disable_mask, /*demreq_type_t*/ int demreq)
2368{
2369 return notify(ev_demangle_name, res, out, name, disable_mask, demreq);
2370}
2371inline ssize_t processor_t::create_flat_group(ea_t image_base, int bitness, sel_t dataseg_sel)
2372{
2373 return notify(ev_create_flat_group, image_base, bitness, dataseg_sel);
2374}
2376{
2377 return notify(ev_is_alloca_probe, ea);
2378}
2379inline ssize_t processor_t::get_reg_name(qstring *buf, int reg, size_t width, int reghi)
2380{
2381 return notify(ev_get_reg_name, buf, reg, width, reghi);
2382}
2383inline ssize_t processor_t::gen_asm_or_lst(bool starting, FILE *fp, bool is_asm, int flags, /*html_line_cb_t ** */ void *outline)
2384{
2385 return notify(ev_gen_asm_or_lst, starting, fp, is_asm, flags, outline);
2386}
2387inline ssize_t processor_t::gen_map_file(int *nlines, FILE *fp)
2388{
2389 return notify(ev_gen_map_file, nlines, fp);
2390}
2391inline ssize_t processor_t::get_autocmt(qstring *buf, const insn_t &insn)
2392{
2393 return notify(ev_get_autocmt, buf, &insn);
2394}
2395inline ssize_t processor_t::loader_elf_machine(linput_t *li, int machine_type, const char **p_procname, proc_def_t **p_pd, elf_loader_t *ldr, reader_t *reader)
2396{
2397 return notify(ev_loader_elf_machine, li, machine_type, p_procname, p_pd, ldr, reader);
2398}
2399inline ssize_t processor_t::is_indirect_jump(const insn_t &insn)
2400{
2401 return notify(ev_is_indirect_jump, &insn);
2402}
2404{
2405 return notify(ev_verify_noreturn, pfn);
2406}
2408{
2409 return notify(ev_verify_sp, pfn);
2410}
2415inline ssize_t processor_t::get_frame_retsize(int *retsize, const func_t *pfn)
2416{
2417 return notify(ev_get_frame_retsize, retsize, pfn);
2418}
2420{
2421 return notify(ev_analyze_prolog, fct_ea);
2422}
2423inline ssize_t processor_t::calc_spdelta(sval_t *spdelta, const insn_t &insn)
2424{
2425 return notify(ev_calc_spdelta, spdelta, &insn);
2426}
2427inline ssize_t processor_t::calcrel(bytevec_t *out_relbits, size_t *out_consumed, ea_t ea)
2428{
2429 return notify(ev_calcrel, out_relbits, out_consumed, ea);
2430}
2431inline ssize_t processor_t::find_reg_value(uval_t *out, const insn_t &insn, int reg)
2432{
2433 return notify(ev_find_reg_value, out, &insn, reg);
2434}
2435inline ssize_t processor_t::find_op_value(uval_t *out, const insn_t &insn, int opn)
2436{
2437 return notify(ev_find_op_value, out, &insn, opn);
2438}
2439inline ssize_t processor_t::treat_hindering_item(ea_t hindering_item_ea, flags64_t new_item_flags, ea_t new_item_ea, asize_t new_item_length)
2440{
2441 return notify(ev_treat_hindering_item, hindering_item_ea, new_item_flags, new_item_ea, new_item_length);
2442}
2443inline ssize_t processor_t::extract_address(ea_t *out_ea, ea_t screen_ea, const char *string, size_t x)
2444{
2445 return notify(ev_extract_address, out_ea, screen_ea, string, x);
2446}
2447inline ssize_t processor_t::str2reg(const char *regname)
2448{
2449 return notify(ev_str2reg, regname);
2450}
2451inline ssize_t processor_t::is_switch(switch_info_t *si, const insn_t &insn)
2452{
2453 return notify(ev_is_switch, si, &insn);
2454}
2456{
2457 return notify(ev_create_switch_xrefs, jumpea, &si);
2458}
2459inline ssize_t processor_t::calc_switch_cases(/*casevec_t * */void *casevec, eavec_t *targets, ea_t insn_ea, const switch_info_t &si)
2460{
2461 return notify(ev_calc_switch_cases, casevec, targets, insn_ea, &si);
2462}
2464{
2465 return notify(ev_get_bg_color, color, ea);
2466}
2467inline ssize_t processor_t::validate_flirt_func(ea_t start_ea, const char *funcname)
2468{
2469 return notify(ev_validate_flirt_func, start_ea, funcname);
2470}
2471inline ssize_t processor_t::get_operand_string(qstring *buf, const insn_t &insn, int opnum)
2472{
2473 return notify(ev_get_operand_string, buf, &insn, opnum);
2474}
2476{
2477 return notify(ev_add_cref, from, to, type);
2478}
2480{
2481 return notify(ev_add_dref, from, to, type);
2482}
2483inline ssize_t processor_t::del_cref(ea_t from, ea_t to, bool expand)
2484{
2485 return notify(ev_del_cref, from, to, expand);
2486}
2488{
2489 return notify(ev_del_dref, from, to);
2490}
2491inline ssize_t processor_t::coagulate_dref(ea_t from, ea_t to, bool may_define, ea_t *code_ea)
2492{
2493 return notify(ev_coagulate_dref, from, to, may_define, code_ea);
2494}
2495inline const char *processor_t::set_idp_options(const char *keyword, int vtype, const void *value, bool idb_loaded)
2496{
2497 const char *errmsg = IDPOPT_BADKEY;
2498 int code = notify(ev_set_idp_options, keyword, vtype, value, &errmsg, idb_loaded);
2499 return code == 1 ? IDPOPT_OK : code == 0 ? IDPOPT_BADKEY : errmsg;
2500}
2501inline ssize_t processor_t::set_proc_options(const char *options, int confidence)
2502{
2503 return notify(ev_set_proc_options, options, confidence);
2504}
2505inline ssize_t processor_t::adjust_libfunc_ea(const idasgn_t &sig, const libfunc_t &libfun, ea_t *ea)
2506{
2507 return notify(ev_adjust_libfunc_ea, &sig, &libfun, ea);
2508}
2510{
2511 return (fpvalue_error_t)notify(ev_realcvt, m, e, swt);
2512}
2514{
2515 return notify(ev_adjust_refinfo, ri, ea, n, &fd);
2516}
2517inline ssize_t processor_t::is_cond_insn(const insn_t &insn)
2518{
2519 return notify(ev_is_cond_insn, &insn);
2520}
2522{
2523 return notify(ev_set_code16_mode, ea, code16);
2524}
2526{
2527 return notify(ev_get_code16_mode, ea) == 1;
2528}
2529inline ssize_t processor_t::next_exec_insn(ea_t *target, ea_t ea, int tid, regval_getter_t *_getreg, const regval_t &regvalues)
2530{
2531 return notify(ev_next_exec_insn, target, ea, tid, _getreg, &regvalues);
2532}
2534{
2535 return notify(ev_calc_step_over, target, ip);
2536}
2538{
2539 return notify(ev_get_macro_insn_head, head, ip);
2540}
2541inline ssize_t processor_t::get_dbr_opnum(int *opnum, const insn_t &insn)
2542{
2543 return notify(ev_get_dbr_opnum, opnum, &insn);
2544}
2545inline ssize_t processor_t::insn_reads_tbit(const insn_t &insn, regval_getter_t *_getreg, const regval_t &regvalues)
2546{
2547 return notify(ev_insn_reads_tbit, &insn, _getreg, &regvalues);
2548}
2549inline ssize_t processor_t::get_idd_opinfo(idd_opinfo_t *opinf, ea_t ea, int n, int thread_id, regval_getter_t *_getreg, const regval_t &regvalues)
2550{
2551 return notify(ev_get_idd_opinfo, opinf, ea, n, thread_id, _getreg, &regvalues);
2552}
2553inline ssize_t processor_t::update_call_stack(call_stack_t *stack, int thread_id, regval_getter_t *_getreg, const regval_t &regvalues)
2554{
2555 return notify(ev_update_call_stack, stack, thread_id, _getreg, &regvalues);
2556}
2557inline ssize_t processor_t::calc_next_eas(eavec_t *res, const insn_t &insn, bool over)
2558{
2559 return notify(ev_calc_next_eas, res, &insn, over);
2560}
2561inline ssize_t processor_t::clean_tbit(ea_t ea, regval_getter_t *_getreg, const regval_t &regvalues)
2562{
2563 return notify(ev_clean_tbit, ea, _getreg, &regvalues);
2564}
2566{
2567 return notify(ev_setup_til);
2568}
2570{
2572 if ( code == 0 )
2573 code = 4;
2574 return code;
2575}
2580// Use global calc_retloc() instead of this:
2582{
2583 return notify(ev_calc_retloc, retloc, &rettype, cc);
2584}
2585// Use global calc_varglocs() instead of this:
2587{
2588 return notify(ev_calc_varglocs, ftd, regs, stkargs, nfixed);
2589}
2590// Use global calc_arglocs() instead of this:
2596{
2597 return notify(ev_use_stkarg_type, ea, &arg);
2598}
2599inline ssize_t processor_t::use_regarg_type(int *idx, ea_t ea, /*const funcargvec_t * */void *rargs)
2600{
2601 return notify(ev_use_regarg_type, idx, ea, rargs);
2602}
2603inline ssize_t processor_t::use_arg_types(ea_t ea, func_type_data_t *fti, /*funcargvec_t * */void *rargs)
2604{
2605 return notify(ev_use_arg_types, ea, fti, rargs);
2606}
2607inline ssize_t processor_t::calc_purged_bytes(int *p_purged_bytes, const func_type_data_t &fti)
2608{
2609 return notify(ev_calc_purged_bytes, p_purged_bytes, &fti);
2610}
2612{
2613 return notify(ev_get_cc_regs, regs, cc);
2614}
2615inline ssize_t processor_t::get_simd_types(/*simd_info_vec_t * */void *out, const simd_info_t *simd_attrs, const argloc_t *argloc, bool create_tifs)
2616{
2617 return notify(ev_get_simd_types, out, simd_attrs, argloc, create_tifs);
2618}
2619inline ssize_t processor_t::arg_addrs_ready(ea_t caller, int n, const tinfo_t &tif, ea_t *addrs)
2620{
2621 return notify(ev_arg_addrs_ready, caller, n, &tif, addrs);
2622}
2624{
2625 return notify(ev_adjust_argloc, argloc, type, size);
2626}
2628{
2629 return notify(ev_lower_func_type, argnums, fti);
2630}
2632{
2633 return notify(ev_get_abi_info, abi_names, abi_opts, comp);
2634}
2636{
2637 return notify(ev_arch_changed);
2638}
2643inline ssize_t processor_t::privrange_changed(const range_t &old_privrange, adiff_t delta, qstring *errbuf)
2644{
2645 return notify(ev_privrange_changed, &old_privrange, delta, errbuf);
2646}
2647inline ssize_t processor_t::cvt64_supval(nodeidx_t node, uchar tag, nodeidx_t idx, const uchar *data, size_t datlen, qstring *errbuf)
2648{
2649 return notify(ev_cvt64_supval, node, tag, idx, data, datlen, errbuf);
2650}
2651inline ssize_t processor_t::cvt64_hashval(nodeidx_t node, uchar tag, const char *name, const uchar *data, size_t datlen, qstring *errbuf)
2652{
2653 return notify(ev_cvt64_hashval, node, tag, name, data, datlen, errbuf);
2654}
2659
2660idaman int ida_export str2reg(const char *p);
2661
2662
2665
2666idaman int ida_export is_align_insn(ea_t ea);
2667
2668
2678
2679idaman ssize_t ida_export get_reg_name(qstring *buf, int reg, size_t width, int reghi = -1);
2680
2681
2685
2686inline const char *processor_t::get_reg_info(const char *regname, bitrange_t *bitrange)
2687{
2688 const char *r2;
2689 int code = notify(ev_get_reg_info, &r2, bitrange, regname);
2690 if ( code == 0 ) // not implemented?
2691 {
2692 if ( ::str2reg(regname) != -1 )
2693 {
2694 if ( bitrange != nullptr )
2695 bitrange->reset();
2696 return regname;
2697 }
2698 return nullptr;
2699 }
2700 return code == 1 ? r2 : nullptr;
2701}
2702
2705{
2706 int reg;
2707 int size;
2709 {
2710 if ( reg != r.reg )
2711 return reg > r.reg ? 1 : -1;
2712 if ( size != r.size )
2713 return size > r.size ? 1 : -1;
2714 return 0;
2715 }
2716};
2719
2720
2725
2726idaman bool ida_export parse_reg_name(reg_info_t *ri, const char *regname);
2727
2728
2730enum access_type_t ENUM_SIZE(uchar)
2731{
2732 NO_ACCESS = 0,
2733 WRITE_ACCESS = 1,
2734 READ_ACCESS = 2,
2735 RW_ACCESS = WRITE_ACCESS | READ_ACCESS,
2736};
2737
2740{
2741 int regnum = 0;
2743 access_type_t access_type = NO_ACCESS;
2745
2746 bool have_common_bits(const reg_access_t &r) const
2747 {
2748 return regnum == r.regnum && range.has_common(r.range);
2749 }
2750
2751 bool operator==(const reg_access_t &r) const
2752 {
2753 return regnum == r.regnum
2754 && range == r.range
2755 && access_type == r.access_type
2756 && opnum == r.opnum;
2757 }
2758
2759 bool operator!=(const reg_access_t &r) const
2760 {
2761 return !(*this == r);
2762 }
2763};
2766
2768
2769
2770inline bool insn_t::is_canon_insn(const processor_t &_ph) const // see ::insn_t in ua.hpp
2771{
2772 return _ph.is_canon_insn(itype);
2773}
2774
2775inline const char *insn_t::get_canon_mnem(const processor_t &_ph) const // see ::insn_t in ua.hpp
2776{
2777 return _ph.get_canon_mnem(itype);
2778}
2779
2780inline uint32 insn_t::get_canon_feature(const processor_t &_ph) const // ::insn_t in ua.hpp
2781{
2782 return _ph.get_canon_feature(itype);
2783}
2784
2785
2787inline size_t processor_t::sizeof_ldbl() const
2788{
2790}
2791
2804
2810
2811idaman bool ida_export set_processor_type(
2812 const char *procname,
2813 setproc_level_t level);
2814
2815
2823
2824idaman char *ida_export get_idp_name(char *buf, size_t bufsize);
2825
2826
2830
2831idaman bool ida_export set_target_assembler(int asmnum);
2832
2833
2835inline bool processor_t::delay_slot_insn(ea_t *ea, bool *bexec, bool *fexec)
2836{
2837 bool ok = (flag & PR_DELAYED) != 0;
2838 if ( ok )
2839 {
2840 bool be = true;
2841 bool fe = true;
2842 ok = notify(ev_delay_slot_insn, ea, &be, &fe) == 1;
2843 if ( ok )
2844 {
2845 if ( bexec != nullptr )
2846 *bexec = be;
2847 if ( fexec != nullptr )
2848 *fexec = fe;
2849 }
2850 }
2851 return ok;
2852}
2853
2866
2872namespace idb_event
2873{
2874 //<hookgen IDB>
2875
2878 {
2880
2882
2886
2892
2895
2898
2906
2911
2914
2920
2924
2928
2933
2938
2949
2957
2961
2968
2976
2984
2991
2997
3002
3009
3014
3017
3020
3024
3028
3031 //
3035
3038
3042
3046
3050
3055
3058
3061
3066
3069 //
3077
3080
3086
3091
3098
3102
3110
3121
3126
3131
3135
3142
3147
3150
3153
3157
3161
3166
3171
3176
3180
3184
3189
3194
3199
3204
3211
3216
3220
3224
3229
3234
3240
3245
3250
3254
3259
3264
3270
3275
3276 };
3277}
3278
3279
3281
3283{
3284 if ( errorexit )
3285 return;
3286 va_list va;
3287 va_start(va, code);
3289 va_end(va);
3290}
3291
3293{
3294 qstring curproc = inf_get_procname();
3295 for ( size_t i = 0; psnames[i] != nullptr; ++i )
3296 {
3297 const char *p = psnames[i];
3298 if ( p[0] == '-' ) // obsolete processor names start with a '-'
3299 ++p;
3300 if ( curproc == p )
3301 return i;
3302 }
3303 // should not reach here
3304 INTERR(10336);
3305}
3306
3311
3318
3319idaman void *ida_export set_module_data(int *data_id, void *data_ptr);
3320
3321
3327
3328idaman void *ida_export clr_module_data(int data_id);
3329
3330
3331
3335
3336idaman void *ida_export get_module_data(int data_id);
3337
3338// Convenience macros to handle the module data.
3339// They assume the existence of a global variable "int data_id"
3340#define SET_MODULE_DATA(type) (type *)set_module_data(&data_id, new type)
3341#define GET_MODULE_DATA(type) ((type *)get_module_data(data_id))
3342
3343
3344#endif // _IDP_HPP
Definition of the bitrange_t class.
Describes an argument location.
Definition typeinf.hpp:1101
This class manages the offset and size of a value that occupies a number of contiguous bits within so...
Definition bitrange.hpp:16
void reset()
Make the bitrange empty.
Definition bitrange.hpp:126
Vector of bytes (use for dynamic memory)
Definition pro.h:3773
Register allocation calling convention.
Definition typeinf.hpp:1733
A function is a set of continuous ranges of addresses with characteristics.
Definition funcs.hpp:85
class to contain public info about the merge process
Definition merge.hpp:191
Definition of the IDA database node.
Definition netnode.hpp:241
Operand of an instruction.
Definition ua.hpp:170
uint16 reg
number of register (o_reg)
Definition ua.hpp:256
uint16 phrase
number of register phrase (o_phrase,o_displ).
Definition ua.hpp:257
uval_t value
operand value (o_imm) or outer displacement (o_displ+OF_OUTER_DISP).
Definition ua.hpp:270
optype_t type
Type of operand (see Operand types)
Definition ua.hpp:178
op_dtype_t dtype
Type of operand value (see Operand value types).
Definition ua.hpp:225
ea_t addr
virtual address pointed or used by the operand.
Definition ua.hpp:293
A flow chart for a function, or a set of address ranges.
Definition gdl.hpp:443
Reimplementation of vector class from STL.
Definition pro.h:2250
Describes a program segment.
Definition segment.hpp:69
Primary mechanism for managing type information.
Definition typeinf.hpp:3046
System independent counterparts of FILE* related functions from Clib.
Routines for working with functions within the disassembled program.
const optype_t o_reg
General Register (al,ax,es,ds...).
Definition ua.hpp:83
const optype_t o_phrase
An indirect memory reference that uses a register: [reg] There can be several registers but no displa...
Definition ua.hpp:87
const optype_t o_displ
An indirect memory reference that uses a register and has an immediate constant added to it: [reg+N] ...
Definition ua.hpp:89
const optype_t o_imm
An immediate Value (constant).
Definition ua.hpp:92
const optype_t o_void
No Operand.
Definition ua.hpp:82
idaman THREAD_SAFE va_list va
See qsscanf()
Definition err.h:21
va_end(va)
THREAD_SAFE va_start(va, format)
int code
Definition fpro.h:88
idaman size_t n
Definition pro.h:997
idaman uchar ida_export segtype(ea_t ea)
Get segment type.
cref_t
CODE xref types.
Definition xref.hpp:49
dref_t
DATA xref types.
Definition xref.hpp:67
int help_t
message id from ida.hlp
Definition help.h:11
void * hexdsp_t(int code,...)
Hex-Rays decompiler dispatcher.
Definition hexrays.hpp:7832
cexpr_t * e
Definition hexrays.hpp:7308
const tinfo_t & type
Definition hexrays.hpp:7301
qstring inf_get_procname()
Definition ida.hpp:1029
uint32 callcnv_t
Definition ida.hpp:74
hook_type_t
Types of events that be hooked to with hook_event_listener()
Definition ida.hpp:1284
@ HT_IDB
Hook to the database events.
Definition ida.hpp:1291
@ HT_IDP
Hook to the processor module.
Definition ida.hpp:1285
uchar inf_get_cc_size_ldbl()
Definition ida.hpp:1022
ssize_t idaapi hook_cb_t(void *user_data, int notification_code, va_list va)
Callback provided to hook_to_notification_point().
Definition ida.hpp:1332
uchar comp_t
target compiler id
Definition ida.hpp:72
idaman ssize_t ida_export invoke_callbacks(hook_type_t hook_type, int notification_code, va_list va)
Generate event notification.
idaman bool ida_export hook_event_listener(hook_type_t hook_type, event_listener_t *cb, const void *owner, int hkcb_flags=0)
Install an event listener.
idaman asm_t *ida_export get_ash()
void gen_idb_event(idb_event::event_code_t code,...)
the kernel will use this function to generate idb_events
Definition idp.hpp:3282
idaman int ida_export is_align_insn(ea_t ea)
If the instruction at 'ea' looks like an alignment instruction, return its length in bytes.
setproc_level_t
Flags passed as 'level' parameter to set_processor_type()
Definition idp.hpp:2794
@ SETPROC_LOADER
set processor type for new idb; if the user has specified a compatible processor, return success with...
Definition idp.hpp:2796
@ SETPROC_IDB
set processor type for old idb
Definition idp.hpp:2795
@ SETPROC_USER
set user-specified processor used for -p and manual processor change at later time
Definition idp.hpp:2801
@ SETPROC_LOADER_NON_FATAL
the same as SETPROC_LOADER but non-fatal failures.
Definition idp.hpp:2800
idaman bool ida_export unhook_event_listener(hook_type_t hook_type, event_listener_t *cb)
Uninstall an event listener.
qvector< reg_access_t > reg_access_vec_t
Definition idp.hpp:2765
qvector< reg_info_t > reginfovec_t
vector of register info objects
Definition idp.hpp:2718
idaman bool ida_export set_target_assembler(int asmnum)
Set target assembler.
idaman void *ida_export clr_module_data(int data_id)
Unregister pointer to database specific module data.
idaman bool ida_export set_processor_type(const char *procname, setproc_level_t level)
Set target processor type.
CASSERT(sizeof(asm_t)==416)
DECLARE_TYPE_AS_MOVABLE(reg_info_t)
idaman ssize_t ida_export get_reg_name(qstring *buf, int reg, size_t width, int reghi=-1)
Get text representation of a register.
local_type_change_t
Definition idp.hpp:2855
@ LTC_EDITED
edited a local type
Definition idp.hpp:2859
@ LTC_TIL_LOADED
loaded a til file
Definition idp.hpp:2862
@ LTC_ALIASED
added a type alias
Definition idp.hpp:2860
@ LTC_ADDED
added a local type
Definition idp.hpp:2857
@ LTC_COMPILER
changed the compiler and calling convention
Definition idp.hpp:2861
@ LTC_TIL_UNLOADED
unloaded a til file
Definition idp.hpp:2863
@ LTC_TIL_COMPACTED
numbered types have been compacted compact_numbered_types()
Definition idp.hpp:2864
@ LTC_NONE
no event (internal use)
Definition idp.hpp:2856
@ LTC_DELETED
deleted a local type
Definition idp.hpp:2858
idaman hexdsp_t *ida_export get_hexdsp()
idaman char *ida_export get_idp_name(char *buf, size_t bufsize)
Get name of the current processor module.
enum access_type_t ENUM_SIZE(uchar)
Possible memory and register access types.
Definition idp.hpp:2730
idaman void *ida_export set_module_data(int *data_id, void *data_ptr)
Starting from IDA v7.5 all modules should use the following 3 functions to handle idb specific static...
idaman bool ida_export is_basic_block_end(const insn_t &insn, bool call_insn_stops_block)
Is the instruction the end of a basic block?
THREAD_SAFE bool has_cf_chg(uint32 feature, uint opnum)
Does an instruction with the specified feature modify the i-th operand?
Definition idp.hpp:110
idaman bool ida_export is_indirect_jump_insn(const insn_t &insn)
Is the instruction an indirect jump?
idaman int ida_export str2reg(const char *p)
Get any register number (-1 on error)
idaman bool ida_export has_insn_feature(uint16 icode, uint32 bit)
Does the specified instruction have the specified feature?
idaman void ida_export remove_event_listener(event_listener_t *cb)
remove all hooks in all databases for specified event_listener object
idaman void *ida_export get_module_data(int data_id)
Get pointer to the database specific module data.
idaman ea_helper_t *ida_export get_eah()
idaman bool ida_export is_call_insn(const insn_t &insn)
Is the instruction a "call"?
idaman bool ida_export is_ret_insn(const insn_t &insn, uchar flags=IRI_STRICT)
THREAD_SAFE bool has_cf_use(uint32 feature, uint opnum)
Does an instruction with the specified feature use a value of the i-th operand?
Definition idp.hpp:124
idaman processor_t *ida_export get_ph()
idaman bool ida_export parse_reg_name(reg_info_t *ri, const char *regname)
Get register info by name.
IEEE floating point functions.
fpvalue_error_t
Definition ieee.h:48
int nbytes
Definition kernwin.hpp:2861
bool ok
Definition kernwin.hpp:7006
uval_t uval_t
Definition kernwin.hpp:1878
idaman int ida_export_data errorexit
Exiting because of a a fatal error?
Definition kernwin.hpp:7065
asize_t size
Definition kernwin.hpp:6339
unsigned __int64 uint64
Definition llong.hpp:13
Definitions of various information kept in netnodes.
idaman nodeidx_t ida_export ea2node(ea_t ea)
Get netnode for the specified address.
idaman ea_t ida_export node2ea(nodeidx_t ndx)
IDB event group.
Definition idp.hpp:2873
event_code_t
IDB event codes.
Definition idp.hpp:2878
@ deleting_func
The kernel is about to delete a function.
Definition idp.hpp:3029
@ dirtree_rmdir
Dirtree: a directory has been deleted.
Definition idp.hpp:3158
@ tail_owner_changed
A tail chunk owner has been changed.
Definition idp.hpp:3051
@ bookmark_changed
Boomarked position changed.
Definition idp.hpp:3136
@ dirtree_mkdir
Dirtree: a directory has been created.
Definition idp.hpp:3154
@ frame_udm_created
Frame member has been added.
Definition idp.hpp:3221
@ local_type_renamed
Local type has been renamed.
Definition idp.hpp:3271
@ callee_addr_changed
Callee address has been updated by the user.
Definition idp.hpp:3132
@ lt_edm_deleted
local type enum member has been deleted
Definition idp.hpp:3255
@ local_types_changed
Local types have been changed.
Definition idp.hpp:3185
@ extlang_changed
The list of extlangs or the default extlang was changed.
Definition idp.hpp:2899
@ changing_segm_name
Segment name is being changed.
Definition idp.hpp:2985
@ closebase
The database will be closed now.
Definition idp.hpp:2879
@ changing_op_type
An operand type (offset, hex, etc...) is to be changed.
Definition idp.hpp:2950
@ lt_udt_expanded
A structure type has been expanded/shrank.
Definition idp.hpp:3212
@ idasgn_loaded
FLIRT signature has been loaded for normal processing (not for recognition of startup sequences).
Definition idp.hpp:2907
@ changing_ti
An item typestring (c/c++ prototype) is to be changed.
Definition idp.hpp:2929
@ func_deleted
A function has been deleted.
Definition idp.hpp:3151
@ byte_patched
A byte has been patched.
Definition idp.hpp:3099
@ segm_name_changed
Segment name has been changed.
Definition idp.hpp:2988
@ lt_udm_created
local type udt member has been added
Definition idp.hpp:3190
@ lt_udm_renamed
local type udt member has been renamed
Definition idp.hpp:3200
@ frame_udm_deleted
Frame member has been deleted.
Definition idp.hpp:3225
@ deleting_segm
A segment is to be deleted.
Definition idp.hpp:2962
@ item_color_changed
An item color has been changed.
Definition idp.hpp:3127
@ changing_segm_start
Segment start address is to be changed.
Definition idp.hpp:2969
@ lt_edm_renamed
local type enum member has been renamed
Definition idp.hpp:3260
@ tryblks_updated
Updated tryblk information.
Definition idp.hpp:3064
@ sgr_deleted
The kernel has deleted a segment register value.
Definition idp.hpp:3143
@ changing_op_ti
An operand typestring (c/c++ prototype) is to be changed.
Definition idp.hpp:2939
@ lt_udm_deleted
local type udt member has been deleted
Definition idp.hpp:3195
@ range_cmt_changed
Range comment has been changed.
Definition idp.hpp:3116
@ segm_end_changed
Segment end address has been changed.
Definition idp.hpp:2981
@ upgraded
The database has been upgraded and the receiver can upgrade its info as well.
Definition idp.hpp:2883
@ frame_udm_changed
Frame member has been changed.
Definition idp.hpp:3235
@ dirtree_move
Dirtree: a directory or item has been moved.
Definition idp.hpp:3167
@ func_noret_changed
FUNC_NORET bit has been changed.
Definition idp.hpp:3056
@ lt_udm_changed
local type udt member has been changed
Definition idp.hpp:3205
@ changing_cmt
An item comment is to be changed.
Definition idp.hpp:3103
@ determined_main
The main() function has been determined.
Definition idp.hpp:2896
@ make_code
An instruction is being created.
Definition idp.hpp:3078
@ func_added
The kernel has added a function.
Definition idp.hpp:3015
@ segm_deleted
A segment has been deleted.
Definition idp.hpp:2964
@ frame_deleted
The kernel has deleted a function frame.
Definition idp.hpp:3032
@ dirtree_rank
Dirtree: a directory or item rank has been changed.
Definition idp.hpp:3172
@ deleting_func_tail
A function tail chunk is to be removed.
Definition idp.hpp:3043
@ func_tail_appended
A function tail chunk has been appended.
Definition idp.hpp:3039
@ make_data
A data item is being created.
Definition idp.hpp:3081
@ changing_segm_class
Segment class is being changed.
Definition idp.hpp:2992
@ segm_attrs_updated
Segment attributes has been changed.
Definition idp.hpp:2998
@ set_func_end
Function chunk end address will be changed.
Definition idp.hpp:3025
@ segm_start_changed
Segment start address has been changed.
Definition idp.hpp:2973
@ op_type_changed
An operand type (offset, hex, etc...) has been set or deleted.
Definition idp.hpp:2954
@ auto_empty_finally
Info: all analysis queues are empty definitively.
Definition idp.hpp:2893
@ allsegs_moved
Program rebasing is complete.
Definition idp.hpp:3010
@ segm_moved
Segment has been moved.
Definition idp.hpp:3003
@ stkpnts_changed
Stack change points have been modified.
Definition idp.hpp:3059
@ dirtree_link
Dirtree: an item has been linked/unlinked.
Definition idp.hpp:3162
@ savebase
The database is being saved.
Definition idp.hpp:2881
@ set_func_start
Function chunk start address will be changed.
Definition idp.hpp:3021
@ frame_udm_renamed
Frame member has been renamed.
Definition idp.hpp:3230
@ func_tail_deleted
A function tail chunk has been removed.
Definition idp.hpp:3047
@ func_updated
The kernel has updated a function.
Definition idp.hpp:3018
@ compiler_changed
The kernel has changed the compiler information.
Definition idp.hpp:2925
@ adding_segm
A segment is being created.
Definition idp.hpp:3148
@ sgr_changed
The kernel has changed a segment register value.
Definition idp.hpp:3070
@ kernel_config_loaded
This event is issued when ida.cfg is parsed.
Definition idp.hpp:2912
@ changing_segm_end
Segment end address is to be changed.
Definition idp.hpp:2977
@ dirtree_segm_moved
Dirtree: inodes were changed due to a segment movement or a program rebasing.
Definition idp.hpp:3181
@ updating_tryblks
About to update tryblk information.
Definition idp.hpp:3062
@ dirtree_rminode
Dirtree: an inode became unavailable.
Definition idp.hpp:3177
@ frame_expanded
A frame type has been expanded/shrank.
Definition idp.hpp:3241
@ changing_range_cmt
Range comment is to be changed.
Definition idp.hpp:3111
@ renamed
The kernel has renamed a byte.
Definition idp.hpp:3092
@ op_ti_changed
An operand typestring (c/c++ prototype) has been changed.
Definition idp.hpp:2944
@ segm_added
A new segment has been created.
Definition idp.hpp:2958
@ extra_cmt_changed
An extra comment has been changed.
Definition idp.hpp:3122
@ cmt_changed
An item comment has been changed.
Definition idp.hpp:3107
@ auto_empty
Info: all analysis queues are empty.
Definition idp.hpp:2887
@ frame_created
A function frame has been created.
Definition idp.hpp:3217
@ idasgn_matched_ea
A FLIRT match has been found.
Definition idp.hpp:3246
@ lt_edm_changed
local type enum member has been changed
Definition idp.hpp:3265
@ ti_changed
An item typestring (c/c++ prototype) has been changed.
Definition idp.hpp:2934
@ destroyed_items
Instructions/data have been destroyed in [ea1,ea2).
Definition idp.hpp:3087
@ flow_chart_created
Gui has retrieved a function flow chart.
Definition idp.hpp:2921
@ loader_finished
External file loader finished its work.
Definition idp.hpp:2915
@ thunk_func_created
A thunk bit has been set for a function.
Definition idp.hpp:3036
@ segm_class_changed
Segment class has been changed.
Definition idp.hpp:2994
@ lt_edm_created
local type enum member has been added
Definition idp.hpp:3251
@ deleting_tryblks
About to delete tryblk information in given range.
Definition idp.hpp:3067
nodeidx64_t nodeidx_t
Definition netnode.hpp:114
unsigned short uint16
unsigned 16 bit value
Definition pro.h:346
unsigned int uint32
unsigned 32 bit value
Definition pro.h:348
qvector< int > intvec_t
vector of integers
Definition pro.h:2765
signed char sint8
signed 8 bit value
Definition pro.h:343
uint64 asize_t
Definition pro.h:423
uint32 bgcolor_t
background color in RGB
Definition pro.h:5012
uint8 op_dtype_t
Definition pro.h:460
adiff_t sval_t
signed value used by the processor.
Definition pro.h:446
int64 adiff_t
Definition pro.h:424
uint64 ea_t
Definition pro.h:421
int int32
signed 32 bit value
Definition pro.h:347
unsigned char uchar
unsigned 8 bit value
Definition pro.h:337
idaman size_t bufsize
Definition pro.h:600
uint64 sel_t
Definition pro.h:422
unsigned int uint
unsigned 32 bit value
Definition pro.h:339
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
ea_t tid_t
type id (for enums, structs, etc)
Definition pro.h:5010
char int8
signed 8 bit value
Definition pro.h:342
_qstring< char > qstring
regular string
Definition pro.h:3694
qvector< qstring > qstrvec_t
vector of strings
Definition pro.h:3697
Functions that deal with segments.
Describes the target assembler.
Definition idp.hpp:176
const char * a_comdef
"comm" (communal variable)
Definition idp.hpp:290
const char * a_oword
nullptr if not allowed
Definition idp.hpp:257
const char * a_align
"align" keyword
Definition idp.hpp:299
const char * cmnt
comment string (see also cmnt2)
Definition idp.hpp:245
const char * low8
low8 operation, should contain s for the operand
Definition idp.hpp:339
flags64_t ea_t ea_or_id
Definition idp.hpp:297
const char * a_sizeof_fmt
size of type (format string)
Definition idp.hpp:311
const char * a_yword
32-byte (256-bit) data; nullptr if not allowed requires AS2_YWORD
Definition idp.hpp:350
help_t help
Help screen number, 0 - no help.
Definition idp.hpp:240
const char * high8
high8
Definition idp.hpp:340
const char * a_equ
'equ' Used if AS_UNEQU is set
Definition idp.hpp:274
const char * end
end directive
Definition idp.hpp:244
void(idaapi *out_func_header)(outctx_t &ctx
Generate function header lines.
const char * a_bss
uninitialized data directive should include 's' for the size of data
Definition idp.hpp:271
const char * a_curip
current IP (instruction pointer) symbol in assembler
Definition idp.hpp:277
const char * esccodes
special chars that cannot appear as is in string and char literals
Definition idp.hpp:248
const char * a_double
double; 8bytes; nullptr if not allowed
Definition idp.hpp:259
const char * a_rva
'rva' keyword for image based offsets (see REFINFO_RVAOFF)
Definition idp.hpp:348
uint16 uflag
user defined flags (local only for IDP) you may define and use your own bits
Definition idp.hpp:237
const char * a_vstruc_fmt
if a named item is a structure and displayed in the verbose (multiline) form then display the name as...
Definition idp.hpp:344
func_t * void(idaapi *out_func_footer)(outctx_t &ctx
Generate function footer lines.
const char * a_dword
nullptr if not allowed
Definition idp.hpp:255
const char * cmnt2
comment close string (usually nullptr) this is used to denote a string which closes comments,...
Definition idp.hpp:334
const char * a_xor
^ bit xor assembler time operation
Definition idp.hpp:307
ssize_t(idaapi *get_type_name)(qstring *buf
Get name of type of item at ea or id.
const char * a_byte
byte directive
Definition idp.hpp:253
const char * a_word
word directive
Definition idp.hpp:254
uint32 flag2
Secondary assembler feature bits
Definition idp.hpp:313
const char * a_shl
<< shift left assembler time operation
Definition idp.hpp:309
const char * origin
org directive
Definition idp.hpp:243
func_t func_t *const char * a_public
"public" name keyword. nullptr-use default, ""-do not generate
Definition idp.hpp:287
const char * a_qword
nullptr if not allowed
Definition idp.hpp:256
const char * a_shr
Definition idp.hpp:310
const char * high16
high16
Definition idp.hpp:342
const char * a_mod
% mod assembler time operation
Definition idp.hpp:304
const char * a_float
float; 4bytes; nullptr if not allowed
Definition idp.hpp:258
const char * a_tbyte
long double; nullptr if not allowed
Definition idp.hpp:260
uint32 flag
Assembler feature bits
Definition idp.hpp:177
const char * a_weak
"weak" name keyword. nullptr-use default, ""-do not generate
Definition idp.hpp:288
const char * a_include_fmt
the include directive (format string)
Definition idp.hpp:343
const char * a_seg
'seg ' prefix (example: push seg seg001)
Definition idp.hpp:275
const char *const * header
array of automatically generated header lines they appear at the start of disassembled text
Definition idp.hpp:241
const char * a_packreal
packed decimal real nullptr if not allowed
Definition idp.hpp:261
char lbrace
left brace used in complex expressions
Definition idp.hpp:301
const char * a_band
& bit and assembler time operation
Definition idp.hpp:305
char ascsep
string literal delimiter
Definition idp.hpp:246
const char * name
Assembler name (displayed in menus)
Definition idp.hpp:239
const char * a_extrn
"extern" name keyword
Definition idp.hpp:289
const char * a_zword
64-byte (512-bit) data; nullptr if not allowed requires AS2_ZWORD
Definition idp.hpp:352
const char * low16
low16
Definition idp.hpp:341
const char * a_dups
array keyword.
Definition idp.hpp:262
char rbrace
right brace used in complex expressions
Definition idp.hpp:302
const char * a_ascii
string literal directive
Definition idp.hpp:252
const char * a_bnot
~ bit not assembler time operation
Definition idp.hpp:308
char accsep
char constant delimiter
Definition idp.hpp:247
const char * a_bor
| bit or assembler time operation
Definition idp.hpp:306
Structure used to describe byte streams (for "ret" instruction and empirics)
Definition idp.hpp:62
uchar len
Definition idp.hpp:63
const uchar * bytes
Definition idp.hpp:64
defined as struct so it can be forward-declared
Definition idd.hpp:751
helper class to support 32bit addresses in ida64
Definition ida.hpp:1145
Definition idp.hpp:420
virtual ~event_listener_t()
Definition idp.hpp:425
size_t listener_flags
Definition idp.hpp:421
virtual ssize_t idaapi on_event(ssize_t code, va_list va)=0
Callback to handle events.
External language (to support third party language interpreters)
Definition expr.hpp:655
Definition fixup.hpp:83
Processor-independent representation of a floating point value.
Definition ieee.h:98
Function type information (see tinfo_t::get_func_details())
Definition typeinf.hpp:4753
Information about a single function argument.
Definition typeinf.hpp:4683
Instruction operand information.
Definition idd.hpp:725
Definition idp.hpp:2040
bool is_switch_insn(ea_t ea) const
Definition idp.hpp:2063
netnode ignore_micro
Definition idp.hpp:2045
void mark_epilog_insn(ea_t ea)
Definition idp.hpp:2059
void set_ignore_micro(ea_t ea, uchar im_type)
Definition idp.hpp:2055
bool should_ignore_micro(ea_t ea) const
Definition idp.hpp:2064
void term_ignore_micro(void)
Definition idp.hpp:2053
ea_t next_marked_insn(ea_t ea)
Definition idp.hpp:2057
void clr_ignore_micro(ea_t ea)
Definition idp.hpp:2056
char get_ignore_micro(ea_t ea) const
Definition idp.hpp:2054
void mark_prolog_insn(ea_t ea)
Definition idp.hpp:2058
bool is_prolog_insn(ea_t ea) const
Definition idp.hpp:2061
bool is_epilog_insn(ea_t ea) const
Definition idp.hpp:2062
void init_ignore_micro(void)
Definition idp.hpp:2052
void mark_switch_insn(ea_t ea)
Definition idp.hpp:2060
Internal representation of processor instructions.
Definition idp.hpp:102
uint32 feature
combination of Instruction feature bits
Definition idp.hpp:104
const char * name
instruction name
Definition idp.hpp:103
ea_helper_t & _eah
Definition idp.hpp:2073
processor_t & ph
Definition idp.hpp:2071
size_t reserved[8]
Definition idp.hpp:2074
modctx_t()
Definition idp.hpp:2075
asm_t & ash
Definition idp.hpp:2072
Definition ua.hpp:1130
Definition idp.hpp:2143
size_t owner
Definition idp.hpp:2144
virtual ~plugmod_t()
Virtual destructor.
Definition idp.hpp:2159
virtual bool idaapi run(size_t arg)=0
Invoke the plugin.
bool hook_event_listener(hook_type_t hook_type, event_listener_t *cb, int hkcb_flags=0)
Helper function to hook event listeners.
Definition idp.hpp:2150
Describes a processor module (IDP).
Definition idp.hpp:613
static ssize_t arch_changed()
Definition idp.hpp:2635
static ssize_t loader_elf_machine(linput_t *li, int machine_type, const char **p_procname, proc_def_t **p_pd, elf_loader_t *ldr, reader_t *reader)
Definition idp.hpp:2395
static const char * get_reg_info(const char *regname, bitrange_t *bitrange)
Get register information - useful for registers like al, ah, dil, etc.
Definition idp.hpp:2686
bool use64(void) const
PR_USE64
Definition idp.hpp:623
static ssize_t can_have_type(const op_t &op)
Definition idp.hpp:2356
static ssize_t use_stkarg_type(ea_t ea, const funcarg_t &arg)
Definition idp.hpp:2595
const char *const * reg_names
array of register names
Definition idp.hpp:1919
static ssize_t calc_spdelta(sval_t *spdelta, const insn_t &ins)
Definition idp.hpp:2423
static ssize_t assemble(uchar *_bin, ea_t ea, ea_t cs, ea_t ip, bool _use32, const char *line)
Definition idp.hpp:2210
int get_proc_index()
Definition idp.hpp:3292
bool is_lumina_usable() const
const asm_t *const * assemblers
pointer to array of target
Definition idp.hpp:671
uint32 get_canon_feature(uint16 itype) const
Get the instruction features (combination of Instruction feature bits)
Definition idp.hpp:1978
static ssize_t use_regarg_type(int *idx, ea_t ea, void *rargs)
Definition idp.hpp:2599
static ssize_t ana_insn(insn_t *out)
Definition idp.hpp:2214
static ssize_t get_operand_string(qstring *buf, const insn_t &insn, int opnum)
Definition idp.hpp:2471
static ssize_t undefine(ea_t ea)
Definition idp.hpp:2322
static ssize_t validate_flirt_func(ea_t start_ea, const char *funcname)
Definition idp.hpp:2467
static ssize_t _calc_varglocs(func_type_data_t *ftd, regobjs_t *regs, relobj_t *stkargs, int nfixed)
Definition idp.hpp:2586
static ssize_t clean_tbit(ea_t ea, regval_getter_t *_getreg, const regval_t &regvalues)
Definition idp.hpp:2561
size_t sizeof_ldbl() const
Get size of long double.
Definition idp.hpp:2787
static ssize_t out_insn(outctx_t &ctx)
Definition idp.hpp:2242
static ssize_t out_header(outctx_t &ctx)
Definition idp.hpp:2222
static ssize_t out_operand(outctx_t &ctx, const op_t &op)
Definition idp.hpp:2250
static ssize_t find_reg_value(uval_t *out, const insn_t &insn, int reg)
Definition idp.hpp:2431
static ssize_t set_code16_mode(ea_t ea, bool code16=true)
Definition idp.hpp:2521
event_t
Callback notification codes.
Definition idp.hpp:696
@ ev_get_stkarg_area_info
Get some metrics of the stack argument area.
Definition idp.hpp:1748
@ ev_coagulate_dref
Data reference is being analyzed.
Definition idp.hpp:1191
@ ev_next_exec_insn
Get next address to be executed This function must return the next address to be executed.
Definition idp.hpp:1465
@ ev_get_regfinder
Get pointer to the regfinder object.
Definition idp.hpp:1431
@ ev_calc_purged_bytes
Calculate number of purged bytes by the given function type.
Definition idp.hpp:1622
@ ev_get_procmod
Get pointer to the processor module object.
Definition idp.hpp:1363
@ ev_find_reg_value
Find register value via a register tracker.
Definition idp.hpp:1326
@ ev_endbinary
IDA has loaded a binary file.
Definition idp.hpp:726
@ ev_coagulate
Try to define some unexplored bytes.
Definition idp.hpp:866
@ ev_gen_src_file_lnnum
Callback: generate analog of:
Definition idp.hpp:843
@ ev_auto_queue_empty
One analysis queue is empty.
Definition idp.hpp:1226
@ ev_calc_retloc
Calculate return value location.
Definition idp.hpp:1628
@ ev_get_bg_color
Get item background color.
Definition idp.hpp:1093
@ ev_get_autocmt
Callback: get dynamic auto comment.
Definition idp.hpp:1083
@ ev_ana_insn
Analyze one instruction and fill 'out' structure.
Definition idp.hpp:751
@ ev_is_indirect_jump
Determine if instruction is an indirect jump.
Definition idp.hpp:960
@ ev_out_special_item
Generate text representation of an item in a special segment i.e.
Definition idp.hpp:829
@ ev_calc_next_eas
Calculate list of addresses the instruction in 'insn' may pass control to.
Definition idp.hpp:1487
@ ev_cvt64_hashval
perform 32-64 conversion for a hash value
Definition idp.hpp:1420
@ ev_gen_stkvar_def
Generate stack variable definition line Default line is varname = type ptr value, where 'type' is one...
Definition idp.hpp:1439
@ ev_newprc
Before changing processor type.
Definition idp.hpp:703
@ ev_adjust_libfunc_ea
Called when a signature module has been matched against bytes in the database.
Definition idp.hpp:1239
@ ev_may_show_sreg
The kernel wants to display the segment registers in the messages window.
Definition idp.hpp:1200
@ ev_is_jump_func
Is the function a trivial "jump" function?
Definition idp.hpp:1100
@ ev_newbinary
IDA is about to load a binary file.
Definition idp.hpp:719
@ ev_ending_undo
Ended undoing/redoing an action.
Definition idp.hpp:1349
@ ev_use_regarg_type
Use information about register argument.
Definition idp.hpp:1705
@ ev_out_mnem
Generate instruction mnemonics.
Definition idp.hpp:799
@ ev_loader_elf_machine
ELF loader machine type checkpoint.
Definition idp.hpp:1207
@ ev_cmp_operands
Compare instruction operands.
Definition idp.hpp:1039
@ ev_rename
The kernel is going to rename a byte.
Definition idp.hpp:889
@ ev_may_be_func
Can a function start here?
Definition idp.hpp:940
@ ev_get_macro_insn_head
Calculate the start of a macro instruction.
Definition idp.hpp:1497
@ ev_last_cb_before_loader
Definition idp.hpp:1754
@ ev_undefine
An item in the database (insn or data) is being deleted.
Definition idp.hpp:876
@ ev_calcrel
Reserved.
Definition idp.hpp:1325
@ ev_gen_regvar_def
Generate register variable definition line.
Definition idp.hpp:837
@ ev_get_default_enum_size
Get default enum size.
Definition idp.hpp:1600
@ ev_calc_varglocs
Calculate locations of the arguments that correspond to '...'.
Definition idp.hpp:1644
@ ev_set_proc_options
Called if the user specified an option string in the command line: -p<processor name>:<options>.
Definition idp.hpp:740
@ ev_privrange_changed
Privrange interval has been moved to a new location.
Definition idp.hpp:1398
@ ev_get_idd_opinfo
Get operand information.
Definition idp.hpp:1526
@ ev_is_align_insn
Is the instruction created only for alignment purposes?
Definition idp.hpp:994
@ ev_get_cc_regs
Get register allocation convention for given calling convention.
Definition idp.hpp:1603
@ ev_create_func_frame
Create a function frame for a newly created function Set up frame size, its attributes etc.
Definition idp.hpp:1126
@ ev_out_label
The kernel is going to generate an instruction label line or a function header.
Definition idp.hpp:822
@ ev_creating_segm
A new segment is about to be created.
Definition idp.hpp:854
@ ev_func_bounds
find_func_bounds() finished its work.
Definition idp.hpp:1108
@ ev_use_stkarg_type
Use information about a stack argument.
Definition idp.hpp:1697
@ ev_loader
This code and higher ones are reserved for the loaders.
Definition idp.hpp:1758
@ ev_last_cb_before_debugger
START OF DEBUGGER CALLBACKS.
Definition idp.hpp:1463
@ ev_is_control_flow_guard
Detect if an instruction is a "thunk call" to a flow guard function (equivalent to call reg/return/no...
Definition idp.hpp:1379
@ ev_del_cref
A code reference is being deleted.
Definition idp.hpp:1178
@ ev_getreg
IBM PC only internal request, should never be used for other purpose Get register value by internal i...
Definition idp.hpp:1303
@ ev_realcvt
Floating point -> IEEE conversion.
Definition idp.hpp:1269
@ ev_assemble
Assemble an instruction.
Definition idp.hpp:1250
@ ev_create_flat_group
Create special segment representing the flat group.
Definition idp.hpp:1297
@ ev_create_merge_handlers
Create merge handlers, if needed.
Definition idp.hpp:1392
@ ev_add_cref
A code reference is being created.
Definition idp.hpp:1164
@ ev_arg_addrs_ready
Argument address info is ready.
Definition idp.hpp:1725
@ ev_add_dref
A data reference is being created.
Definition idp.hpp:1171
@ ev_set_code16_mode
Some processors have ISA 16-bit mode e.g.
Definition idp.hpp:1353
@ ev_verify_sp
All function instructions have been analyzed.
Definition idp.hpp:1115
@ ev_clean_tbit
Clear the TF bit after an insn like pushf stored it in memory.
Definition idp.hpp:1519
@ ev_get_frame_retsize
Get size of function return address in bytes If this event is not implemented, the kernel will assume...
Definition idp.hpp:1132
@ ev_insn_reads_tbit
Check if insn will read the TF bit.
Definition idp.hpp:1511
@ ev_set_idp_options
Set IDP-specific configuration option Also see set_options_t in config.hpp.
Definition idp.hpp:729
@ ev_cvt64_supval
perform 32-64 conversion for a netnode array element
Definition idp.hpp:1409
@ ev_get_reg_accesses
Get info about the registers that are used/changed by an instruction.
Definition idp.hpp:1371
@ ev_emu_insn
Emulate instruction, create cross-references, plan to analyze subsequent instructions,...
Definition idp.hpp:759
@ ev_out_operand
Generate text representation of an instruction operand outctx_t provides functions to output the gene...
Definition idp.hpp:806
@ ev_decorate_name
Decorate/undecorate a C symbol name.
Definition idp.hpp:1732
@ ev_replaying_undo
Replaying an undo/redo buffer.
Definition idp.hpp:1344
@ ev_gen_asm_or_lst
Callback: generating asm or lst file.
Definition idp.hpp:1276
@ ev_init
The IDP module is just loaded.
Definition idp.hpp:697
@ ev_calc_arglocs
Calculate function argument locations.
Definition idp.hpp:1636
@ ev_get_reg_name
Generate text representation of a register.
Definition idp.hpp:1063
@ ev_out_insn
Generate text representation of an instruction in 'ctx.insn' outctx_t provides functions to output th...
Definition idp.hpp:792
@ ev_out_segend
Function to produce end of segment.
Definition idp.hpp:780
@ ev_term
The IDP module is being unloaded.
Definition idp.hpp:701
@ ev_out_data
Generate text representation of data items This function may change the database and create cross-ref...
Definition idp.hpp:814
@ ev_is_basic_block_end
Is the current instruction end of a basic block?
Definition idp.hpp:951
@ ev_use_arg_types
Use information about callee arguments.
Definition idp.hpp:1718
@ ev_calc_switch_cases
Calculate case values and targets for a custom jump table.
Definition idp.hpp:980
@ ev_can_have_type
Can the operand have a type as offset, segment, decimal, etc?
Definition idp.hpp:1031
@ ev_is_switch
Find 'switch' idiom or override processor module's decision.
Definition idp.hpp:970
@ ev_last_cb_before_type_callbacks
Definition idp.hpp:1577
@ ev_is_addr_insn
Does the instruction calculate some address using an immediate operand?
Definition idp.hpp:1450
@ ev_is_far_jump
is indirect far jump or call instruction?
Definition idp.hpp:900
@ ev_moving_segm
May the kernel move the segment?
Definition idp.hpp:859
@ ev_calc_step_over
Calculate the address of the instruction which will be executed after "step over".
Definition idp.hpp:1478
@ ev_is_call_insn
Is the instruction a "call"?
Definition idp.hpp:927
@ ev_max_ptr_size
Get maximal size of a pointer in bytes.
Definition idp.hpp:1596
@ ev_get_abi_info
Get all possible ABI names and optional extensions for given compiler abiname/option is a string enti...
Definition idp.hpp:1588
@ ev_validate_flirt_func
Flirt has recognized a library function.
Definition idp.hpp:1231
@ ev_equal_reglocs
Are 2 register arglocs the same?
Definition idp.hpp:1689
@ ev_str2reg
Convert a register name to a register number.
Definition idp.hpp:1074
@ ev_create_switch_xrefs
Create xrefs for a custom jump table.
Definition idp.hpp:988
@ ev_asm_installed
After setting a new assembler.
Definition idp.hpp:1367
@ ev_setup_til
Setup default type libraries.
Definition idp.hpp:1579
@ ev_extract_address
Extract address from a string.
Definition idp.hpp:1260
@ ev_is_ret_insn
Is the instruction a "return"?
Definition idp.hpp:933
@ ev_adjust_refinfo
Called from apply_fixup before converting operand to reference.
Definition idp.hpp:1046
@ ev_out_assumes
Function to produce assume directives when segment register value changes.
Definition idp.hpp:786
@ ev_find_op_value
Find operand value via a register tracker.
Definition idp.hpp:1335
@ ev_out_header
Function to produce start of disassembled text.
Definition idp.hpp:766
@ ev_update_call_stack
Calculate the call stack trace for the given thread.
Definition idp.hpp:1553
@ ev_get_reg_info
Get register information by its name.
Definition idp.hpp:1538
@ ev_gen_map_file
Generate map file.
Definition idp.hpp:1289
@ ev_is_sane_insn
Is the instruction sane for the current file type?
Definition idp.hpp:907
@ ev_broadcast
Broadcast call.
Definition idp.hpp:1388
@ ev_demangle_name
Demangle a C++ (or another language) name into a user-readable string.
Definition idp.hpp:1151
@ ev_is_alloca_probe
Does the function at 'ea' behave as __alloca_probe?
Definition idp.hpp:999
@ ev_calc_spdelta
Calculate amount of change to sp for the given insn.
Definition idp.hpp:1318
@ ev_arch_changed
The loader is done parsing arch-related information, which the processor module might want to use to ...
Definition idp.hpp:1741
@ ev_analyze_prolog
Analyzes function prolog, epilog, and updates purge, and function attributes.
Definition idp.hpp:1312
@ ev_get_code16_mode
Get ISA 16-bit mode.
Definition idp.hpp:1358
@ ev_is_cond_insn
Is conditional instruction?
Definition idp.hpp:921
@ ev_is_insn_table_jump
Reserved.
Definition idp.hpp:968
@ ev_verify_noreturn
The kernel wants to set 'noreturn' flags for a function.
Definition idp.hpp:1122
@ ev_get_dbr_opnum
Get the number of the operand to be displayed in the debugger reference view (text mode).
Definition idp.hpp:1504
@ ev_get_stkvar_scale_factor
Should stack variable references be multiplied by a coefficient before being used in the stack frame?
Definition idp.hpp:1143
@ ev_calc_cdecl_purged_bytes
Calculate number of purged bytes after call.
Definition idp.hpp:1617
@ ev_adjust_argloc
Adjust argloc according to its type/size and platform endianess.
Definition idp.hpp:1660
@ ev_get_operand_string
Request text string for operand (cli, java, ...).
Definition idp.hpp:1056
@ ev_out_footer
Function to produce end of disassembled text.
Definition idp.hpp:770
@ ev_oldfile
An old file has been loaded.
Definition idp.hpp:716
@ ev_treat_hindering_item
An item hinders creation of another item.
Definition idp.hpp:881
@ ev_out_segstart
Function to produce start of segment.
Definition idp.hpp:774
@ ev_is_sp_based
Check whether the operand is relative to stack pointer or frame pointer This event is used to determi...
Definition idp.hpp:1020
@ ev_newasm
Before setting a new assembler.
Definition idp.hpp:709
@ ev_newfile
A new file has been loaded.
Definition idp.hpp:713
@ ev_lower_func_type
Get function arguments which should be converted to pointers when lowering function prototype.
Definition idp.hpp:1672
@ ev_delay_slot_insn
Get delay slot instruction.
Definition idp.hpp:1004
@ ev_get_simd_types
Get SIMD-related types according to given attributes ant/or argument location.
Definition idp.hpp:1608
@ ev_del_dref
A data reference is being deleted.
Definition idp.hpp:1185
int cbsize(void)
for code segments
Definition idp.hpp:655
static ssize_t find_op_value(uval_t *out, const insn_t &insn, int op)
Definition idp.hpp:2435
int32 instruc_start
icode of the first instruction
Definition idp.hpp:1962
static ssize_t str2reg(const char *regname)
Definition idp.hpp:2447
static ssize_t newasm(int asmnum)
Definition idp.hpp:2174
int dbsize(void)
for non-code segments
Definition idp.hpp:656
void ensure_processor(void)
bool has_idp_opts(void) const
PR_IDP_OPTS
Definition idp.hpp:620
static ssize_t analyze_prolog(ea_t fct_ea)
Definition idp.hpp:2419
int32 reg_first_sreg
number of first segment register
Definition idp.hpp:1926
static ssize_t insn_reads_tbit(const insn_t &insn, regval_getter_t *_getreg, const regval_t &regvalues)
Definition idp.hpp:2545
static ssize_t is_call_insn(const insn_t &insn)
Definition idp.hpp:2340
bool is_canon_insn(uint16 itype) const
Does the given value specify a valid instruction for this instruction set?
Definition idp.hpp:1967
static ssize_t setup_til()
Definition idp.hpp:2565
static ssize_t is_sp_based(const insn_t &insn, const op_t &x)
Definition idp.hpp:2330
const regval_t &idaapi regval_getter_t(const char *name, const regval_t *regvalues)
Definition idp.hpp:677
static ssize_t create_switch_xrefs(ea_t jumpea, const switch_info_t &si)
Definition idp.hpp:2455
bool ti(void) const
PR_TYPEINFO
Definition idp.hpp:624
static ssize_t out_special_item(outctx_t &ctx, uchar segtype)
Definition idp.hpp:2262
ssize_t privrange_changed(const range_t &old_privrange, adiff_t delta, qstring *errbuf=nullptr)
Definition idp.hpp:2643
static ssize_t add_dref(ea_t from, ea_t to, dref_t type)
Definition idp.hpp:2479
static ssize_t is_cond_insn(const insn_t &insn)
Definition idp.hpp:2517
static ssize_t equal_reglocs(const argloc_t &a1, const argloc_t &a2)
Definition typeinf.hpp:6673
static ssize_t get_frame_retsize(int *retsize, const func_t *pfn)
Definition idp.hpp:2415
static ssize_t func_bounds(int *possible_return_code, func_t *pfn, ea_t max_func_end_ea)
Definition idp.hpp:2294
static ssize_t adjust_argloc(argloc_t *argloc, const tinfo_t *type, int size)
Definition idp.hpp:2623
int32 instruc_end
icode of the last instruction + 1
Definition idp.hpp:1963
static ssize_t is_switch(switch_info_t *si, const insn_t &insn)
Definition idp.hpp:2451
bool has_code16_bit(void) const
PR2_CODE16_BIT
Definition idp.hpp:628
static ssize_t calc_next_eas(eavec_t *res, const insn_t &insn, bool over)
Definition idp.hpp:2557
static ssize_t out_data(outctx_t &ctx, bool analyze_only)
Definition idp.hpp:2254
void * unused_slot
Reserved, currently equals to nullptr.
Definition idp.hpp:2004
static ssize_t create_flat_group(ea_t image_base, int bitness, sel_t dataseg_sel)
Definition idp.hpp:2371
static ssize_t max_ptr_size()
Definition idp.hpp:2569
bool use32(void) const
PR_USE64 or PR_USE32
Definition idp.hpp:622
uint32 flag
an ORed combination of Processor feature bits
Definition idp.hpp:617
static ssize_t arg_addrs_ready(ea_t caller, int n, const tinfo_t &tif, ea_t *addrs)
Definition idp.hpp:2619
static ssize_t adjust_libfunc_ea(const idasgn_t &sig, const libfunc_t &libfun, ea_t *ea)
Definition idp.hpp:2505
ssize_t cvt64_supval(nodeidx_t node, uchar tag, nodeidx_t idx, const uchar *data, size_t datlen, qstring *errbuf=nullptr)
Definition idp.hpp:2647
static ssize_t gen_asm_or_lst(bool starting, FILE *fp, bool is_asm, int flags, void *outline)
Definition idp.hpp:2383
static ssize_t oldfile(const char *fname)
Definition idp.hpp:2194
bool delay_slot_insn(ea_t *ea, bool *bexec, bool *fexec)
Helper function to get the delay slot instruction.
Definition idp.hpp:2835
static ssize_t lower_func_type(intvec_t *argnums, func_type_data_t *fti)
Definition idp.hpp:2627
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:207
const instruc_t * instruc
Array of instructions.
Definition idp.hpp:1969
static ssize_t term()
Definition idp.hpp:2166
static ssize_t is_align_insn(ea_t ea)
Definition idp.hpp:2348
static bool get_code16_mode(ea_t ea)
Definition idp.hpp:2525
static ssize_t emu_insn(const insn_t &insn)
Definition idp.hpp:2218
static ssize_t endbinary(bool ok)
Definition idp.hpp:2202
bool has_segregs(void) const
PR_SEGS
Definition idp.hpp:621
static ssize_t newprc(int pnum, bool keep_cfg)
Definition idp.hpp:2170
static ssize_t notify(event_t event_code,...)
Definition idp.hpp:1766
static ssize_t extract_address(ea_t *out_ea, ea_t screen_ea, const char *string, size_t x)
Definition idp.hpp:2443
static ssize_t cmp_operands(const op_t &op1, const op_t &op2)
Definition idp.hpp:2306
size_t tbyte_size
Size of long double (tbyte) for this processor (meaningful only if asm_t::a_tbyte !...
Definition idp.hpp:1986
ssize_t cvt64_hashval(nodeidx_t node, uchar tag, const char *name, const uchar *data, size_t datlen, qstring *errbuf=nullptr)
Definition idp.hpp:2651
bool stkup(void) const
PR_STACK_UP
Definition idp.hpp:625
bool use_tbyte(void) const
PR_USE_TBYTE
Definition idp.hpp:626
static ssize_t update_call_stack(call_stack_t *stack, int tid, regval_getter_t *_getreg, const regval_t &regvalues)
Definition idp.hpp:2553
const char *const * psnames
short processor names (nullptr terminated).
Definition idp.hpp:663
static ssize_t del_cref(ea_t from, ea_t to, bool expand)
Definition idp.hpp:2483
static ssize_t gen_stkvar_def(outctx_t &ctx, const struct udm_t *mptr, sval_t v, tid_t tid)
Definition idp.hpp:2266
int32 segreg_size
size of a segment register in bytes
Definition idp.hpp:1928
static ssize_t is_jump_func(func_t *pfn, ea_t *jump_target, ea_t *func_pointer)
Definition idp.hpp:2310
bool calcrel_in_bits(void) const
PR2_REL_BITS
Definition idp.hpp:631
static ssize_t gen_map_file(int *nlines, FILE *fp)
Definition idp.hpp:2387
static const char * set_idp_options(const char *keyword, int vtype, const void *value, bool idb_loaded=true)
Definition idp.hpp:2495
static ssize_t getreg(uval_t *rv, int regnum)
Definition idp.hpp:2318
int32 reg_code_sreg
number of CS register
Definition idp.hpp:1936
bool supports_macros(void) const
PR2_MACRO
Definition idp.hpp:629
static ssize_t out_footer(outctx_t &ctx)
Definition idp.hpp:2226
static ssize_t _calc_retloc(argloc_t *retloc, const tinfo_t &rettype, callcnv_t cc)
Definition idp.hpp:2581
static ssize_t newbinary(const char *filename, qoff64_t fileoff, ea_t basepara, ea_t binoff, uint64 nbytes)
Definition idp.hpp:2198
const bytes_t * codestart
Array of typical code start sequences.
Definition idp.hpp:1943
int get_default_segm_bitness(bool is_64bit_app) const
Get default segment bitness.
Definition idp.hpp:638
static ssize_t create_func_frame(func_t *pfn)
Definition idp.hpp:2411
int32 dnbits
Number of bits in a byte for non-code segments (usually 8).
Definition idp.hpp:647
bool use_mappings(void) const
PR2_MAPPINGS
Definition idp.hpp:627
const char * get_canon_mnem(uint16 itype) const
Get the instruction name.
Definition idp.hpp:1972
static void auto_queue_empty(int type)
Definition idp.hpp:2290
static ssize_t out_label(outctx_t &ctx, const char *colored_name)
Definition idp.hpp:2258
static ssize_t get_stkvar_scale_factor()
Definition idp.hpp:2363
static ssize_t out_segend(outctx_t &ctx, segment_t *seg)
Definition idp.hpp:2234
static ssize_t get_simd_types(void *out, const simd_info_t *simd_attrs, const argloc_t *argloc, bool create_tifs)
Definition idp.hpp:2615
int32 reg_last_sreg
number of last segment register
Definition idp.hpp:1927
static ssize_t is_control_flow_guard(int *p_reg, const insn_t *insn)
Definition idp.hpp:2186
static ssize_t out_mnem(outctx_t &ctx)
Definition idp.hpp:2246
static ssize_t gen_src_file_lnnum(outctx_t &ctx, const char *file, size_t lnnum)
Definition idp.hpp:2274
static ssize_t adjust_refinfo(refinfo_t *ri, ea_t ea, int n, const fixup_data_t &fd)
Definition idp.hpp:2513
char real_width[4]
Number of digits in floating numbers after the decimal point.
Definition idp.hpp:1998
static ssize_t add_cref(ea_t from, ea_t to, cref_t type)
Definition idp.hpp:2475
const bytes_t * retcodes
Array of 'return' instruction opcodes.
Definition idp.hpp:1949
int32 icode_return
Icode of return instruction. It is ok to give any of possible return instructions.
Definition idp.hpp:2001
static ssize_t coagulate_dref(ea_t from, ea_t to, bool may_define, ea_t *code_ea)
Definition idp.hpp:2491
static ssize_t set_proc_options(const char *options, int confidence)
Definition idp.hpp:2501
static ssize_t is_indirect_jump(const insn_t &insn)
Definition idp.hpp:2399
uint32 flag2
an ORed combination of Processor additional feature bits
Definition idp.hpp:618
static ssize_t is_ret_insn(const insn_t &insn, uchar iri_flags)
Definition idp.hpp:2344
static ssize_t get_cc_regs(callregs_t *regs, callcnv_t cc)
Definition idp.hpp:2611
static ssize_t may_show_sreg(ea_t current_ea)
Definition idp.hpp:2282
static ssize_t calc_step_over(ea_t *target, ea_t ip)
Definition idp.hpp:2533
static ssize_t is_addr_insn(int *type, const insn_t &insn)
Definition idp.hpp:2352
static fpvalue_error_t realcvt(void *m, fpvalue_t *e, uint16 swt)
Definition idp.hpp:2509
int get_stkvar_scale(void)
Get the stack variable scaling factor.
Definition idp.hpp:1906
bool supports_calcrel(void) const
PR2_USE_CALCREL
Definition idp.hpp:630
static ssize_t del_dref(ea_t from, ea_t to)
Definition idp.hpp:2487
static ssize_t asm_installed(int asmnum)
Definition idp.hpp:2178
static ssize_t creating_segm(segment_t *seg)
Definition idp.hpp:2206
static ssize_t is_basic_block_end(const insn_t &insn, bool call_insn_stops_block)
Definition idp.hpp:2314
static ssize_t calc_cdecl_purged_bytes(ea_t ea)
Definition idp.hpp:2576
static ssize_t demangle_name(int32 *res, qstring *out, const char *name, uint32 disable_mask, int demreq)
Definition idp.hpp:2367
static ssize_t get_idd_opinfo(idd_opinfo_t *opinf, ea_t ea, int n, int thread_id, regval_getter_t *_getreg, const regval_t &regvalues)
Definition idp.hpp:2549
static ssize_t out_segstart(outctx_t &ctx, segment_t *seg)
Definition idp.hpp:2230
static ssize_t newfile(const char *fname)
Definition idp.hpp:2190
static ssize_t calc_switch_cases(void *casevec, eavec_t *targets, ea_t insn_ea, const switch_info_t &si)
Definition idp.hpp:2459
int32 version
Expected kernel version, should be IDP_INTERFACE_VERSION.
Definition idp.hpp:614
static ssize_t get_bg_color(bgcolor_t *color, ea_t ea)
Definition idp.hpp:2463
static reg_finder_t * get_regfinder()
Definition idp.hpp:2655
static ssize_t get_autocmt(qstring *buf, const insn_t &insn)
Definition idp.hpp:2391
static ssize_t _calc_arglocs(func_type_data_t *fti)
Definition idp.hpp:2591
static ssize_t is_sane_insn(const insn_t &insn, int no_crefs)
Definition idp.hpp:2302
static ssize_t get_macro_insn_head(ea_t *head, ea_t ip)
Definition idp.hpp:2537
static ssize_t create_merge_handlers(merge_data_t *md)
Definition idp.hpp:2639
int32 id
one of Processor IDs
Definition idp.hpp:616
static ssize_t is_far_jump(int icode)
Definition idp.hpp:2336
const char *const * plnames
long processor names (nullptr terminated).
Definition idp.hpp:665
static ssize_t get_abi_info(qstrvec_t *abi_names, qstrvec_t *abi_opts, comp_t comp)
Definition idp.hpp:2631
bool is_funcarg_off(const func_t *pfn, uval_t frameoff) const
Does the given offset lie within the arguments section?
Definition frame.hpp:196
static ssize_t get_dbr_opnum(int *opnum, const insn_t &insn)
Definition idp.hpp:2541
static ssize_t use_arg_types(ea_t ea, func_type_data_t *fti, void *rargs)
Definition idp.hpp:2603
static ssize_t is_alloca_probe(ea_t ea)
Definition idp.hpp:2375
static ssize_t next_exec_insn(ea_t *target, ea_t ea, int tid, regval_getter_t *_getreg, const regval_t &regvalues)
Definition idp.hpp:2529
static ssize_t verify_sp(func_t *pfn)
Definition idp.hpp:2407
int32 cnbits
Number of bits in a byte for code segments (usually 8).
Definition idp.hpp:643
int32 regs_num
number of registers
Definition idp.hpp:1920
static ssize_t treat_hindering_item(ea_t hindering_item_ea, flags64_t new_item_flags, ea_t new_item_ea, asize_t new_item_length)
Definition idp.hpp:2439
static ssize_t _decorate_name(qstring *outbuf, const char *name, bool mangle, callcnv_t cc, const tinfo_t &type)
Definition typeinf.hpp:6682
static ssize_t rename(ea_t ea, const char *new_name, int flags)
Definition idp.hpp:2278
int32 reg_data_sreg
number of DS register
Definition idp.hpp:1937
static ssize_t calcrel(bytevec_t *out_relbits, size_t *out_consumed, ea_t ea)
Definition idp.hpp:2427
hook_cb_t * _notify
Event notification handler.
Definition idp.hpp:1765
static ssize_t gen_regvar_def(outctx_t &ctx, regvar_t *v)
Definition idp.hpp:2270
static ssize_t may_be_func(const insn_t &insn, int state)
Definition idp.hpp:2298
static ssize_t out_assumes(outctx_t &ctx)
Definition idp.hpp:2238
static ssize_t moving_segm(segment_t *seg, ea_t to, int flags)
Definition idp.hpp:2326
static ssize_t coagulate(ea_t start_ea)
Definition idp.hpp:2286
static ssize_t get_reg_name(qstring *buf, int reg, size_t width, int reghi)
Definition idp.hpp:2379
static ssize_t get_reg_accesses(reg_accesses_t *accvec, const insn_t &insn, int flags)
Definition idp.hpp:2182
static ssize_t calc_purged_bytes(int *p_purged_bytes, const func_type_data_t &fti)
Definition idp.hpp:2607
static ssize_t verify_noreturn(func_t *pfn)
Definition idp.hpp:2403
static ssize_t init(const char *idp_modname)
Definition idp.hpp:2162
procmod_t(const procmod_t &)=delete
const op_t * make_op_imm(op_t *op, uval_t val, int8 dtype=-1) const
Definition idp.hpp:2099
size_t procmod_flags
Definition idp.hpp:2086
procmod_t()
Definition idp.hpp:2088
const op_t * make_op_reg(op_t *op, int reg, int8 dtype=-1) const
The helper methods for reg_finder_t.
Definition idp.hpp:2092
const op_t * make_op_displ(op_t *op, int base_reg, uval_t displ, int8 dtype=-1) const
Definition idp.hpp:2106
op_dtype_t calc_op_dtype(sint8 dtype) const
Definition idp.hpp:2133
const op_t * make_op_phrase(op_t *op, int base_reg, int index_reg, int8 dtype=-1) const
This method puts the index register into the VALUE member.
Definition idp.hpp:2119
Base class for an range.
Definition range.hpp:35
Information about a reference.
Definition nalt.hpp:1010
Information about a register accessed by an instruction.
Definition idp.hpp:2740
uchar opnum
operand number
Definition idp.hpp:2744
int regnum
register number (only entire registers)
Definition idp.hpp:2741
access_type_t access_type
Definition idp.hpp:2743
bool operator==(const reg_access_t &r) const
Definition idp.hpp:2751
bool operator!=(const reg_access_t &r) const
Definition idp.hpp:2759
bitrange_t range
bitrange inside the register
Definition idp.hpp:2742
bool have_common_bits(const reg_access_t &r) const
Definition idp.hpp:2746
Definition idp.hpp:2767
Definition regfinder.hpp:821
Get register number and size from register name.
Definition idp.hpp:2705
int size
register size
Definition idp.hpp:2707
DECLARE_COMPARISONS(reg_info_t)
Definition idp.hpp:2708
int reg
register number
Definition idp.hpp:2706
Definition typeinf.hpp:6044
Structure to hold a register value.
Definition idd.hpp:563
A register variable allows the user to rename a general processor register to a meaningful name.
Definition frame.hpp:440
Relocatable object.
Definition pro.h:4026
SIMD type info.
Definition typeinf.hpp:4584
Definition typeinf.hpp:1518
Definition frame.hpp:75
Information about a switch statement.
Definition nalt.hpp:710
An object to represent struct or union members.
Definition typeinf.hpp:5300
Functions that deal with the disassembling of program instructions.