231#pragma warning(disable:4062)
232#pragma warning(disable:4265)
260typedef std::set<voff_t> voff_set_t;
274typedef std::set<ea_t> easet_t;
275typedef std::set<minsn_t *> minsn_ptr_set_t;
276typedef std::set<qstring> strings_t;
277typedef qvector<minsn_t*> minsnptrs_t;
278typedef qvector<mop_t*> mopptrs_t;
279typedef qvector<mop_t> mopvec_t;
280typedef qvector<uint64> uint64vec_t;
281typedef qvector<mreg_t> mregvec_t;
282typedef qrefcnt_t<cfunc_t> cfuncptr_t;
286#define MAX_SUPPORTED_STACK_SIZE 0x100000
291#define HEXRAYS_PLACEMENT_DELETE void operator delete(void *, void *) {}
292#define HEXRAYS_MEMORY_ALLOCATION_FUNCS() \
293 void *operator new (size_t _s) { return hexrays_alloc(_s); } \
294 void *operator new[](size_t _s) { return hexrays_alloc(_s); } \
295 void *operator new(size_t , void *_v) { return _v; } \
296 void operator delete (void *_blk) { hexrays_free(_blk); } \
297 void operator delete[](void *_blk) { hexrays_free(_blk); } \
298 HEXRAYS_PLACEMENT_DELETE
300void *
hexapi hexrays_alloc(
size_t size);
301void hexapi hexrays_free(
void *ptr);
303typedef uint64 uvlr_t;
305enum { MAX_VLR_SIZE =
sizeof(uvlr_t) };
306const uvlr_t MAX_VALUE = uvlr_t(-1);
307const svlr_t MAX_SVALUE = svlr_t(uvlr_t(-1) >> 1);
308const svlr_t MIN_SVALUE = ~MAX_SVALUE;
334#define VLR_RANGE 0x03
335#define VLR_SRANGE 0x04
339#define VLR_UNION 0x07
360 char reserved[
sizeof(qvector<int>)];
368 explicit valrng_t(
int size_ = MAX_VLR_SIZE)
369 : flags(VLR_NONE), size(size_), value(0), limit(0), stride(0) {}
373 void swap(
valrng_t &r) { qswap(*
this, r); }
375 DEFINE_MEMORY_ALLOCATION_FUNCS()
377 void set_none() { clear(); }
378 void set_all() { clear(); flags = VLR_ALL; }
379 void set_unk() { clear(); flags = VLR_UNK; }
380 void hexapi set_eq(uvlr_t v);
381 void hexapi set_cmp(cmpop_t cmp, uvlr_t _value);
390 bool hexapi reduce_size(
int new_size);
398 bool empty()
const {
return flags == VLR_NONE; }
399 bool all_values()
const {
return flags == VLR_ALL; }
400 bool is_unknown()
const {
return flags == VLR_UNK; }
401 bool hexapi has(uvlr_t v)
const;
403 void hexapi print(qstring *vout)
const;
404 const char *
hexapi dstr()
const;
406 bool hexapi cvt_to_single_value(uvlr_t *v)
const;
407 bool hexapi cvt_to_cmp(cmpop_t *cmp, uvlr_t *val,
bool strict)
const;
409 int get_size()
const {
return size; }
410 static uvlr_t max_value(
int size_)
412 return size_ == MAX_VLR_SIZE
414 : (uvlr_t(1) << (size_ * 8)) - 1;
416 static uvlr_t min_svalue(
int size_)
418 return size_ == MAX_VLR_SIZE
420 : (uvlr_t(1) << (size_ * 8 - 1));
422 static uvlr_t max_svalue(
int size_)
424 return size_ == MAX_VLR_SIZE
426 : (uvlr_t(1) << (size_ * 8 - 1)) - 1;
428 uvlr_t max_value()
const {
return max_value(size); }
429 uvlr_t min_svalue()
const {
return min_svalue(size); }
430 uvlr_t max_svalue()
const {
return max_svalue(size); }
442typedef int maymust_t;
448 MAYMUST_ACCESS_MASK = 0x01,
450 ONE_ACCESS_TYPE = 0x20,
453 INCLUDE_SPOILED_REGS = 0x40,
455 EXCLUDE_PASS_REGS = 0x80,
460 WITH_ASSERTS = 0x200,
462 EXCLUDE_VOLATILE = 0x400,
464 INCLUDE_UNUSED_SRC = 0x800,
466 INCLUDE_DEAD_RETREGS = 0x1000,
468 INCLUDE_RESTRICTED = 0x2000,
469 CALL_SPOILS_ONLY_ARGS = 0x4000;
473inline THREAD_SAFE
bool is_may_access(maymust_t maymust)
475 return (maymust & MAYMUST_ACCESS_MASK) != MUST_ACCESS;
639inline THREAD_SAFE
bool is_mcode_addsub(mcode_t mcode) {
return mcode == m_add || mcode == m_sub; }
641inline THREAD_SAFE
bool is_mcode_xdsu(mcode_t mcode) {
return mcode == m_xds || mcode == m_xdu; }
643inline THREAD_SAFE
bool is_mcode_set(mcode_t mcode) {
return mcode >= m_sets && mcode <= m_setle; }
645inline THREAD_SAFE
bool is_mcode_set1(mcode_t mcode) {
return mcode == m_sets; }
647inline THREAD_SAFE
bool is_mcode_j1(mcode_t mcode) {
return mcode == m_jcnd; }
649inline THREAD_SAFE
bool is_mcode_jcond(mcode_t mcode) {
return mcode >= m_jcnd && mcode <= m_jle; }
651inline THREAD_SAFE
bool is_mcode_convertible_to_jmp(mcode_t mcode) {
return mcode >= m_setnz && mcode <= m_setle; }
653inline THREAD_SAFE
bool is_mcode_convertible_to_set(mcode_t mcode) {
return mcode >= m_jnz && mcode <= m_jle; }
655inline THREAD_SAFE
bool is_mcode_call(mcode_t mcode) {
return mcode == m_call || mcode == m_icall; }
657inline THREAD_SAFE
bool is_mcode_fpu(mcode_t mcode) {
return mcode >= m_f2i; }
659inline THREAD_SAFE
bool is_mcode_commutative(mcode_t mcode)
661 return mcode == m_add
672inline THREAD_SAFE
bool is_mcode_shift(mcode_t mcode)
674 return mcode == m_shl
679inline THREAD_SAFE
bool is_mcode_divmod(mcode_t op)
681 return op == m_udiv || op == m_sdiv || op == m_umod || op == m_smod;
684inline THREAD_SAFE
bool has_mcode_seloff(mcode_t op)
686 return op == m_ldx || op == m_stx || op == m_icall || op == m_ijmp;
691inline THREAD_SAFE mcode_t set2jcnd(mcode_t code)
693 return mcode_t(code - m_setnz + m_jnz);
698inline THREAD_SAFE mcode_t jcnd2set(mcode_t code)
700 return mcode_t(code + m_setnz - m_jnz);
707THREAD_SAFE mcode_t
hexapi negate_mcode_relation(mcode_t code);
716THREAD_SAFE mcode_t
hexapi swap_mcode_relation(mcode_t code);
722THREAD_SAFE mcode_t
hexapi get_signed_mcode(mcode_t code);
729THREAD_SAFE mcode_t
hexapi get_unsigned_mcode(mcode_t code);
732inline THREAD_SAFE
bool is_signed_mcode(mcode_t code) {
return get_unsigned_mcode(code) != code; }
734inline THREAD_SAFE
bool is_unsigned_mcode(mcode_t code) {
return get_signed_mcode(code) != code; }
743THREAD_SAFE
bool hexapi mcode_modifies_d(mcode_t mcode);
754const int cc_count = mr_pf - mr_cf + 1;
773 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
788#define NF_NEGDONE 0x02
789#define NF_BINVDONE 0x04
790#define NF_NEGATE 0x08
791#define NF_BITNOT 0x10
835 bool has_unmutable_type()
const
839 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
860 AS_PRINTF(3, 4) virtual
int hexapi print(
int indent, const
char *format, ...);
861 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
873 virtual bool idaapi
oneliner() const newapi {
return false; }
887 AS_PRINTF(3, 4) int
hexapi print(
int indent, const
char *format, ...) override;
907 AS_PRINTF(3, 4) int
hexapi print(
int indent, const
char *format, ...) override;
949 return is_type_ptr(t) || is_type_array(t);
961 return type.is_decl_complex() && !type.is_typeref();
1033 tif.create_typedef(
nullptr, n);
1044 TS_NOELL = 0x8000000,
1045 TS_SHRINK = 0x4000000,
1046 TS_DONTREF = 0x2000000,
1047 TS_MASK = 0xE000000,
1089 int reg1()
const {
return atype() == ALOC_REG2 ? argloc_t::reg1() : get_reginfo(); }
1094 void _set_reg1(
int r1) { argloc_t::_set_reg1(r1, r1>>16); }
1097 void set_reg1(
int r1) { cleanup_argloc(
this); _set_reg1(r1); }
1106 bool hexapi is_aliasable(
const mba_t *mb,
int size)
const;
1123 ea_t defea = BADADDR;
1136 return location.is_stkoff() ? location.stkoff() : -1;
1139 bool is_reg1()
const {
return location.is_reg1(); }
1141 bool is_reg2()
const {
return location.is_reg2(); }
1154 scattered_aloc_t &get_scattered() {
return location.scattered(); }
1156 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
1169#define CVAR_USED 0x00000001
1170#define CVAR_TYPE 0x00000002
1171#define CVAR_NAME 0x00000004
1172#define CVAR_MREG 0x00000008
1173#define CVAR_NOWD 0x00000010
1174#define CVAR_UNAME 0x00000020
1175#define CVAR_UTYPE 0x00000040
1176#define CVAR_RESULT 0x00000080
1177#define CVAR_ARG 0x00000100
1178#define CVAR_FAKE 0x00000200
1179#define CVAR_OVER 0x00000400
1180#define CVAR_FLOAT 0x00000800
1181#define CVAR_SPOILED 0x00001000
1182#define CVAR_MAPDST 0x00002000
1183#define CVAR_PARTIAL 0x00004000
1184#define CVAR_THISARG 0x00008000
1185#define CVAR_SPLIT 0x00010000
1187#define CVAR_REGNAME 0x00020000
1189#define CVAR_NOPTR 0x00040000
1190#define CVAR_DUMMY 0x00080000
1192#define CVAR_NOTARG 0x00100000
1193#define CVAR_AUTOMAP 0x00200000
1194#define CVAR_BYREF 0x00400000
1195#define CVAR_INASM 0x00800000
1197#define CVAR_UNUSED 0x01000000
1199#define CVAR_SHARED 0x02000000
1214 lvar_t(
const qstring &n,
const vdloc_t &l, ea_t e,
const tinfo_t &t,
int w,
int db)
1246 bool hexapi is_promoted_arg()
const;
1282 void clear_used() { flags &= ~CVAR_USED; }
1283 void set_typed() { flags |=
CVAR_TYPE; clr_noptr_var(); }
1284 void set_non_typed() { flags &= ~CVAR_TYPE; }
1288 void clr_user_type() { flags &= ~CVAR_UTYPE; }
1289 void clr_user_name() { flags &= ~CVAR_UNAME; }
1290 void set_mreg_done() { flags |=
CVAR_MREG; }
1291 void clr_mreg_done() { flags &= ~CVAR_MREG; }
1292 void set_unknown_width() { flags |=
CVAR_NOWD; }
1293 void clr_unknown_width() { flags &= ~CVAR_NOWD; }
1294 void set_arg_var() { flags |=
CVAR_ARG; }
1296 void set_fake_var() { flags |=
CVAR_FAKE; }
1297 void clr_fake_var() { flags &= ~CVAR_FAKE; }
1298 void set_overlapped_var() { flags |=
CVAR_OVER; }
1299 void clr_overlapped_var() { flags &= ~CVAR_OVER; }
1300 void set_floating_var() { flags |=
CVAR_FLOAT; }
1301 void clr_floating_var() { flags &= ~CVAR_FLOAT; }
1303 void clr_spoiled_var() { flags &= ~CVAR_SPOILED; }
1305 void clr_mapdst_var() { flags &= ~CVAR_MAPDST; }
1307 void clr_partialy_typed() { flags &= ~CVAR_PARTIAL; }
1308 void set_noptr_var() { flags |=
CVAR_NOPTR; }
1309 void clr_noptr_var() { flags &= ~CVAR_NOPTR; }
1311 void clr_thisarg() { flags &= ~CVAR_THISARG; }
1312 void set_split_var() { flags |=
CVAR_SPLIT; }
1313 void clr_split_var() { flags &= ~CVAR_SPLIT; }
1314 void set_dummy_arg() { flags |=
CVAR_DUMMY; }
1315 void clr_dummy_arg() { flags &= ~CVAR_DUMMY; }
1316 void set_notarg() { clr_arg_var(); flags |=
CVAR_NOTARG; }
1317 void clr_notarg() { flags &= ~CVAR_NOTARG; }
1319 void clr_automapped() { flags &= ~CVAR_AUTOMAP; }
1320 void set_used_byref() { flags |=
CVAR_BYREF; }
1321 void clr_used_byref() { flags &= ~CVAR_BYREF; }
1323 void clr_decl_unused() { flags &= ~CVAR_UNUSED; }
1325 void clr_shared() { flags &= ~CVAR_SHARED; }
1338 const tinfo_t &
type()
const {
return tif; }
1339 tinfo_t &type() {
return tif; }
1343 bool hexapi accepts_type(
const tinfo_t &t,
bool may_change_thisarg=
false);
1354 bool hexapi set_lvar_type(
const tinfo_t &t,
bool may_fail=
false);
1369 bool hexapi set_width(
int w,
int svw_flags=0);
1371#define SVW_FLOAT 0x01
1372#define SVW_SOFT 0x02
1379 void hexapi append_list(
const mba_t *mba,
mlist_t *lst,
bool pad_if_scattered=
false)
const;
1386 return location.is_aliasable(mba, width);
1390DECLARE_TYPE_AS_MOVABLE(
lvar_t);
1406 int hexapi find_stkvar(sval_t spoff,
int width);
1420 int hexapi find_lvar(
const vdloc_t &location,
int width,
int defblk=-1)
const;
1430 ssize_t size = BADSIZE;
1435#define LVINF_KEEP 0x0001
1441#define LVINF_SPLIT 0x0002
1444#define LVINF_NOPTR 0x0004
1445#define LVINF_NOMAP 0x0008
1446#define LVINF_UNUSED 0x0010
1448 bool has_info()
const
1450 return !name.empty()
1459 return name == r.
name
1465 bool is_kept()
const {
return (flags &
LVINF_KEEP) != 0; }
1466 void clear_keep() { flags &= ~LVINF_KEEP; }
1468 bool is_split_lvar()
const {
return (flags &
LVINF_SPLIT) != 0; }
1470 void clr_split_lvar() { flags &= ~LVINF_SPLIT; }
1471 bool is_noptr_lvar()
const {
return (flags &
LVINF_NOPTR) != 0; }
1473 void clr_noptr_lvar() { flags &= ~LVINF_NOPTR; }
1474 bool is_nomap_lvar()
const {
return (flags &
LVINF_NOMAP) != 0; }
1476 void clr_nomap_lvar() { flags &= ~LVINF_NOMAP; }
1477 bool is_unused_lvar()
const {
return (flags &
LVINF_UNUSED) != 0; }
1479 void clr_unused_lvar() { flags &= ~LVINF_UNUSED; }
1482typedef qvector<lvar_saved_info_t> lvar_saved_infos_t;
1499 uval_t stkoff_delta = 0;
1504#define ULV_PRECISE_DEFEA 0x0001
1511 lvvec.swap(r.
lvvec);
1512 lmaps.swap(r.
lmaps);
1525 return lvvec.empty()
1527 && stkoff_delta == 0
1534 for ( lvar_saved_infos_t::iterator p=lvvec.begin(); p != lvvec.end(); ++p )
1536 if ( p->ll == vloc )
1595#define MLI_NAME 0x01
1596#define MLI_TYPE 0x02
1598#define MLI_SET_FLAGS 0x08
1599#define MLI_CLR_FLAGS 0x10
1614 const char *varname);
1627 const char *oldname,
1628 const char *newname)
1633 info.
name = newname;
1645 int code = ::compare(name, r.name);
1647 code = ::compare(tif, r.tif);
1651 bool empty()
const {
return name.empty() && tif.empty(); }
1655typedef std::map<ea_t, udcall_t> udcall_map_t;
1735 bool hexapi init(
const char *decl);
1738 bool empty()
const {
return udc.empty(); }
1742typedef size_t mbitmap_t;
1743const size_t bitset_width =
sizeof(mbitmap_t) * CHAR_BIT;
1744const size_t bitset_align = bitset_width - 1;
1745const size_t bitset_shift = 6;
1750 mbitmap_t *bitmap =
nullptr;
1763 std::swap(bitmap, r.bitmap);
1764 std::swap(high, r.high);
1768 bool hexapi add(
int bit);
1769 bool hexapi add(
int bit,
int width);
1771 bool hexapi sub(
int bit);
1772 bool hexapi sub(
int bit,
int width);
1774 bool hexapi cut_at(
int maxbit);
1775 void hexapi shift_down(
int shift);
1776 bool hexapi has(
int bit)
const;
1777 bool hexapi has_all(
int bit,
int width)
const;
1778 bool hexapi has_any(
int bit,
int width)
const;
1781 int (*get_bit_name)(qstring *out,
int bit,
int width,
void *ud)=
nullptr,
1782 void *ud=
nullptr)
const;
1784 bool hexapi empty()
const;
1785 int hexapi count()
const;
1786 int hexapi count(
int bit)
const;
1788 void clear() { high = 0; }
1789 void hexapi fill_with_ones(
int maxbit);
1790 bool hexapi fill_gaps(
int total_nbits);
1794 bool includes(
const bitset_t &ml)
const {
return ml.is_subset_of(*
this); }
1795 void extract(intvec_t &out)
const;
1797 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
1804 bool operator==(
const iterator &n)
const {
return i == n.i; }
1805 bool operator!=(
const iterator &n)
const {
return i != n.i; }
1806 int operator*()
const {
return i; }
1810 iterator begin()
const {
return itat(0); }
1811 iterator end()
const {
return iterator(high); }
1812 int front()
const {
return *begin(); }
1813 int back()
const {
return *end(); }
1814 void inc(iterator &p,
int n=1)
const { p.i = goup(p.i+n); }
1816 int hexapi goup(
int reg)
const;
1819typedef qvector<bitset_t> array_of_bitsets;
1829 ivl_tpl(T _off, T _size) : off(_off), size(_size) {}
1830 bool valid()
const {
return last() >= off; }
1831 T end()
const {
return off + size; }
1832 T last()
const {
return off + size - 1; }
1834 DEFINE_MEMORY_ALLOCATION_FUNCS()
1846 bool empty()
const {
return size == 0; }
1847 void clear() { size = 0; }
1848 void print(qstring *vout)
const;
1851 bool extend_to_cover(
const ivl_t &r)
1853 uval_t new_end = end();
1854 bool changed =
false;
1860 if ( new_end < r.end() )
1866 size = new_end - off;
1869 void intersect(
const ivl_t &r)
1871 uval_t new_off = qmax(off, r.off);
1872 uval_t new_end = end();
1873 if ( new_end > r.end() )
1875 if ( new_off < new_end )
1878 size = new_end - off;
1887 bool overlap(
const ivl_t &ivl)
const
1889 return interval::overlap(off, size, ivl.off, ivl.size);
1892 bool includes(
const ivl_t &ivl)
const
1894 return interval::includes(off, size, ivl.off, ivl.size);
1897 bool contains(uval_t off2)
const
1899 return interval::contains(off, size, off2);
1902 DECLARE_COMPARISONS(
ivl_t);
1903 static const ivl_t allmem;
1904#define ALLMEM ivl_t::allmem
1906DECLARE_TYPE_AS_MOVABLE(
ivl_t);
1914 ivl_with_name_t(): ivl(0, BADADDR), whole(
"<unnamed inteval>"), part(
nullptr) {}
1915 DEFINE_MEMORY_ALLOCATION_FUNCS()
1919template <
class Ivl,
class T>
1923 typedef qvector<Ivl> bag_t;
1927 bool verify()
const;
1930 static bool ivl_all_values(
const Ivl &ivl) {
return ivl.off == 0 && ivl.size == 0; }
1934 ivlset_tpl(
const Ivl &ivl) {
if ( ivl.valid() ) bag.push_back(ivl); }
1935 DEFINE_MEMORY_ALLOCATION_FUNCS()
1937 void swap(
ivlset_tpl &r) { bag.swap(r.bag); }
1938 const Ivl &getivl(
int idx)
const {
return bag[idx]; }
1939 const Ivl &lastivl()
const {
return bag.back(); }
1940 size_t nivls()
const {
return bag.size(); }
1941 bool empty()
const {
return bag.empty(); }
1942 void clear() { bag.clear(); }
1943 void qclear() { bag.qclear(); }
1944 bool all_values()
const {
return nivls() == 1 && ivl_all_values(bag[0]); }
1945 void set_all_values() { clear(); bag.push_back(Ivl(0, 0)); }
1946 bool single_value()
const {
return nivls() == 1 && bag[0].size == 1; }
1947 bool single_value(T v)
const {
return single_value() && bag[0].off == v; }
1949 bool operator==(
const Ivl &v)
const {
return nivls() == 1 && bag[0] == v; }
1950 bool operator!=(
const Ivl &v)
const {
return !(*
this == v); }
1952 typedef typename bag_t::iterator iterator;
1953 typedef typename bag_t::const_iterator const_iterator;
1954 const_iterator begin()
const {
return bag.begin(); }
1955 const_iterator end()
const {
return bag.end(); }
1956 iterator begin() {
return bag.begin(); }
1957 iterator end() {
return bag.end(); }
1972 bool add(ea_t ea, asize_t size) {
return add(
ivl_t(ea, size)); }
1976 bool sub(ea_t ea, asize_t size) {
return sub(
ivl_t(ea, size)); }
1978 bool hexapi has_common(
const ivl_t &ivl,
bool strict=
false)
const;
1979 void hexapi print(qstring *vout)
const;
1981 asize_t
hexapi count()
const;
1983 bool hexapi contains(uval_t off)
const;
1991typedef qvector<ivlset_t> array_of_ivlsets;
2003 void hexapi print(qstring *vout)
const;
2006DECLARE_TYPE_AS_MOVABLE(
rlist_t);
2019 void swap(
mlist_t &r) { reg.swap(r.reg); mem.swap(r.mem); }
2020 bool hexapi addmem(ea_t ea, asize_t size);
2021 bool add(
mreg_t r,
int size) {
return add(
mlist_t(r, size)); }
2022 bool add(
const rlist_t &r) {
return reg.add(r); }
2023 bool add(
const ivl_t &ivl) {
return add(
mlist_t(ivl)); }
2026 bool changed = reg.add(lst.reg);
2027 if ( mem.add(lst.mem) )
2031 bool sub(
mreg_t r,
int size) {
return sub(
mlist_t(r, size)); }
2032 bool sub(
const ivl_t &ivl) {
return sub(
mlist_t(ivl)); }
2035 bool changed = reg.sub(lst.reg);
2036 if ( mem.sub(lst.mem) )
2040 asize_t count()
const {
return reg.count() + mem.count(); }
2041 void hexapi print(qstring *vout)
const;
2043 bool empty()
const {
return reg.empty() && mem.empty(); }
2044 void clear() { reg.clear(); mem.clear(); }
2045 bool has(
mreg_t r)
const {
return reg.has(r); }
2046 bool has_all(
mreg_t r,
int size)
const {
return reg.has_all(r, size); }
2047 bool has_any(
mreg_t r,
int size)
const {
return reg.has_any(r, size); }
2048 bool has_memory()
const {
return !mem.empty(); }
2049 bool has_allmem()
const {
return mem == ALLMEM; }
2050 bool has_common(
const mlist_t &lst)
const {
return reg.has_common(lst.reg) || mem.has_common(lst.mem); }
2051 bool includes(
const mlist_t &lst)
const {
return reg.includes(lst.reg) && mem.includes(lst.mem); }
2052 bool intersect(
const mlist_t &lst)
2054 bool changed = reg.intersect(lst.reg);
2055 if ( mem.intersect(lst.mem) )
2059 bool is_subset_of(
const mlist_t &lst)
const {
return lst.includes(*
this); }
2062 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
2064DECLARE_TYPE_AS_MOVABLE(
mlist_t);
2065typedef qvector<mlist_t> mlistvec_t;
2066DECLARE_TYPE_AS_MOVABLE(mlistvec_t);
2171 bool colored_gdl_edges =
false;
2173 friend class iterator;
2174 virtual int goup(
int node)
const newapi;
2195 mba_t *_mba=
nullptr,
2198 : mba(_mba), blk(_blk), topins(_topins), curins(
nullptr) {}
2199 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
2200 bool really_alloc()
const;
2209 mba_t *_mba=
nullptr,
2213 virtual int idaapi visit_minsn() = 0;
2222 mba_t *_mba=
nullptr,
2229 virtual int idaapi visit_mop(
mop_t *op,
const tinfo_t *type,
bool is_target) = 0;
2236 virtual int idaapi visit_scif_mop(
const mop_t &r,
int off) = 0;
2245 bool changed =
false;
2247 virtual int idaapi visit_mop(
mop_t *op) = 0;
2297 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
2300 std::swap(off, r.off);
2301 std::swap(idx, r.idx);
2322 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
2325 std::swap(off, r.off);
2330 member_t *
hexapi get_stkvar(uval_t *p_off=
nullptr)
const;
2353 scif_t(
mba_t *_mba, tinfo_t *tif, qstring *n=
nullptr) : mba(_mba)
2373 mnumber_t(uint64 v, ea_t _ea=BADADDR,
int n=0)
2375 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
2378 if ( value < r.value )
2380 if ( value > r.value )
2385 void update_value(uint64 val64)
2399 operator uint16 *() {
return fnum.w; }
2400 operator const uint16 *()
const {
return fnum.w; }
2401 void hexapi print(qstring *vout)
const;
2403 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
2406 return ecmp(fnum, r.fnum);
2413#define SHINS_NUMADDR 0x01
2414#define SHINS_VALNUM 0x02
2415#define SHINS_SHORT 0x04
2416#define SHINS_LDXEA 0x08
2449#define OPROP_IMPDONE 0x01
2450#define OPROP_UDT 0x02
2451#define OPROP_FLOAT 0x04
2452#define OPROP_CCFLAGS 0x08
2455#define OPROP_UDEFVAL 0x10
2456#define OPROP_LOWADDR 0x20
2495 bool is_impptr_done()
const {
return (oprops &
OPROP_IMPDONE) != 0; }
2496 bool is_udt()
const {
return (oprops &
OPROP_UDT) != 0; }
2497 bool probably_floating()
const {
return (oprops &
OPROP_FLOAT) != 0; }
2498 bool is_undef_val()
const {
return (oprops &
OPROP_UDEFVAL) != 0; }
2499 bool is_lowaddr()
const {
return (oprops &
OPROP_LOWADDR) != 0; }
2500 bool is_ccflags()
const
2505 bool is_pcval()
const
2509 bool is_glbaddr_from_fixup()
const
2516 mop_t(
mreg_t _r,
int _s) : t(
mop_r), oprops(0), valnum(0), size(_s), r(_r) {}
2517 mop_t &operator=(
const mop_t &rop) {
return assign(rop); }
2523 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
2524 void zero() { t =
mop_z; oprops = 0; valnum = 0; size =
NOSIZE; nnn =
nullptr; }
2527 void erase_but_keep_size() {
int s2 = size; erase(); size = s2; }
2572 void hexapi create_from_scattered_vdloc(
2590 void hexapi make_number(uint64 _value,
int _size, ea_t _ea=BADADDR,
int opnum=0);
2597 bool hexapi make_fpnum(
const void *bytes,
size_t _size);
2608 void _make_reg(
mreg_t reg,
int _size)
2616 void make_reg(
mreg_t reg,
int _size) { erase(); _make_reg(reg, _size); }
2634 void hexapi _make_gvar(ea_t ea);
2636 void hexapi make_gvar(ea_t ea);
2648 void make_stkvar(
mba_t *mba, sval_t off) { erase(); _make_stkvar(mba, off); }
2654 void hexapi make_reg_pair(
int loreg,
int hireg,
int halfsize);
2661 void _make_insn(
minsn_t *ins);
2680 void hexapi make_helper(
const char *name);
2686 cstr = ::qstrdup(str);
2688 void _make_strlit(qstring *str)
2691 cstr = str->extract();
2725 bool empty()
const {
return t ==
mop_z; }
2736 bool is_cc()
const {
return is_reg() && r >= mr_cf && r < mr_first; }
2740 bool is_bit_reg()
const {
return is_reg() && is_bit_reg(r); }
2748 bool is_glbaddr()
const;
2750 bool is_glbaddr(ea_t ea)
const;
2752 bool is_stkaddr()
const;
2756 bool is_insn(mcode_t code)
const;
2759 bool has_side_effects(
bool include_ldx_and_divs=
false)
const;
2761 bool hexapi may_use_aliased_memory()
const;
2766 bool hexapi is01()
const;
2773 bool hexapi is_sign_extended_from(
int nbytes)
const;
2780 bool hexapi is_zero_extended_from(
int nbytes)
const;
2786 return is_sign_extended_from(nbytes);
2788 return is_zero_extended_from(nbytes);
2798 bool hexapi equal_mops(
const mop_t &rop,
int eqflags)
const;
2799 bool operator==(
const mop_t &rop)
const {
return equal_mops(rop, 0); }
2800 bool operator!=(
const mop_t &rop)
const {
return !equal_mops(rop, 0); }
2804 bool operator <(
const mop_t &rop)
const {
return lexcompare(rop) < 0; }
2805 friend int lexcompare(
const mop_t &a,
const mop_t &b) {
return a.lexcompare(b); }
2818 const tinfo_t *type=
nullptr,
2819 bool is_target=
false);
2834 uint64
value(
bool is_signed)
const {
return extend_sign(nnn->value, size, is_signed); }
2835 int64 signed_value()
const {
return value(
true); }
2836 uint64 unsigned_value()
const {
return value(
false); }
2837 void update_numop_value(uint64 val)
2839 nnn->update_value(extend_sign(val, size,
false));
2846 bool hexapi is_constant(uint64 *out=
nullptr,
bool is_signed=
true)
const;
2848 bool is_equal_to(uint64 n,
bool is_signed=
true)
const
2851 return is_constant(&v, is_signed) && v == n;
2853 bool is_zero()
const {
return is_equal_to(0,
false); }
2854 bool is_one()
const {
return is_equal_to(1,
false); }
2855 bool is_positive_constant()
const
2858 return is_constant(&v,
true) && int64(v) > 0;
2860 bool is_negative_constant()
const
2863 return is_constant(&v,
true) && int64(v) < 0;
2872 member_t *
get_stkvar(uval_t *p_off)
const {
return s->get_stkvar(p_off); }
2879 bool hexapi get_stkoff(sval_t *p_off)
const;
2888 const minsn_t *get_insn(mcode_t code)
const;
2889 minsn_t *get_insn(mcode_t code);
2898 bool hexapi make_low_half(
int width);
2904 bool hexapi make_high_half(
int width);
2910 bool hexapi make_first_half(
int width);
2916 bool hexapi make_second_half(
int width);
2927 bool hexapi shift_mop(
int offset);
2953 bool hexapi preserve_side_effects(
2956 bool *moved_calls=
nullptr);
2964 void hexapi apply_ld_mcode(mcode_t mcode, ea_t ea,
int newsize);
2965 void apply_xdu(ea_t ea,
int newsize) { apply_ld_mcode(m_xdu, ea, newsize); }
2966 void apply_xds(ea_t ea,
int newsize) { apply_ld_mcode(m_xds, ea, newsize); }
2968DECLARE_TYPE_AS_MOVABLE(
mop_t);
2976 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
2988 :
mop_t(ra), insize(ra.insize), outsize(ra.outsize) {}
2990 :
mop_t(ra), insize(isz), outsize(osz) {}
2995 insize = rop.insize;
2996 outsize = rop.outsize;
3001 int code = mop_t::lexcompare(ra);
3002 return code != 0 ? code
3003 : insize != ra.insize ? (insize-ra.insize)
3004 : outsize != ra.outsize ? (outsize-ra.outsize)
3022 void copy_mop(
const mop_t &op) { *(
mop_t *)
this = op; }
3025 void hexapi set_regarg(
mreg_t mr,
int sz,
const tinfo_t &tif);
3026 void set_regarg(
mreg_t mr,
const tinfo_t &tif)
3028 set_regarg(mr, tif.get_size(), tif);
3030 void set_regarg(
mreg_t mr,
char dt, type_sign_t sign = type_unsigned)
3032 int sz = get_dtype_size(dt);
3035 void make_int(
int val, ea_t val_ea,
int opno = 0)
3037 type = tinfo_t(BTF_INT);
3038 make_number(val, inf_get_cc_size_i(), val_ea, opno);
3040 void make_uint(
int val, ea_t val_ea,
int opno = 0)
3042 type = tinfo_t(BTF_UINT);
3043 make_number(val, inf_get_cc_size_i(), val_ea, opno);
3047typedef qvector<mcallarg_t> mcallargs_t;
3099#define FUNC_NAME_MEMCPY "memcpy"
3100#define FUNC_NAME_WMEMCPY "wmemcpy"
3101#define FUNC_NAME_MEMSET "memset"
3102#define FUNC_NAME_WMEMSET "wmemset"
3103#define FUNC_NAME_MEMSET32 "memset32"
3104#define FUNC_NAME_MEMSET64 "memset64"
3105#define FUNC_NAME_STRCPY "strcpy"
3106#define FUNC_NAME_WCSCPY "wcscpy"
3107#define FUNC_NAME_STRLEN "strlen"
3108#define FUNC_NAME_WCSLEN "wcslen"
3109#define FUNC_NAME_STRCAT "strcat"
3110#define FUNC_NAME_WCSCAT "wcscat"
3111#define FUNC_NAME_TAIL "tail"
3112#define FUNC_NAME_VA_ARG "va_arg"
3113#define FUNC_NAME_EMPTY "$empty"
3114#define FUNC_NAME_PRESENT "$present"
3115#define FUNC_NAME_CONTAINING_RECORD "CONTAINING_RECORD"
3116#define FUNC_NAME_MORESTACK "runtime_morestack"
3122#define MAX_FUNC_ARGS 64
3132 int stkargs_top = 0;
3133 cm_t cc = CM_CC_INVALID;
3152#define FCI_PROP 0x001
3153#define FCI_DEAD 0x002
3154#define FCI_FINAL 0x004
3155#define FCI_NORET 0x008
3156#define FCI_PURE 0x010
3157#define FCI_NOSIDE 0x020
3158#define FCI_SPLOK 0x040
3163#define FCI_HASCALL 0x080
3166#define FCI_HASFMT 0x100
3168#define FCI_EXPLOCS 0x400
3174 : callee(_callee), solid_args(_sargs)
3177 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
3181 bool is_vararg()
const {
return is_vararg_cc(cc); }
3195 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
3196 bool empty()
const {
return targets.empty(); }
3197 size_t size()
const {
return targets.size(); }
3198 void resize(
int s) { values.resize(s); targets.resize(s); }
3199 void hexapi print(qstring *vout)
const;
3211 voff_t(
mopt_t _type, sval_t _off) : off(_off), type(_type) {}
3218 void set(
mopt_t _type, sval_t _off) { type = _type; off = _off; }
3219 void set_stkoff(sval_t stkoff) { set(
mop_S, stkoff); }
3221 void undef() { set(
mop_z, -1); }
3223 bool defined()
const {
return type !=
mop_z; }
3224 bool is_reg()
const {
return type ==
mop_r; }
3225 bool is_stkoff()
const {
return type ==
mop_S; }
3226 mreg_t get_reg()
const { QASSERT(51892, is_reg());
return off; }
3227 sval_t get_stkoff()
const { QASSERT(51893, is_stkoff());
return off; }
3229 void inc(sval_t delta) { off += delta; }
3230 voff_t add(
int width)
const {
return voff_t(type, off+width); }
3231 sval_t diff(
const voff_t &r)
const { QASSERT(51894, type == r.
type);
return off - r.
off; }
3233 DECLARE_COMPARISONS(
voff_t)
3235 int code = ::compare(type, r.type);
3236 return code != 0 ? code : ::compare(off, r.off);
3247 :
voff_t(_type, _off), size(_size) {}
3252 void set(
mopt_t _type, sval_t _off,
int _size = 0)
3253 { voff_t::set(_type, _off); size = _size; }
3254 void set(
const voff_t &voff,
int _size)
3255 { set(voff.
type, voff.
off, _size); }
3256 void set_stkoff(sval_t stkoff,
int sz = 0) { set(
mop_S, stkoff, sz); }
3257 void set_reg (
mreg_t mreg,
int sz = 0) { set(
mop_r, mreg, sz); }
3270 return type == r.
type
3271 && interval::overlap(off, size, r.
off, r.
size);
3276 return type == r.
type
3277 && interval::includes(off, size, r.
off, r.
size);
3283 return type == voff2.
type
3284 && interval::contains(off, size, voff2.
off);
3288 DECLARE_COMPARISONS(
vivl_t)
3290 int code = voff_t::compare(r);
3293 bool operator==(
const mop_t &mop)
const
3295 return type == mop.
t && off == (mop.
is_reg() ? mop.r : mop.s->
off);
3297 void hexapi print(qstring *vout)
const;
3316#define CHF_INITED 0x01
3317#define CHF_REPLACED 0x02
3318#define CHF_OVER 0x04
3319#define CHF_FAKE 0x08
3320#define CHF_PASSTHRU 0x10
3321#define CHF_TERM 0x20
3325 : k(t, off), width(w), varnum(v), flags(
CHF_INITED) {}
3327 : k(_k), width(w), varnum(-1), flags(
CHF_INITED) {}
3328 void set_value(
const chain_t &r)
3329 { width = r.
width; varnum = r.
varnum; flags = r.
flags; *(intvec_t *)
this = (intvec_t &)r; }
3330 const voff_t &key()
const {
return k; }
3331 bool is_inited()
const {
return (flags &
CHF_INITED) != 0; }
3332 bool is_reg()
const {
return k.is_reg(); }
3333 bool is_stkoff()
const {
return k.is_stkoff(); }
3334 bool is_replaced()
const {
return (flags &
CHF_REPLACED) != 0; }
3335 bool is_overlapped()
const {
return (flags &
CHF_OVER) != 0; }
3336 bool is_fake()
const {
return (flags &
CHF_FAKE) != 0; }
3337 bool is_passreg()
const {
return (flags &
CHF_PASSTHRU) != 0; }
3338 bool is_term()
const {
return (flags &
CHF_TERM) != 0; }
3339 void set_inited(
bool b) { setflag(flags,
CHF_INITED, b); }
3340 void set_replaced(
bool b) { setflag(flags,
CHF_REPLACED, b); }
3341 void set_overlapped(
bool b) { setflag(flags,
CHF_OVER, b); }
3342 void set_term(
bool b) { setflag(flags,
CHF_TERM, b); }
3343 mreg_t get_reg()
const {
return k.get_reg(); }
3344 sval_t get_stkoff()
const {
return k.get_stkoff(); }
3345 bool overlap(
const chain_t &r)
const
3347 bool includes(
const chain_t &r)
const
3349 const voff_t endoff()
const {
return k.add(width); }
3351 bool operator<(
const chain_t &r)
const {
return key() < r.key(); }
3353 void hexapi print(qstring *vout)
const;
3357 void clear_varnum() { varnum = -1; set_replaced(
false); }
3363# define SIZEOF_BLOCK_CHAINS 32
3365# define SIZEOF_BLOCK_CHAINS 24
3367#elif defined(__MAC__)
3368# define SIZEOF_BLOCK_CHAINS 32
3370# define SIZEOF_BLOCK_CHAINS 56
3381 size_t body[SIZEOF_BLOCK_CHAINS/
sizeof(size_t)];
3396 chain_t *get_stk_chain(sval_t off,
int width=1)
3403 {
return get_chain(
chain_t(k, width)); }
3413 void hexapi print(qstring *vout)
const;
3415 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
3422 virtual int idaapi visit_chain(
int nblock,
chain_t &ch) = 0;
3440#define GCA_EMPTY 0x01
3441#define GCA_SPEC 0x02
3442#define GCA_ALLOC 0x04
3443#define GCA_NALLOC 0x08
3444#define GCA_OFIRST 0x10
3445#define GCA_OLAST 0x20
3458 qvector<block_chains_t>::swap(r);
3459 std::swap(lock, r.lock);
3466 void hexapi init(ea_t _ea);
3481#define IPROP_OPTIONAL 0x0001
3482#define IPROP_PERSIST 0x0002
3483#define IPROP_WILDMATCH 0x0004
3486#define IPROP_CLNPOP 0x0008
3488#define IPROP_FPINSN 0x0010
3489#define IPROP_FARCALL 0x0020
3490#define IPROP_TAILCALL 0x0040
3491#define IPROP_ASSERT 0x0080
3496#define IPROP_SPLIT 0x0700
3497#define IPROP_SPLIT1 0x0100
3498#define IPROP_SPLIT2 0x0200
3499#define IPROP_SPLIT4 0x0300
3500#define IPROP_SPLIT8 0x0400
3501#define IPROP_COMBINED 0x0800
3502#define IPROP_EXTSTX 0x1000
3503#define IPROP_IGNLOWSRC 0x2000
3506#define IPROP_INV_JX 0x4000
3507#define IPROP_WAS_NORET 0x8000
3508#define IPROP_MULTI_MOV 0x10000
3512#define IPROP_DONT_PROP 0x20000
3513#define IPROP_DONT_COMB 0x40000
3514#define IPROP_MBARRIER 0x80000
3516#define IPROP_UNMERGED 0x100000
3519 bool is_optional()
const {
return (iprops &
IPROP_OPTIONAL) != 0; }
3520 bool is_combined()
const {
return (iprops &
IPROP_COMBINED) != 0; }
3521 bool is_farcall()
const {
return (iprops &
IPROP_FARCALL) != 0; }
3522 bool is_cleaning_pop()
const {
return (iprops &
IPROP_CLNPOP) != 0; }
3523 bool is_extstx()
const {
return (iprops &
IPROP_EXTSTX) != 0; }
3524 bool is_tailcall()
const {
return (iprops &
IPROP_TAILCALL) != 0; }
3525 bool is_fpinsn()
const {
return (iprops &
IPROP_FPINSN) != 0; }
3526 bool is_assert()
const {
return (iprops &
IPROP_ASSERT) != 0; }
3527 bool is_persistent()
const {
return (iprops &
IPROP_PERSIST) != 0; }
3528 bool is_wild_match()
const {
return (iprops &
IPROP_WILDMATCH) != 0; }
3529 bool is_propagatable()
const {
return (iprops &
IPROP_DONT_PROP) == 0; }
3531 bool is_inverted_jx()
const {
return (iprops &
IPROP_INV_JX) != 0; }
3532 bool was_noret_icall()
const {
return (iprops &
IPROP_WAS_NORET) != 0; }
3534 bool is_combinable()
const {
return (iprops &
IPROP_DONT_COMB) == 0; }
3535 bool was_split()
const {
return (iprops &
IPROP_SPLIT) != 0; }
3536 bool is_mbarrier()
const {
return (iprops &
IPROP_MBARRIER) != 0; }
3537 bool was_unmerged()
const {
return (iprops &
IPROP_UNMERGED) != 0; }
3540 void hexapi set_combined();
3541 void clr_combined() { iprops &= ~IPROP_COMBINED; }
3546 void clr_tailcall() { iprops &= ~IPROP_TAILCALL; }
3548 void clr_fpinsn() { iprops &= ~IPROP_FPINSN; }
3550 void clr_assert() { iprops &= ~IPROP_ASSERT; }
3555 void clr_ignlowsrc() { iprops &= ~IPROP_IGNLOWSRC; }
3558 void clr_noret_icall() { iprops &= ~IPROP_WAS_NORET; }
3560 void clr_multimov() { iprops &= ~IPROP_MULTI_MOV; }
3561 void set_combinable() { iprops &= ~IPROP_DONT_COMB; }
3565 void set_split_size(
int s)
3567 iprops &= ~IPROP_SPLIT;
3573 int get_split_size()
const
3576 return cnt == 0 ? 0 : 1 << (cnt-1);
3582 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
3600 void hexapi setaddr(ea_t new_ea);
3609 int optimize_solo(
int optflags=0) {
return optimize_subtree(
nullptr,
nullptr,
nullptr,
nullptr, optflags); }
3612#define OPTI_ADDREXPRS 0x0001
3613#define OPTI_MINSTKREF 0x0002
3614#define OPTI_COMBINSNS 0x0004
3615#define OPTI_NO_LDXOPT 0x0008
3622 int hexapi optimize_subtree(
3626 ea_t *converted_call,
3651 bool hexapi equal_insns(
const minsn_t &m,
int eqflags)
const;
3654#define EQ_IGNSIZE 0x0001
3655#define EQ_IGNCODE 0x0002
3656#define EQ_CMPDEST 0x0004
3657#define EQ_OPTINSN 0x0008
3662 bool operator <(
const minsn_t &ri)
const {
return lexcompare(ri) < 0; }
3670 bool hexapi is_noret_call(
int flags=0);
3671#define NORET_IGNORE_WAS_NORET_ICALL 0x01
3672#define NORET_FORBID_ANALYSIS 0x02
3685 bool hexapi is_helper(
const char *name)
const;
3693 bool contains_call(
bool with_helpers=
false)
const {
return find_call(with_helpers) !=
nullptr; }
3699 bool hexapi has_side_effects(
bool include_ldx_and_divs=
false)
const;
3703 bool is_memcpy()
const {
return get_role() ==
ROLE_MEMCPY; }
3704 bool is_memset()
const {
return get_role() ==
ROLE_MEMSET; }
3705 bool is_alloca()
const {
return get_role() ==
ROLE_ALLOCA; }
3706 bool is_bswap ()
const {
return get_role() ==
ROLE_BSWAP; }
3707 bool is_readflags ()
const {
return get_role() ==
ROLE_READFLAGS; }
3729 minsn_t *find_ins_op(
mop_t **other, mcode_t op=m_nop) {
return CONST_CAST(
minsn_t*)((CONST_CAST(
const minsn_t*)(
this))->find_ins_op((
const mop_t**)other, op)); }
3737 mop_t *find_num_op(
mop_t **other) {
return CONST_CAST(
mop_t*)((CONST_CAST(
const minsn_t*)(
this))->find_num_op((
const mop_t**)other)); }
3739 bool is_mov()
const {
return opcode == m_mov || (opcode == m_f2f && l.
size == d.
size); }
3740 bool is_like_move()
const {
return is_mov() || is_mcode_xdsu(opcode) || opcode == m_low; }
3744 bool hexapi modifies_d()
const;
3745 bool modifies_pair_mop()
const {
return d.
t ==
mop_p && modifies_d(); }
3759 bool hexapi may_use_aliased_memory()
const;
3764 int hexapi serialize(bytevec_t *b)
const;
3771 bool hexapi deserialize(
const uchar *bytes,
size_t nbytes,
int format_version);
3796#define MAXRANGE bitrange_t(0, USHRT_MAX)
3815#define MBL_PRIV 0x0001
3817#define MBL_NONFAKE 0x0000
3818#define MBL_FAKE 0x0002
3819#define MBL_GOTO 0x0004
3820#define MBL_TCAL 0x0008
3821#define MBL_PUSH 0x0010
3822#define MBL_DMT64 0x0020
3823#define MBL_COMB 0x0040
3824#define MBL_PROP 0x0080
3825#define MBL_DEAD 0x0100
3826#define MBL_LIST 0x0200
3827#define MBL_INCONST 0x0400
3828#define MBL_CALL 0x0800
3829#define MBL_BACKPROP 0x1000
3830#define MBL_NORET 0x2000
3831#define MBL_DSLOT 0x4000
3832#define MBL_VALRANGES 0x8000
3833#define MBL_KEEP 0x10000
3867 void mark_lists_dirty() { flags &= ~MBL_LIST; request_propagation(); }
3868 void request_propagation() { flags |=
MBL_PROP; }
3869 bool needs_propagation()
const {
return (flags &
MBL_PROP) != 0; }
3870 void request_demote64() { flags |=
MBL_DMT64; }
3871 bool lists_dirty()
const {
return (flags &
MBL_LIST) == 0; }
3873 int make_lists_ready()
3875 if ( lists_ready() )
3877 return build_lists(
false);
3881 int npred()
const {
return predset.size(); }
3883 int nsucc()
const {
return succset.size(); }
3885 int pred(
int n)
const {
return predset[n]; }
3887 int succ(
int n)
const {
return succset[n]; }
3891 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
3892 bool empty()
const {
return head ==
nullptr; }
3901 void hexapi dump()
const;
3902 AS_PRINTF(2, 0) void
hexapi vdump_block(const
char *title, va_list va) const;
3903 AS_PRINTF(2, 3)
void dump_block(const
char *title, ...)
const
3906 va_start(va, title);
3907 vdump_block(title, va);
3979 int hexapi optimize_block();
3985 int hexapi build_lists(
bool kill_deads);
3993 int hexapi optimize_useless_jump();
4010 void hexapi append_use_list(
4014 bitrange_t mask=MAXRANGE)
const;
4023 void hexapi append_def_list(
4026 maymust_t maymust)
const;
4068 {
return find_first_use(list, i1, i2, maymust) !=
nullptr; }
4084 return CONST_CAST(
minsn_t*)(find_first_use(list,
4085 CONST_CAST(
const minsn_t*)(i1),
4101 maymust_t maymust=MAY_ACCESS)
const
4103 return find_redefinition(list, i1, i2, maymust) !=
nullptr;
4118 maymust_t maymust=MAY_ACCESS)
const;
4123 maymust_t maymust=MAY_ACCESS)
const
4125 return CONST_CAST(
minsn_t*)(find_redefinition(list,
4126 CONST_CAST(
const minsn_t*)(i1),
4160#define FD_BACKWARD 0x0000
4161#define FD_FORWARD 0x0001
4162#define FD_USE 0x0000
4163#define FD_DEF 0x0002
4164#define FD_DIRTY 0x0004
4175 return find_access(op, p_i1, i2, fdflags|
FD_DEF);
4183 return find_access(op, p_i1, i2, fdflags|
FD_USE);
4190 bool hexapi get_valranges(
4200 bool hexapi get_valranges(
4208#define VR_AT_START 0x0000
4210#define VR_AT_END 0x0001
4213#define VR_EXACT 0x0002
4225 size_t hexapi get_reginsn_qty()
const;
4227 bool is_call_block()
const {
return tail !=
nullptr && is_mcode_call(tail->
opcode); }
4228 bool is_unknown_call()
const {
return tail !=
nullptr && tail->
is_unknown_call(); }
4229 bool is_nway()
const {
return type ==
BLT_NWAY; }
4230 bool is_branch()
const {
return type ==
BLT_2WAY && tail->
d.
t ==
mop_b; }
4231 bool is_simple_goto_block()
const
4233 return get_reginsn_qty() == 1
4234 && tail->
opcode == m_goto
4237 bool is_simple_jcnd_block()
const
4241 && get_reginsn_qty() == 1
4242 && is_mcode_convertible_to_set(tail->
opcode);
4326 return strcmp(text.c_str(), r.text.c_str());
4330typedef qvector<hexwarn_t> hexwarns_t;
4363 func_t *pfn =
nullptr;
4368 ea_t start()
const {
return (pfn !=
nullptr ? *pfn : ranges[0]).start_ea; }
4369 bool empty()
const {
return pfn ==
nullptr && ranges.empty(); }
4370 void clear() { pfn =
nullptr; ranges.clear(); }
4371 bool is_snippet()
const {
return pfn ==
nullptr; }
4372 bool hexapi range_contains(ea_t ea)
const;
4373 bool is_fragmented()
const
4375 int n_frags = ranges.size();
4376 if ( pfn !=
nullptr )
4377 n_frags += pfn->tailqty + 1;
4385 const rangevec_t *ranges =
nullptr;
4386 const range_t *rptr =
nullptr;
4388 bool set(
const rangevec_t &r);
4390 ea_t current()
const {
return cur; }
4397 func_item_iterator_t fii;
4398 bool func_items_done =
true;
4402 if ( mbr.
pfn !=
nullptr )
4404 ok = fii.set(mbr.
pfn);
4406 func_items_done =
false;
4408 if ( rii.set(mbr.
ranges) )
4415 if ( !func_items_done )
4417 ok = fii.next_code();
4419 func_items_done =
true;
4422 ok = rii.next_code();
4425 ea_t current()
const
4427 return func_items_done ? rii.current() : fii.current();
4434 const range_t *rptr =
nullptr;
4435 const range_t *rend =
nullptr;
4436 bool set(
const rangevec_t &r) { rptr = r.begin(); rend = r.end();
return rptr != rend; }
4437 bool next() {
return ++rptr != rend; }
4438 const range_t &chunk()
const {
return *rptr; }
4445 func_tail_iterator_t fii;
4446 bool is_snippet()
const {
return rii.rptr !=
nullptr; }
4449 if ( mbr.is_snippet() )
4450 return rii.set(mbr.
ranges);
4452 return fii.set(mbr.
pfn);
4461 const range_t &chunk()
const
4463 return is_snippet() ? rii.chunk() : fii.chunk();
4474 DECLARE_UNCOPYABLE(
mba_t)
4480#define MBA_PRCDEFS 0x00000001
4481#define MBA_NOFUNC 0x00000002
4482#define MBA_PATTERN 0x00000004
4483#define MBA_LOADED 0x00000008
4484#define MBA_RETFP 0x00000010
4485#define MBA_SPLINFO 0x00000020
4486#define MBA_PASSREGS 0x00000040
4487#define MBA_THUNK 0x00000080
4488#define MBA_CMNSTK 0x00000100
4491#define MBA_PREOPT 0x00000200
4492#define MBA_CMBBLK 0x00000400
4493#define MBA_ASRTOK 0x00000800
4494#define MBA_CALLS 0x00001000
4495#define MBA_ASRPROP 0x00002000
4496#define MBA_SAVRST 0x00004000
4497#define MBA_RETREF 0x00008000
4498#define MBA_GLBOPT 0x00010000
4499#define MBA_LVARS0 0x00040000
4500#define MBA_LVARS1 0x00080000
4501#define MBA_DELPAIRS 0x00100000
4502#define MBA_CHVARS 0x00200000
4505#define MBA_SHORT 0x00400000
4506#define MBA_COLGDL 0x00800000
4507#define MBA_INSGDL 0x01000000
4508#define MBA_NICE 0x02000000
4509#define MBA_REFINE 0x04000000
4510#define MBA_WINGR32 0x10000000
4511#define MBA_NUMADDR 0x20000000
4512#define MBA_VALNUM 0x40000000
4514#define MBA_INITIAL_FLAGS (MBA_INSGDL|MBA_NICE|MBA_CMBBLK|MBA_REFINE\
4515 |MBA_PRCDEFS|MBA_WINGR32|MBA_VALNUM)
4517#define MBA2_LVARNAMES_OK 0x00000001
4518#define MBA2_LVARS_RENAMED 0x00000002
4519#define MBA2_OVER_CHAINS 0x00000004
4520#define MBA2_VALRNG_DONE 0x00000008
4521#define MBA2_IS_CTR 0x00000010
4522#define MBA2_IS_DTR 0x00000020
4523#define MBA2_ARGIDX_OK 0x00000040
4524#define MBA2_NO_DUP_CALLS 0x00000080
4525#define MBA2_NO_DUP_LVARS 0x00000100
4526#define MBA2_UNDEF_RETVAR 0x00000200
4527#define MBA2_ARGIDX_SORTED 0x00000400
4529#define MBA2_CODE16_BIT 0x00000800
4530#define MBA2_STACK_RETVAL 0x00001000
4531#define MBA2_HAS_OUTLINES 0x00002000
4532#define MBA2_NO_FRAME 0x00004000
4533#define MBA2_PROP_COMPLEX 0x00008000
4535#define MBA2_DONT_VERIFY 0x80000000
4539#define MBA2_INITIAL_FLAGS (MBA2_LVARNAMES_OK|MBA2_LVARS_RENAMED)
4541#define MBA2_ALL_FLAGS 0x0001FFFF
4543 bool precise_defeas()
const {
return (flags &
MBA_PRCDEFS) != 0; }
4544 bool optimized()
const {
return (flags &
MBA_GLBOPT) != 0; }
4545 bool short_display()
const {
return (flags &
MBA_SHORT ) != 0; }
4546 bool show_reduction()
const {
return (flags &
MBA_COLGDL) != 0; }
4547 bool graph_insns()
const {
return (flags &
MBA_INSGDL) != 0; }
4548 bool loaded_gdl()
const {
return (flags &
MBA_LOADED) != 0; }
4549 bool should_beautify()
const {
return (flags &
MBA_NICE ) != 0; }
4550 bool rtype_refined()
const {
return (flags &
MBA_RETREF) != 0; }
4551 bool may_refine_rettype()
const {
return (flags &
MBA_REFINE) != 0; }
4552 bool use_wingraph32()
const {
return (flags &
MBA_WINGR32) != 0; }
4553 bool display_numaddrs()
const {
return (flags &
MBA_NUMADDR) != 0; }
4554 bool display_valnums()
const {
return (flags &
MBA_VALNUM) != 0; }
4555 bool is_pattern()
const {
return (flags &
MBA_PATTERN) != 0; }
4556 bool is_thunk()
const {
return (flags &
MBA_THUNK) != 0; }
4557 bool saverest_done()
const {
return (flags &
MBA_SAVRST) != 0; }
4558 bool callinfo_built()
const {
return (flags &
MBA_CALLS) != 0; }
4559 bool really_alloc()
const {
return (flags &
MBA_LVARS0) != 0; }
4560 bool lvars_allocated()
const {
return (flags &
MBA_LVARS1) != 0; }
4561 bool chain_varnums_ok()
const {
return (flags &
MBA_CHVARS) != 0; }
4562 bool returns_fpval()
const {
return (flags &
MBA_RETFP) != 0; }
4563 bool has_passregs()
const {
return (flags &
MBA_PASSREGS) != 0; }
4564 bool generated_asserts()
const {
return (flags &
MBA_ASRTOK) != 0; }
4565 bool propagated_asserts()
const {
return (flags &
MBA_ASRPROP) != 0; }
4566 bool deleted_pairs()
const {
return (flags &
MBA_DELPAIRS) != 0; }
4567 bool common_stkvars_stkargs()
const {
return (flags &
MBA_CMNSTK) != 0; }
4572 bool argidx_ok()
const {
return (flags2 &
MBA2_ARGIDX_OK) != 0; }
4574 bool code16_bit_removed()
const {
return (flags2 &
MBA2_CODE16_BIT) != 0; }
4577 bool is_ctr()
const {
return (flags2 &
MBA2_IS_CTR) != 0; }
4578 bool is_dtr()
const {
return (flags2 &
MBA2_IS_DTR) != 0; }
4581 int get_mba_flags()
const {
return flags; }
4582 int get_mba_flags2()
const {
return flags2; }
4583 void set_mba_flags(
int f) { flags |= f; }
4584 void clr_mba_flags(
int f) { flags &= ~f; }
4585 void set_mba_flags2(
int f) { flags2 |= f; }
4586 void clr_mba_flags2(
int f) { flags2 &= ~f; }
4588 int calc_shins_flags()
const
4590 int shins_flags = 0;
4591 if ( short_display() )
4593 if ( display_valnums() )
4595 if ( display_numaddrs() )
4642 sval_t
hexapi stkoff_vd2ida(sval_t off)
const;
4644 sval_t
hexapi stkoff_ida2vd(sval_t off)
const;
4645 sval_t argbase()
const
4647 return retsize + stacksize;
4649 static vdloc_t hexapi idaloc2vd(
const argloc_t &loc,
int width, sval_t spd);
4650 vdloc_t hexapi idaloc2vd(
const argloc_t &loc,
int width)
const;
4652 static argloc_t
hexapi vd2idaloc(
const vdloc_t &loc,
int width, sval_t spd);
4653 argloc_t
hexapi vd2idaloc(
const vdloc_t &loc,
int width)
const;
4655 bool is_stkarg(
const lvar_t &v)
const
4659 member_t *get_stkvar(sval_t vd_stkoff, uval_t *poff)
const;
4661 argloc_t get_ida_argloc(
const lvar_t &v)
const
4666 ea_t entry_ea = BADADDR;
4667 ea_t last_prolog_ea = BADADDR;
4668 ea_t first_epilog_ea = BADADDR;
4671 cm_t cc = CM_CC_UNKNOWN;
4672 sval_t tmpstk_size = 0;
4679 int shadow_args = 0;
4680 sval_t fullsize = 0;
4681 sval_t stacksize = 0;
4684 sval_t inargoff = 0;
4687 sval_t minstkref = 0;
4688 ea_t minstkref_ea = BADADDR;
4689 sval_t minargref = 0;
4692 sval_t spd_adjust = 0;
4704 bool final_type =
false;
4721 ea_t error_ea = BADADDR;
4722 qstring error_strarg;
4730 mutable hexwarns_t notes;
4731 mutable uchar occurred_warns[32];
4733 bool write_to_const_detected()
const
4737 bool bad_call_sp_detected()
const
4741 bool regargs_is_not_aligned()
const
4745 bool has_bad_sp()
const
4754 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
4756 func_t *
hexapi get_curfunc() const;
4757 bool use_frame()
const {
return get_curfunc() !=
nullptr; }
4758 bool range_contains(ea_t ea)
const {
return mbr.range_contains(map_fict_ea(ea)); }
4759 bool is_snippet()
const {
return mbr.is_snippet(); }
4773 int hexapi optimize_local(
int locopt_bits);
4776#define LOCOPT_ALL 0x0001
4778#define LOCOPT_REFINE 0x0002
4779#define LOCOPT_REFINE2 0x0004
4797 int hexapi analyze_calls(
int acflags);
4800#define ACFL_LOCOPT 0x01
4801#define ACFL_BLKOPT 0x02
4802#define ACFL_GLBPROP 0x04
4803#define ACFL_GLBDEL 0x08
4804#define ACFL_GUESS 0x10
4819 void hexapi alloc_lvars();
4824 void hexapi dump()
const;
4825 AS_PRINTF(3, 0) void
hexapi vdump_mba(
bool _verify, const
char *title, va_list va) const;
4826 AS_PRINTF(3, 4)
void dump_mba(
bool _verify, const
char *title, ...)
const
4829 va_start(va, title);
4830 vdump_mba(_verify, title, va);
4847 void hexapi verify(
bool always)
const;
4853 void hexapi mark_chains_dirty();
4857 mblock_t *get_mblock(
int n) {
return CONST_CAST(
mblock_t*)((CONST_CAST(
const mba_t *)(
this))->get_mblock(n)); }
4883#define CPBLK_FAST 0x0000
4884#define CPBLK_MINREF 0x0001
4885#define CPBLK_OPTJMP 0x0002
4891 bool hexapi remove_empty_and_unreachable_blocks();
4897 bool hexapi combine_blocks();
4940 const tinfo_t *rettype=
nullptr,
4941 const mcallargs_t *callargs=
nullptr,
4942 const mop_t *out=
nullptr);
4951 void hexapi get_func_output_lists(
4954 const tinfo_t &type,
4955 ea_t call_ea=BADADDR,
4956 bool tail_call=
false);
4961 const lvar_t &arg(
int n)
const {
return CONST_CAST(
mba_t*)(
this)->arg(n); }
4983 ea_t
hexapi alloc_fict_ea(ea_t real_ea);
4989 ea_t
hexapi map_fict_ea(ea_t fict_ea)
const;
4994 const ivl_t &get_lvars_region()
const;
4995 const ivl_t &get_shadow_region()
const;
4996 const ivl_t &get_args_region()
const;
4997 ivl_t get_stack_region()
const;
5000 void hexapi serialize(bytevec_t &vout)
const;
5006 WARN_UNUSED_RESULT
static mba_t *
hexapi deserialize(
const uchar *bytes,
size_t nbytes);
5009 void hexapi save_snapshot(
const char *description);
5016 mreg_t hexapi alloc_kreg(
size_t size,
bool check_size=
true);
5023 bool hexapi set_lvar_name(
lvar_t &v,
const char *name,
int flagbits);
5024 bool set_nice_lvar_name(
lvar_t &v,
const char *name) {
return set_lvar_name(v, name,
CVAR_NAME); }
5046 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
5066 int chain_stamp = 0;
5084 bool hexapi is_accessed_globally(
5090 access_type_t access_type,
5091 maymust_t maymust)
const;
5092 int get_ud_gc_idx(
gctype_t gctype)
const {
return (gctype << 1); }
5093 int get_du_gc_idx(
gctype_t gctype)
const {
return (gctype << 1)+1; }
5094 int get_ud_dirty_bit(
gctype_t gctype) {
return 1 << get_ud_gc_idx(gctype); }
5095 int get_du_dirty_bit(
gctype_t gctype) {
return 1 << get_du_gc_idx(gctype); }
5101 int bit = get_ud_dirty_bit(gctype);
5102 return (dirty & bit) != 0;
5108 int bit = get_du_dirty_bit(gctype);
5109 return (dirty & bit) != 0;
5111 int get_chain_stamp()
const {
return chain_stamp; }
5121 {
return is_accessed_globally(list, b1, b2, m1, m2, WRITE_ACCESS, maymust); }
5125 {
return is_accessed_globally(list, b1, b2, m1, m2, READ_ACCESS, maymust); }
5137 ea_t dslot = BADADDR;
5139 ea_t severed_branch = BADADDR;
5141 bool is_likely_dslot =
false;
5147 bool ok()
const {
return ea < end; }
5148 bool has_dslot()
const {
return dslot != BADADDR; }
5149 bool dslot_with_xrefs()
const {
return dslot >= end; }
5151 bool is_severed_dslot()
const {
return severed_branch != BADADDR; }
5152 void start(
const range_t &rng)
5168 char ignore_micro = IM_NONE;
5183 const class qflow_chart_t &fc,
5184 const class bitset_t &reachable) = 0;
5245 minsn_t *
hexapi emit(mcode_t code,
int width, uval_t l, uval_t r, uval_t d,
int offsize);
5257 return emit(code, get_dtype_size(dtype), l, r, d, offsize);
5292 return is_insn(code) ? d :
nullptr;
5296 return is_insn(code) ? d :
nullptr;
5301 return is_insn() && d->opcode == code;
5311 return is_glbaddr() && a->g == ea;
5319inline vivl_t::vivl_t(
const chain_t &ch)
5320 :
voff_t(ch.key().type, ch.is_reg() ? ch.get_reg() : ch.get_stkoff()),
5340inline const ivl_t &mba_t::get_lvars_region()
const
5345inline const ivl_t &mba_t::get_shadow_region()
const
5350inline const ivl_t &mba_t::get_args_region()
const
5355inline ivl_t mba_t::get_stack_region()
const
5383#define OPF_REUSE 0x00
5384#define OPF_NEW_WINDOW 0x01
5385#define OPF_REUSE_ACTIVE 0x02
5387#define OPF_NO_WAIT 0x08
5390#define OPF_WINDOW_MGMT_MASK 0x07
5418#define VDRUN_NEWFILE 0x00000000
5419#define VDRUN_APPEND 0x00000001
5420#define VDRUN_ONLYNEW 0x00000002
5421#define VDRUN_SILENT 0x00000004
5422#define VDRUN_SENDIDB 0x00000008
5423#define VDRUN_MAYSTOP 0x00000010
5424#define VDRUN_CMDLINE 0x00000020
5425#define VDRUN_STATS 0x00000040
5426#define VDRUN_LUMINA 0x00000080
5449 qstring
hexapi desc()
const;
5450 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
5461 qstring desc()
const {
return hf.desc(); }
5465 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
5495#define GCO_STK 0x0000
5496#define GCO_REG 0x0001
5497#define GCO_USE 0x0002
5498#define GCO_DEF 0x0004
5499 bool is_reg()
const {
return (flags &
GCO_REG) != 0; }
5500 bool is_use()
const {
return (flags &
GCO_USE) != 0; }
5501 bool is_def()
const {
return (flags &
GCO_DEF) != 0; }
5734 || (op > cot_last && op < cit_end);
5751 const tinfo_t &type,
5752 const citem_t *parent=
nullptr,
5753 bool *nice_stroff=
nullptr)
const;
5764 void hexapi assign(uint64 v,
int nbytes, type_sign_t sign);
5766 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
5775 lvar_t &getv()
const {
return mba->
vars[idx]; }
5776 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
5795#define CV_FAST 0x0000
5796#define CV_PRUNE 0x0001
5797#define CV_PARENTS 0x0002
5798#define CV_POST 0x0004
5799#define CV_RESTART 0x0008
5800#define CV_INSNS 0x0010
5890 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
5906 bool hexapi recalc_parent_types();
5929 bool hexapi calc_rvalue_type(tinfo_t *target,
const cexpr_t *e);
5967 ITP_INNER_LAST = ITP_BRACE1,
5990 bool operator < (
const treeloc_t &r)
const
5993 || (ea == r.ea && itp < r.itp);
5995 bool operator == (
const treeloc_t &r)
const
5997 return ea == r.ea && itp == r.itp;
5999 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
6018 mutable bool used =
false;
6024typedef std::map<treeloc_t, citem_cmt_t>
user_cmts_t;
6037 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
6041typedef std::map<citem_locator_t, int32> user_iflags_t;
6047typedef std::map<ea_t, intvec_t> user_unions_t;
6060 bit_bound_t(
int n=0,
int s=0) : nbits(n), sbits(s) {}
6077 mutable int index = -1;
6083 std::swap(ea, r.
ea);
6084 std::swap(op, r.
op);
6092 bool hexapi contains_label()
const;
6099 {
return CONST_CAST(
citem_t*)((CONST_CAST(
const citem_t*)(
this))->find_parent_of(item)); }
6101 void print1(qstring *vout,
const cfunc_t *func)
const;
6106 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
6108DECLARE_TYPE_AS_MOVABLE(
citem_t);
6153#define EXFL_CPADONE 0x0001
6154#define EXFL_LVALUE 0x0002
6155#define EXFL_FPOP 0x0004
6156#define EXFL_ALONE 0x0008
6157#define EXFL_CSTR 0x0010
6158#define EXFL_PARTIAL 0x0020
6159#define EXFL_UNDEF 0x0040
6160#define EXFL_JUMPOUT 0x0080
6161#define EXFL_VFTABLE 0x0100
6162#define EXFL_ALL 0x01FF
6166 bool is_odd_lvalue()
const {
return (exflags &
EXFL_LVALUE) != 0; }
6167 bool is_fpop()
const {
return (exflags &
EXFL_FPOP) != 0; }
6168 bool is_cstr()
const {
return (exflags &
EXFL_CSTR) != 0; }
6169 bool is_type_partial()
const {
return (exflags &
EXFL_PARTIAL) != 0; }
6170 bool is_undef_val()
const {
return (exflags &
EXFL_UNDEF) != 0; }
6171 bool is_jumpout()
const {
return (exflags &
EXFL_JUMPOUT) != 0; }
6172 bool is_vftable()
const {
return (exflags &
EXFL_VFTABLE) != 0; }
6177 void set_type_partial(
bool val =
true)
6182 exflags &= ~EXFL_PARTIAL;
6185 cexpr_t() : x(nullptr), y(nullptr), z(nullptr) {}
6187 :
citem_t(cexpr_op), x(_x), y(_y), z(_z) {}
6190 void swap(
cexpr_t &r) { qswap(*
this, r); }
6211 void hexapi put_number(
cfunc_t *func, uint64
value,
int nbytes, type_sign_t sign=no_sign);
6216 void hexapi print1(qstring *vout,
const cfunc_t *func)
const;
6222 void hexapi calc_type(
bool recursive);
6240 bool hexapi contains_operator(
ctype_t needed_op,
int times=1)
const;
6273 int hexapi get_low_nbit_bound()
const;
6280 bool hexapi has_side_effects()
const;
6291 QASSERT(50071, op ==
cot_num);
6292 return n->value(type);
6297 return op ==
cot_num && numval() == _v;
6302 return op ==
cot_num && int64(numval()) < 0;
6307 return op ==
cot_num && int64(numval()) >= 0;
6312 return op ==
cot_num && numval() != 0;
6325 if ( out !=
nullptr )
6332 bool hexapi maybe_ptr()
const;
6337 if ( x->type.is_ptr_or_array() )
6339 if ( y->type.is_ptr_or_array() )
6367 cexpr_t *theother(
const cexpr_t *what) {
return what == x ? y : x; }
6375DECLARE_TYPE_AS_MOVABLE(
cexpr_t);
6382 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
6403 DECLARE_COMPARISONS(
cif_t);
6425 DECLARE_COMPARISONS(
cfor_t);
6437 DECLARE_COMPARISONS(
cdo_t);
6452 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
6458 casm_t(ea_t ea) { push_back(ea); }
6460 DECLARE_COMPARISONS(
casm_t);
6462 bool one_insn()
const {
return size() == 1; }
6463 void genasm(qstring *buf, ea_t ea)
const;
6528 void hexapi print1(qstring *vout,
const cfunc_t *func)
const;
6532 bool hexapi is_ordinary_flow()
const;
6565DECLARE_TYPE_AS_MOVABLE(
cinsn_t);
6567typedef qlist<cinsn_t> cinsn_list_t;
6578 bool is_vararg =
false;
6580 void consume_cexpr(
cexpr_t *e)
6585 DECLARE_COMPARISONS(
carg_t)
6587 return cexpr_t::compare(r);
6590DECLARE_TYPE_AS_MOVABLE(
carg_t);
6597#define CFL_FINAL 0x0001
6598#define CFL_HELPER 0x0002
6599#define CFL_NORET 0x0004
6601 carglist_t(
const tinfo_t &ftype,
int fl = 0) : functype(ftype), flags(fl) {}
6614 size_t size()
const {
return values.size(); }
6615 const uint64 &
value(
int i)
const {
return values[i]; }
6617DECLARE_TYPE_AS_MOVABLE(
ccase_t);
6623 int find_value(uint64 v)
const;
6638 uval_t
value = BADADDR;
6639#define ANCHOR_INDEX 0x1FFFFFFF
6640#define ANCHOR_MASK 0xC0000000
6641#define ANCHOR_CITEM 0x00000000
6642#define ANCHOR_LVAR 0x40000000
6643#define ANCHOR_ITP 0x80000000
6644#define ANCHOR_BLKCMT 0x20000000
6645 int get_index()
const {
return value & ANCHOR_INDEX; }
6647 bool is_valid_anchor()
const {
return value != BADADDR; }
6649 bool is_lvar_anchor()
const {
return (
value & ANCHOR_MASK) ==
ANCHOR_LVAR; }
6679 void verify(
const mba_t *mba)
const;
6689 member_t *
hexapi get_memptr(struc_t **p_sptr=
nullptr)
const;
6702 tinfo_t *parent=
nullptr,
6703 uint64 *p_offset=
nullptr)
const;
6711 int hexapi get_edm(tinfo_t *parent)
const;
6725 ea_t
hexapi get_ea()
const;
6732 int hexapi get_label_num(
int gln_flags)
const;
6735#define GLN_CURRENT 0x01
6736#define GLN_GOTO_TARGET 0x02
6745 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
6784AS_PRINTF(3, 0)
cexpr_t *
hexapi vcreate_helper(
bool standalone, const tinfo_t &type, const
char *format, va_list va);
6787AS_PRINTF(3, 4) inline
cexpr_t *create_helper(
bool standalone, const tinfo_t &type, const
char *format, ...)
6790 va_start(va, format);
6791 cexpr_t *e = vcreate_helper(standalone, type, format, va);
6806AS_PRINTF(3, 0)
cexpr_t *
hexapi vcall_helper(const tinfo_t &rettype,
carglist_t *args, const
char *format, va_list va);
6809AS_PRINTF(3, 4) inline
cexpr_t *call_helper(
6810 const tinfo_t &rettype,
6812 const
char *format, ...)
6815 va_start(va, format);
6816 cexpr_t *e = vcall_helper(rettype, args, format, va);
6938typedef std::map<ea_t, cinsnptrvec_t> eamap_t;
6940typedef std::map<cinsn_t *, rangeset_t> boundaries_t;
6941#define INS_EPILOG ((cinsn_t *)1)
6962#define CIT_COLLAPSED 0x0001
6967#define CFS_BOUNDS 0x0001
6968#define CFS_TEXT 0x0002
6969#define CFS_LVARS_HIDDEN 0x0004
6970#define CFS_LOCKED 0x0008
6983 void release() {
delete this; }
6984 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
6988 void
hexapi build_c_tree();
6999 void hexapi print_dcl(qstring *vout) const;
7008 bool hexapi get_func_type(tinfo_t *type) const;
7023 sval_t
hexapi get_stkoff_delta();
7032 void hexapi remove_unused_labels();
7058 bool hexapi has_orphan_cmts() const;
7062 int hexapi del_orphan_cmts();
7068 bool hexapi get_user_union_selection(ea_t ea, intvec_t *path);
7074 void hexapi set_user_union_selection(ea_t ea, const intvec_t &path);
7096 bool hexapi get_line_item(
7106 hexwarns_t &
hexapi get_warnings();
7110 eamap_t &
hexapi get_eamap();
7114 boundaries_t &
hexapi get_boundaries();
7124 void hexapi refresh_func_ctext();
7126 bool hexapi gather_derefs(const
ctree_item_t &ci, udt_type_data_t *udm=
nullptr) const;
7127 bool hexapi find_item_coords(const
citem_t *item,
int *px,
int *py);
7128 bool locked()
const {
return (statebits &
CFS_LOCKED) != 0; }
7135typedef qvector<cfuncptr_t> cfuncptrs_t;
7139#define DECOMP_NO_WAIT 0x0001
7140#define DECOMP_NO_CACHE 0x0002
7141#define DECOMP_NO_FRAME 0x0004
7142#define DECOMP_WARNINGS 0x0008
7143#define DECOMP_ALL_BLKS 0x0010
7144#define DECOMP_NO_HIDE 0x0020
7145#define DECOMP_NO_XREFS 0x0040
7146#define DECOMP_GXREFS_DEFLT 0x0000
7150#define DECOMP_GXREFS_NOUPD 0x0040
7151#define DECOMP_GXREFS_FORCE 0x0080
7152#define DECOMP_VOID_MBA 0x0100
7171 int decomp_flags=0);
7188 return decompile(mbr, hf, decomp_flags);
7200 const rangevec_t &ranges,
7205 return decompile(mbr, hf, decomp_flags);
7220 const mlist_t *retlist=
nullptr,
7260inline void cif_t::cleanup() {
delete ithen;
delete ielse; }
7261inline void cloop_t::cleanup() {
delete body; }
7271 ((
cexpr_t*)
this)->print1(vout, func);
7273 ((
cinsn_t*)
this)->print1(vout, func);
7298 return CONST_CAST(
cexpr_t*)(
this)->get_1num_op(
7303inline citem_locator_t::citem_locator_t(
const citem_t *i)
7304 : ea(i != nullptr ? i->ea : BADADDR),
7305 op(i != nullptr ? i->op : cot_empty)
7317qstring
hexapi create_field_name(
const tinfo_t &type, uval_t offset=BADADDR);
7319const int64 HEXRAYS_API_MAGIC = 0x00DEC0DE00000003LL;
7397 hxe_resolve_stkaddrs,
7418 hxe_open_pseudocode=100,
7422 hxe_switch_pseudocode,
7427 hxe_refresh_pseudocode,
7432 hxe_close_pseudocode,
7469 hxe_populating_popup,
7474 lxe_lvar_name_changed,
7482 lxe_lvar_type_changed,
7489 lxe_lvar_cmt_changed,
7496 lxe_lvar_mapping_changed,
7517typedef ssize_t idaapi
hexrays_cb_t(
void *ud, hexrays_event_t event, va_list va);
7562 if (
lnnum < r.lnnum )
return -1;
7563 if (
lnnum > r.lnnum )
return 1;
7564 if (
x < r.x )
return -1;
7565 if (
x > r.x )
return 1;
7569 :
lnnum(_lnnum),
x(_x),
y(_y) {}
7579 history_item_t(ea_t _ea=BADADDR,
int _lnnum=-1,
int _x=0,
int _y=0)
7607#define VDUI_VISIBLE 0x0001
7608#define VDUI_VALID 0x0002
7624 bool hexapi set_locked(
bool v);
7936 bool operator!=(
const ui_stroff_op_t &r)
const {
return !(*
this == r); }
7939typedef qvector<ui_stroff_op_t> ui_stroff_ops_t;
7949 virtual bool idaapi
apply(
size_t opnum,
const intvec_t &path,
const tinfo_t &top_tif,
const char *spath) = 0;
7958 const qvector<tinfo_t> *udts,
7959 const ui_stroff_ops_t &ops,
7971typedef void *
hexdsp_t(
int code, ...);
7983 hx_user_numforms_begin,
7984 hx_user_numforms_end,
7985 hx_user_numforms_next,
7986 hx_user_numforms_prev,
7987 hx_user_numforms_first,
7988 hx_user_numforms_second,
7989 hx_user_numforms_find,
7990 hx_user_numforms_insert,
7991 hx_user_numforms_erase,
7992 hx_user_numforms_clear,
7993 hx_user_numforms_size,
7994 hx_user_numforms_free,
7995 hx_user_numforms_new,
7996 hx_lvar_mapping_begin,
7997 hx_lvar_mapping_end,
7998 hx_lvar_mapping_next,
7999 hx_lvar_mapping_prev,
8000 hx_lvar_mapping_first,
8001 hx_lvar_mapping_second,
8002 hx_lvar_mapping_find,
8003 hx_lvar_mapping_insert,
8004 hx_lvar_mapping_erase,
8005 hx_lvar_mapping_clear,
8006 hx_lvar_mapping_size,
8007 hx_lvar_mapping_free,
8008 hx_lvar_mapping_new,
8009 hx_udcall_map_begin,
8013 hx_udcall_map_first,
8014 hx_udcall_map_second,
8016 hx_udcall_map_insert,
8017 hx_udcall_map_erase,
8018 hx_udcall_map_clear,
8027 hx_user_cmts_second,
8029 hx_user_cmts_insert,
8035 hx_user_iflags_begin,
8037 hx_user_iflags_next,
8038 hx_user_iflags_prev,
8039 hx_user_iflags_first,
8040 hx_user_iflags_second,
8041 hx_user_iflags_find,
8042 hx_user_iflags_insert,
8043 hx_user_iflags_erase,
8044 hx_user_iflags_clear,
8045 hx_user_iflags_size,
8046 hx_user_iflags_free,
8048 hx_user_unions_begin,
8050 hx_user_unions_next,
8051 hx_user_unions_prev,
8052 hx_user_unions_first,
8053 hx_user_unions_second,
8054 hx_user_unions_find,
8055 hx_user_unions_insert,
8056 hx_user_unions_erase,
8057 hx_user_unions_clear,
8058 hx_user_unions_size,
8059 hx_user_unions_free,
8061 hx_user_labels_begin,
8063 hx_user_labels_next,
8064 hx_user_labels_prev,
8065 hx_user_labels_first,
8066 hx_user_labels_second,
8067 hx_user_labels_find,
8068 hx_user_labels_insert,
8069 hx_user_labels_erase,
8070 hx_user_labels_clear,
8071 hx_user_labels_size,
8072 hx_user_labels_free,
8087 hx_boundaries_begin,
8091 hx_boundaries_first,
8092 hx_boundaries_second,
8094 hx_boundaries_insert,
8095 hx_boundaries_erase,
8096 hx_boundaries_clear,
8100 hx_block_chains_begin,
8101 hx_block_chains_end,
8102 hx_block_chains_next,
8103 hx_block_chains_prev,
8104 hx_block_chains_get,
8105 hx_block_chains_find,
8106 hx_block_chains_insert,
8107 hx_block_chains_erase,
8108 hx_block_chains_clear,
8109 hx_block_chains_size,
8110 hx_block_chains_free,
8111 hx_block_chains_new,
8115 hx_valrng_t_compare,
8117 hx_valrng_t_set_cmp,
8118 hx_valrng_t_reduce_size,
8119 hx_valrng_t_intersect_with,
8120 hx_valrng_t_unite_with,
8121 hx_valrng_t_inverse,
8125 hx_valrng_t_cvt_to_single_value,
8126 hx_valrng_t_cvt_to_cmp,
8130 hx_install_optinsn_handler,
8131 hx_remove_optinsn_handler,
8132 hx_install_optblock_handler,
8133 hx_remove_optblock_handler,
8134 hx_must_mcode_close_block,
8135 hx_is_mcode_propagatable,
8136 hx_negate_mcode_relation,
8137 hx_swap_mcode_relation,
8138 hx_get_signed_mcode,
8139 hx_get_unsigned_mcode,
8140 hx_mcode_modifies_d,
8141 hx_operand_locator_t_compare,
8142 hx_vd_printer_t_print,
8143 hx_file_printer_t_print,
8144 hx_qstring_printer_t_print,
8150 hx_partial_type_num,
8152 hx_get_int_type_by_width_and_sign,
8162 hx_vdloc_t_is_aliasable,
8165 hx_lvar_locator_t_compare,
8166 hx_lvar_locator_t_dstr,
8168 hx_lvar_t_is_promoted_arg,
8169 hx_lvar_t_accepts_type,
8170 hx_lvar_t_set_lvar_type,
8171 hx_lvar_t_set_width,
8172 hx_lvar_t_append_list_,
8173 hx_lvars_t_find_stkvar,
8175 hx_lvars_t_find_lvar,
8176 hx_restore_user_lvar_settings,
8177 hx_save_user_lvar_settings,
8178 hx_modify_user_lvars,
8179 hx_restore_user_defined_calls,
8180 hx_save_user_defined_calls,
8182 hx_convert_to_user_call,
8183 hx_install_microcode_filter,
8184 hx_udc_filter_t_init,
8185 hx_udc_filter_t_apply,
8186 hx_bitset_t_bitset_t,
8195 hx_bitset_t_shift_down,
8197 hx_bitset_t_has_all,
8198 hx_bitset_t_has_any,
8204 hx_bitset_t_fill_with_ones,
8205 hx_bitset_t_has_common,
8206 hx_bitset_t_intersect,
8207 hx_bitset_t_is_subset_of,
8208 hx_bitset_t_compare,
8214 hx_ivlset_t_addmasked,
8217 hx_ivlset_t_has_common,
8221 hx_ivlset_t_has_common_,
8222 hx_ivlset_t_contains,
8223 hx_ivlset_t_includes,
8224 hx_ivlset_t_intersect,
8225 hx_ivlset_t_compare,
8233 hx_lvar_ref_t_compare,
8235 hx_stkvar_ref_t_compare,
8236 hx_stkvar_ref_t_get_stkvar,
8245 hx_mop_t_create_from_mlist,
8246 hx_mop_t_create_from_ivlset,
8247 hx_mop_t_create_from_vdloc,
8248 hx_mop_t_create_from_scattered_vdloc,
8249 hx_mop_t_create_from_insn,
8250 hx_mop_t_make_number,
8251 hx_mop_t_make_fpnum,
8252 hx_mop_t_make_reg_pair,
8253 hx_mop_t_make_helper,
8254 hx_mop_t_is_bit_reg,
8255 hx_mop_t_may_use_aliased_memory,
8257 hx_mop_t_is_sign_extended_from,
8258 hx_mop_t_is_zero_extended_from,
8259 hx_mop_t_equal_mops,
8260 hx_mop_t_lexcompare,
8261 hx_mop_t_for_all_ops,
8262 hx_mop_t_for_all_scattered_submops,
8263 hx_mop_t_is_constant,
8264 hx_mop_t_get_stkoff,
8265 hx_mop_t_make_low_half,
8266 hx_mop_t_make_high_half,
8267 hx_mop_t_make_first_half,
8268 hx_mop_t_make_second_half,
8270 hx_mop_t_change_size,
8271 hx_mop_t_preserve_side_effects,
8272 hx_mop_t_apply_ld_mcode,
8273 hx_mcallarg_t_print,
8275 hx_mcallarg_t_set_regarg,
8276 hx_mcallinfo_t_lexcompare,
8277 hx_mcallinfo_t_set_type,
8278 hx_mcallinfo_t_get_type,
8279 hx_mcallinfo_t_print,
8280 hx_mcallinfo_t_dstr,
8281 hx_mcases_t_compare,
8284 hx_vivl_t_extend_to_cover,
8285 hx_vivl_t_intersect,
8290 hx_chain_t_append_list_,
8291 hx_block_chains_t_get_chain,
8292 hx_block_chains_t_print,
8293 hx_block_chains_t_dstr,
8294 hx_graph_chains_t_for_all_chains,
8295 hx_graph_chains_t_release,
8302 hx_minsn_t_optimize_subtree,
8303 hx_minsn_t_for_all_ops,
8304 hx_minsn_t_for_all_insns,
8305 hx_minsn_t__make_nop,
8306 hx_minsn_t_equal_insns,
8307 hx_minsn_t_lexcompare,
8308 hx_minsn_t_is_noret_call,
8309 hx_minsn_t_is_helper,
8310 hx_minsn_t_find_call,
8311 hx_minsn_t_has_side_effects,
8312 hx_minsn_t_find_opcode,
8313 hx_minsn_t_find_ins_op,
8314 hx_minsn_t_find_num_op,
8315 hx_minsn_t_modifies_d,
8316 hx_minsn_t_is_between,
8317 hx_minsn_t_may_use_aliased_memory,
8323 hx_mblock_t_vdump_block,
8324 hx_mblock_t_insert_into_block,
8325 hx_mblock_t_remove_from_block,
8326 hx_mblock_t_for_all_insns,
8327 hx_mblock_t_for_all_ops,
8328 hx_mblock_t_for_all_uses,
8329 hx_mblock_t_optimize_insn,
8330 hx_mblock_t_optimize_block,
8331 hx_mblock_t_build_lists,
8332 hx_mblock_t_append_use_list,
8333 hx_mblock_t_append_def_list,
8334 hx_mblock_t_build_use_list,
8335 hx_mblock_t_build_def_list,
8336 hx_mblock_t_find_first_use,
8337 hx_mblock_t_find_redefinition,
8338 hx_mblock_t_is_rhs_redefined,
8339 hx_mblock_t_find_access,
8340 hx_mblock_t_get_valranges,
8344 hx_mba_t_optimize_local,
8345 hx_mba_t_build_graph,
8347 hx_mba_t_analyze_calls,
8348 hx_mba_t_optimize_global,
8349 hx_mba_t_alloc_lvars,
8354 hx_mba_t_mark_chains_dirty,
8355 hx_mba_t_insert_block,
8356 hx_mba_t_remove_block,
8357 hx_mba_t_remove_empty_and_unreachable_blocks,
8358 hx_mba_t_combine_blocks,
8359 hx_mba_t_for_all_ops,
8360 hx_mba_t_for_all_insns,
8361 hx_mba_t_for_all_topinsns,
8365 hx_mba_t_deserialize,
8366 hx_mbl_graph_t_is_accessed_globally,
8367 hx_mbl_graph_t_get_ud,
8368 hx_mbl_graph_t_get_du,
8373 hx_get_hexrays_version,
8375 hx_close_pseudocode,
8378 hx_hexrays_failure_t_desc,
8380 hx_gco_info_t_append_to_list,
8381 hx_get_current_operand,
8383 hx_negated_relation,
8384 hx_swapped_relation,
8390 hx_cnumber_t_assign,
8391 hx_cnumber_t_compare,
8392 hx_var_ref_t_compare,
8393 hx_ctree_visitor_t_apply_to,
8394 hx_ctree_visitor_t_apply_to_exprs,
8395 hx_ctree_parentee_t_recalc_parent_types,
8396 hx_cfunc_parentee_t_calc_rvalue_type,
8397 hx_citem_locator_t_compare,
8398 hx_citem_t_contains_expr,
8399 hx_citem_t_contains_label,
8400 hx_citem_t_find_parent_of,
8401 hx_citem_t_find_closest_addr,
8404 hx_cexpr_t_replace_by,
8406 hx_cexpr_t_put_number,
8408 hx_cexpr_t_calc_type,
8409 hx_cexpr_t_equal_effect,
8410 hx_cexpr_t_is_child_of,
8411 hx_cexpr_t_contains_operator,
8412 hx_cexpr_t_get_high_nbit_bound,
8413 hx_cexpr_t_get_low_nbit_bound,
8414 hx_cexpr_t_requires_lvalue,
8415 hx_cexpr_t_has_side_effects,
8420 hx_cwhile_t_compare,
8422 hx_creturn_t_compare,
8427 hx_cinsn_t_replace_by,
8429 hx_cinsn_t_new_insn,
8430 hx_cinsn_t_create_if,
8433 hx_cinsn_t_is_ordinary_flow,
8434 hx_cinsn_t_contains_insn,
8435 hx_cinsn_t_collect_free_breaks,
8436 hx_cinsn_t_collect_free_continues,
8437 hx_cblock_t_compare,
8438 hx_carglist_t_compare,
8440 hx_ccases_t_compare,
8441 hx_cswitch_t_compare,
8442 hx_ctree_item_t_get_memptr,
8443 hx_ctree_item_t_get_lvar,
8444 hx_ctree_item_t_get_ea,
8445 hx_ctree_item_t_get_label_num,
8453 hx_save_user_labels,
8455 hx_save_user_numforms,
8456 hx_save_user_iflags,
8457 hx_save_user_unions,
8458 hx_restore_user_labels,
8459 hx_restore_user_cmts,
8460 hx_restore_user_numforms,
8461 hx_restore_user_iflags,
8462 hx_restore_user_unions,
8463 hx_cfunc_t_build_c_tree,
8465 hx_cfunc_t_print_dcl,
8466 hx_cfunc_t_print_func,
8467 hx_cfunc_t_get_func_type,
8468 hx_cfunc_t_get_lvars,
8469 hx_cfunc_t_get_stkoff_delta,
8470 hx_cfunc_t_find_label,
8471 hx_cfunc_t_remove_unused_labels,
8472 hx_cfunc_t_get_user_cmt,
8473 hx_cfunc_t_set_user_cmt,
8474 hx_cfunc_t_get_user_iflags,
8475 hx_cfunc_t_set_user_iflags,
8476 hx_cfunc_t_has_orphan_cmts,
8477 hx_cfunc_t_del_orphan_cmts,
8478 hx_cfunc_t_get_user_union_selection,
8479 hx_cfunc_t_set_user_union_selection,
8480 hx_cfunc_t_get_line_item,
8481 hx_cfunc_t_get_warnings,
8482 hx_cfunc_t_get_eamap,
8483 hx_cfunc_t_get_boundaries,
8484 hx_cfunc_t_get_pseudocode,
8485 hx_cfunc_t_gather_derefs,
8486 hx_cfunc_t_find_item_coords,
8490 hx_mark_cfunc_dirty,
8491 hx_clear_cached_cfuncs,
8492 hx_has_cached_cfunc,
8494 hx_create_field_name,
8495 hx_install_hexrays_callback,
8496 hx_remove_hexrays_callback,
8497 hx_vdui_t_set_locked,
8498 hx_vdui_t_refresh_view,
8499 hx_vdui_t_refresh_ctext,
8500 hx_vdui_t_switch_to,
8501 hx_vdui_t_get_number,
8502 hx_vdui_t_get_current_label,
8504 hx_vdui_t_refresh_cpos,
8505 hx_vdui_t_get_current_item,
8506 hx_vdui_t_ui_rename_lvar,
8507 hx_vdui_t_rename_lvar,
8508 hx_vdui_t_ui_set_call_type,
8509 hx_vdui_t_ui_set_lvar_type,
8510 hx_vdui_t_set_lvar_type,
8511 hx_vdui_t_ui_edit_lvar_cmt,
8512 hx_vdui_t_set_lvar_cmt,
8513 hx_vdui_t_ui_map_lvar,
8514 hx_vdui_t_ui_unmap_lvar,
8516 hx_vdui_t_set_strmem_type,
8517 hx_vdui_t_rename_strmem,
8518 hx_vdui_t_set_global_type,
8519 hx_vdui_t_rename_global,
8520 hx_vdui_t_rename_label,
8521 hx_vdui_t_jump_enter,
8522 hx_vdui_t_ctree_to_disasm,
8523 hx_vdui_t_calc_cmt_type,
8525 hx_vdui_t_edit_func_cmt,
8526 hx_vdui_t_del_orphan_cmts,
8527 hx_vdui_t_set_num_radix,
8528 hx_vdui_t_set_num_enum,
8529 hx_vdui_t_set_num_stroff,
8530 hx_vdui_t_invert_sign,
8531 hx_vdui_t_invert_bits,
8532 hx_vdui_t_collapse_item,
8533 hx_vdui_t_collapse_lvars,
8534 hx_vdui_t_split_item,
8537 hx_vdui_t_set_noptr_lvar,
8538 hx_select_udt_by_offset,
8539 hx_mblock_t_get_valranges_,
8540 hx_cfunc_t_refresh_func_ctext,
8541 hx_checkout_hexrays_license,
8542 hx_mba_t_copy_block,
8543 hx_mblock_t_optimize_useless_jump,
8544 hx_mblock_t_get_reginsn_qty,
8545 hx_modify_user_lvar_info,
8546 hx_cdg_insn_iterator_t_next,
8547 hx_restore_user_labels2,
8548 hx_save_user_labels2,
8549 hx_mba_ranges_t_range_contains,
8550 hx_close_hexrays_waitbox,
8551 hx_mba_t_map_fict_ea,
8552 hx_mba_t_alloc_fict_ea,
8553 hx_mba_t_alloc_kreg,
8555 hx_mba_t_idaloc2vd_,
8556 hx_mba_t_vd2idaloc_,
8557 hx_bitset_t_fill_gaps,
8558 hx_cfunc_t_save_user_labels,
8559 hx_cfunc_t_save_user_cmts,
8560 hx_cfunc_t_save_user_numforms,
8561 hx_cfunc_t_save_user_iflags,
8562 hx_cfunc_t_save_user_unions,
8563 hx_minsn_t_set_combined,
8564 hx_mba_t_save_snapshot,
8566 hx_mba_t_set_maturity,
8569 hx_mba_t_create_helper_call,
8570 hx_lvar_t_append_list,
8571 hx_chain_t_append_list,
8572 hx_udc_filter_t_cleanup,
8573 hx_mba_t_get_curfunc,
8574 hx_mop_t__make_gvar,
8576 hx_cexpr_t_maybe_ptr,
8577 hx_minsn_t_serialize,
8578 hx_minsn_t_deserialize,
8579 hx_mba_t_stkoff_vd2ida,
8580 hx_mba_t_stkoff_ida2vd,
8583 hx_ctree_item_t_print,
8584 hx_ctree_item_t_dstr,
8585 hx_mba_t_set_lvar_name,
8586 hx_change_hexrays_config,
8587 hx_mba_t_get_func_output_lists,
8588 hx_vdui_t_rename_udm,
8589 hx_vdui_t_set_udm_type,
8590 hx_ctree_item_t_get_udm,
8591 hx_ctree_item_t_get_edm,
8594typedef size_t iterator_word;
8604 return callui(ui_broadcast, HEXRAYS_API_MAGIC, &dummy, flags).i == (HEXRAYS_API_MAGIC >> 32);
8641 HEXDSP(hx_user_numforms_find, &p, map, &key);
8650 HEXDSP(hx_user_numforms_insert, &p, map, &key, &val);
8659 HEXDSP(hx_user_numforms_begin, &p, map);
8668 HEXDSP(hx_user_numforms_end, &p, map);
8676 HEXDSP(hx_user_numforms_next, &p);
8684 HEXDSP(hx_user_numforms_prev, &p);
8692 HEXDSP(hx_user_numforms_erase, map, &p);
8699 HEXDSP(hx_user_numforms_clear, map);
8706 return (
size_t)HEXDSP(hx_user_numforms_size, map);
8713 HEXDSP(hx_user_numforms_free, map);
8750 HEXDSP(hx_lvar_mapping_find, &p, map, &key);
8759 HEXDSP(hx_lvar_mapping_insert, &p, map, &key, &val);
8768 HEXDSP(hx_lvar_mapping_begin, &p, map);
8777 HEXDSP(hx_lvar_mapping_end, &p, map);
8785 HEXDSP(hx_lvar_mapping_next, &p);
8793 HEXDSP(hx_lvar_mapping_prev, &p);
8801 HEXDSP(hx_lvar_mapping_erase, map, &p);
8808 HEXDSP(hx_lvar_mapping_clear, map);
8815 return (
size_t)HEXDSP(hx_lvar_mapping_size, map);
8822 HEXDSP(hx_lvar_mapping_free, map);
8844 return *(ea_t *)HEXDSP(hx_udcall_map_first, &p);
8851 return *(
udcall_t *)HEXDSP(hx_udcall_map_second, &p);
8859 HEXDSP(hx_udcall_map_find, &p, map, &key);
8868 HEXDSP(hx_udcall_map_insert, &p, map, &key, &val);
8877 HEXDSP(hx_udcall_map_begin, &p, map);
8886 HEXDSP(hx_udcall_map_end, &p, map);
8894 HEXDSP(hx_udcall_map_next, &p);
8902 HEXDSP(hx_udcall_map_prev, &p);
8910 HEXDSP(hx_udcall_map_erase, map, &p);
8917 HEXDSP(hx_udcall_map_clear, map);
8924 return (
size_t)HEXDSP(hx_udcall_map_size, map);
8931 HEXDSP(hx_udcall_map_free, map);
8938 return (udcall_map_t *)HEXDSP(hx_udcall_map_new);
8953 return *(
treeloc_t *)HEXDSP(hx_user_cmts_first, &p);
8960 return *(
citem_cmt_t *)HEXDSP(hx_user_cmts_second, &p);
8968 HEXDSP(hx_user_cmts_find, &p, map, &key);
8977 HEXDSP(hx_user_cmts_insert, &p, map, &key, &val);
8986 HEXDSP(hx_user_cmts_begin, &p, map);
8995 HEXDSP(hx_user_cmts_end, &p, map);
9003 HEXDSP(hx_user_cmts_next, &p);
9011 HEXDSP(hx_user_cmts_prev, &p);
9019 HEXDSP(hx_user_cmts_erase, map, &p);
9026 HEXDSP(hx_user_cmts_clear, map);
9033 return (
size_t)HEXDSP(hx_user_cmts_size, map);
9040 HEXDSP(hx_user_cmts_free, map);
9069 return *(int32 *)HEXDSP(hx_user_iflags_second, &p);
9077 HEXDSP(hx_user_iflags_find, &p, map, &key);
9086 HEXDSP(hx_user_iflags_insert, &p, map, &key, &val);
9095 HEXDSP(hx_user_iflags_begin, &p, map);
9104 HEXDSP(hx_user_iflags_end, &p, map);
9112 HEXDSP(hx_user_iflags_next, &p);
9120 HEXDSP(hx_user_iflags_prev, &p);
9128 HEXDSP(hx_user_iflags_erase, map, &p);
9135 HEXDSP(hx_user_iflags_clear, map);
9142 return (
size_t)HEXDSP(hx_user_iflags_size, map);
9149 HEXDSP(hx_user_iflags_free, map);
9156 return (user_iflags_t *)HEXDSP(hx_user_iflags_new);
9171 return *(ea_t *)HEXDSP(hx_user_unions_first, &p);
9178 return *(intvec_t *)HEXDSP(hx_user_unions_second, &p);
9186 HEXDSP(hx_user_unions_find, &p, map, &key);
9195 HEXDSP(hx_user_unions_insert, &p, map, &key, &val);
9204 HEXDSP(hx_user_unions_begin, &p, map);
9213 HEXDSP(hx_user_unions_end, &p, map);
9221 HEXDSP(hx_user_unions_next, &p);
9229 HEXDSP(hx_user_unions_prev, &p);
9237 HEXDSP(hx_user_unions_erase, map, &p);
9244 HEXDSP(hx_user_unions_clear, map);
9251 return (
size_t)HEXDSP(hx_user_unions_size, map);
9258 HEXDSP(hx_user_unions_free, map);
9265 return (user_unions_t *)HEXDSP(hx_user_unions_new);
9280 return *(
int *)HEXDSP(hx_user_labels_first, &p);
9287 return *(qstring *)HEXDSP(hx_user_labels_second, &p);
9295 HEXDSP(hx_user_labels_find, &p, map, &key);
9304 HEXDSP(hx_user_labels_insert, &p, map, &key, &val);
9313 HEXDSP(hx_user_labels_begin, &p, map);
9322 HEXDSP(hx_user_labels_end, &p, map);
9330 HEXDSP(hx_user_labels_next, &p);
9338 HEXDSP(hx_user_labels_prev, &p);
9346 HEXDSP(hx_user_labels_erase, map, &p);
9353 HEXDSP(hx_user_labels_clear, map);
9360 return (
size_t)HEXDSP(hx_user_labels_size, map);
9367 HEXDSP(hx_user_labels_free, map);
9389 return *(ea_t *)HEXDSP(hx_eamap_first, &p);
9404 HEXDSP(hx_eamap_find, &p, map, &key);
9413 HEXDSP(hx_eamap_insert, &p, map, &key, &val);
9422 HEXDSP(hx_eamap_begin, &p, map);
9431 HEXDSP(hx_eamap_end, &p, map);
9439 HEXDSP(hx_eamap_next, &p);
9447 HEXDSP(hx_eamap_prev, &p);
9455 HEXDSP(hx_eamap_erase, map, &p);
9462 HEXDSP(hx_eamap_clear, map);
9469 return (
size_t)HEXDSP(hx_eamap_size, map);
9476 HEXDSP(hx_eamap_free, map);
9483 return (eamap_t *)HEXDSP(hx_eamap_new);
9498 return *(
cinsn_t * *)HEXDSP(hx_boundaries_first, &p);
9505 return *(rangeset_t *)HEXDSP(hx_boundaries_second, &p);
9513 HEXDSP(hx_boundaries_find, &p, map, &key);
9522 HEXDSP(hx_boundaries_insert, &p, map, &key, &val);
9531 HEXDSP(hx_boundaries_begin, &p, map);
9540 HEXDSP(hx_boundaries_end, &p, map);
9548 HEXDSP(hx_boundaries_next, &p);
9556 HEXDSP(hx_boundaries_prev, &p);
9564 HEXDSP(hx_boundaries_erase, map, &p);
9571 HEXDSP(hx_boundaries_clear, map);
9578 return (
size_t)HEXDSP(hx_boundaries_size, map);
9585 HEXDSP(hx_boundaries_free, map);
9592 return (boundaries_t *)HEXDSP(hx_boundaries_new);
9607 return *(
chain_t *)HEXDSP(hx_block_chains_get, &p);
9615 HEXDSP(hx_block_chains_find, &p, set, &val);
9624 HEXDSP(hx_block_chains_insert, &p, set, &val);
9633 HEXDSP(hx_block_chains_begin, &p, set);
9642 HEXDSP(hx_block_chains_end, &p, set);
9650 HEXDSP(hx_block_chains_next, &p);
9658 HEXDSP(hx_block_chains_prev, &p);
9666 HEXDSP(hx_block_chains_erase, set, &p);
9673 HEXDSP(hx_block_chains_clear, set);
9680 return (
size_t)HEXDSP(hx_block_chains_size, set);
9687 HEXDSP(hx_block_chains_free, set);
9698inline void *hexrays_alloc(
size_t size)
9700 return HEXDSP(hx_hexrays_alloc, size);
9704inline void hexrays_free(
void *ptr)
9706 HEXDSP(hx_hexrays_free, ptr);
9710inline void valrng_t::clear()
9712 HEXDSP(hx_valrng_t_clear,
this);
9716inline void valrng_t::copy(
const valrng_t &r)
9718 HEXDSP(hx_valrng_t_copy,
this, &r);
9724 return *(
valrng_t *)HEXDSP(hx_valrng_t_assign,
this, &r);
9728inline int valrng_t::compare(
const valrng_t &r)
const
9730 return (
int)(size_t)HEXDSP(hx_valrng_t_compare,
this, &r);
9734inline void valrng_t::set_eq(uvlr_t v)
9736 HEXDSP(hx_valrng_t_set_eq,
this, v);
9740inline void valrng_t::set_cmp(cmpop_t cmp, uvlr_t _value)
9742 HEXDSP(hx_valrng_t_set_cmp,
this, cmp, _value);
9746inline bool valrng_t::reduce_size(
int new_size)
9748 return (uchar)(size_t)HEXDSP(hx_valrng_t_reduce_size,
this, new_size) != 0;
9752inline bool valrng_t::intersect_with(
const valrng_t &r)
9754 return (uchar)(size_t)HEXDSP(hx_valrng_t_intersect_with,
this, &r) != 0;
9758inline bool valrng_t::unite_with(
const valrng_t &r)
9760 return (uchar)(size_t)HEXDSP(hx_valrng_t_unite_with,
this, &r) != 0;
9764inline void valrng_t::inverse()
9766 HEXDSP(hx_valrng_t_inverse,
this);
9770inline bool valrng_t::has(uvlr_t v)
const
9772 return (uchar)(size_t)HEXDSP(hx_valrng_t_has,
this, v) != 0;
9776inline void valrng_t::print(qstring *vout)
const
9778 HEXDSP(hx_valrng_t_print,
this, vout);
9782inline const char *valrng_t::dstr()
const
9784 return (
const char *)HEXDSP(hx_valrng_t_dstr,
this);
9788inline bool valrng_t::cvt_to_single_value(uvlr_t *v)
const
9790 return (uchar)(size_t)HEXDSP(hx_valrng_t_cvt_to_single_value,
this, v) != 0;
9794inline bool valrng_t::cvt_to_cmp(cmpop_t *cmp, uvlr_t *val,
bool strict)
const
9796 return (uchar)(size_t)HEXDSP(hx_valrng_t_cvt_to_cmp,
this, cmp, val, strict) != 0;
9803 HEXDSP(hx_get_merror_desc, &retval, out, code, mba);
9810 return (uchar)(size_t)HEXDSP(hx_must_mcode_close_block, mcode, including_calls) != 0;
9816 return (uchar)(size_t)HEXDSP(hx_is_mcode_propagatable, mcode) != 0;
9820inline THREAD_SAFE mcode_t negate_mcode_relation(mcode_t code)
9822 return (mcode_t)(size_t)HEXDSP(hx_negate_mcode_relation, code);
9826inline THREAD_SAFE mcode_t swap_mcode_relation(mcode_t code)
9828 return (mcode_t)(size_t)HEXDSP(hx_swap_mcode_relation, code);
9832inline THREAD_SAFE mcode_t get_signed_mcode(mcode_t code)
9834 return (mcode_t)(size_t)HEXDSP(hx_get_signed_mcode, code);
9838inline THREAD_SAFE mcode_t get_unsigned_mcode(mcode_t code)
9840 return (mcode_t)(size_t)HEXDSP(hx_get_unsigned_mcode, code);
9844inline THREAD_SAFE
bool mcode_modifies_d(mcode_t mcode)
9846 return (uchar)(size_t)HEXDSP(hx_mcode_modifies_d, mcode) != 0;
9852 return (
int)(size_t)HEXDSP(hx_operand_locator_t_compare,
this, &r);
9856inline AS_PRINTF(3, 4) int
vd_printer_t::print(
int indent, const
char *format, ...)
9859 va_start(va, format);
9860 int retval = (int)(
size_t)HEXDSP(hx_vd_printer_t_print,
this, indent, format, va);
9866inline AS_PRINTF(3, 4) int
file_printer_t::print(
int indent, const
char *format, ...)
9869 va_start(va, format);
9870 int retval = (int)(
size_t)HEXDSP(hx_file_printer_t_print,
this, indent, format, va);
9876inline AS_PRINTF(3, 4) int
qstring_printer_t::print(
int indent, const
char *format, ...)
9879 va_start(va, format);
9880 int retval = (int)(
size_t)HEXDSP(hx_qstring_printer_t_print,
this, indent, format, va);
9886inline const char *
dstr(
const tinfo_t *tif)
9888 return (
const char *)HEXDSP(hx_dstr, tif);
9894 return (uchar)(size_t)HEXDSP(hx_is_type_correct, ptr) != 0;
9900 return (uchar)(size_t)HEXDSP(hx_is_small_udt, &tif) != 0;
9906 return (uchar)(size_t)HEXDSP(hx_is_nonbool_type, &type) != 0;
9912 return (uchar)(size_t)HEXDSP(hx_is_bool_type, &type) != 0;
9918 return (
int)(size_t)HEXDSP(hx_partial_type_num, &type);
9925 HEXDSP(hx_get_float_type, &retval, width);
9933 HEXDSP(hx_get_int_type_by_width_and_sign, &retval, srcwidth, sign);
9941 HEXDSP(hx_get_unk_type, &retval, size);
9949 HEXDSP(hx_dummy_ptrtype, &retval, ptrsize, isfp);
9956 return (uchar)(size_t)HEXDSP(hx_get_member_type, mptr, type) != 0;
9963 HEXDSP(hx_make_pointer, &retval, &type);
9971 HEXDSP(hx_create_typedef, &retval, name);
9978 return (uchar)(size_t)HEXDSP(hx_get_type,
id, tif, guess) != 0;
9984 return (uchar)(size_t)HEXDSP(hx_set_type,
id, &tif, source, force) != 0;
9988inline const char *vdloc_t::dstr(
int width)
const
9990 return (
const char *)HEXDSP(hx_vdloc_t_dstr,
this, width);
9994inline int vdloc_t::compare(
const vdloc_t &r)
const
9996 return (
int)(size_t)HEXDSP(hx_vdloc_t_compare,
this, &r);
10000inline bool vdloc_t::is_aliasable(
const mba_t *mb,
int size)
const
10002 return (uchar)(size_t)HEXDSP(hx_vdloc_t_is_aliasable,
this, mb, size) != 0;
10008 HEXDSP(hx_print_vdloc, vout, &loc, nbytes);
10014 return (uchar)(size_t)HEXDSP(hx_arglocs_overlap, &loc1, w1, &loc2, w2) != 0;
10018inline int lvar_locator_t::compare(
const lvar_locator_t &r)
const
10020 return (
int)(size_t)HEXDSP(hx_lvar_locator_t_compare,
this, &r);
10024inline const char *lvar_locator_t::dstr()
const
10026 return (
const char *)HEXDSP(hx_lvar_locator_t_dstr,
this);
10030inline const char *lvar_t::dstr()
const
10032 return (
const char *)HEXDSP(hx_lvar_t_dstr,
this);
10038 return (uchar)(size_t)HEXDSP(hx_lvar_t_is_promoted_arg,
this) != 0;
10044 return (uchar)(size_t)HEXDSP(hx_lvar_t_accepts_type,
this, &t, may_change_thisarg) != 0;
10050 return (uchar)(size_t)HEXDSP(hx_lvar_t_set_lvar_type,
this, &t, may_fail) != 0;
10056 return (uchar)(size_t)HEXDSP(hx_lvar_t_set_width,
this, w, svw_flags) != 0;
10062 HEXDSP(hx_lvar_t_append_list,
this, mba, lst, pad_if_scattered);
10068 return (
int)(size_t)HEXDSP(hx_lvars_t_find_stkvar,
this, spoff, width);
10074 return (
lvar_t *)HEXDSP(hx_lvars_t_find,
this, &ll);
10080 return (
int)(size_t)HEXDSP(hx_lvars_t_find_lvar,
this, &location, width, defblk);
10086 return (uchar)(size_t)HEXDSP(hx_restore_user_lvar_settings, lvinf, func_ea) != 0;
10092 HEXDSP(hx_save_user_lvar_settings, func_ea, &lvinf);
10098 return (uchar)(size_t)HEXDSP(hx_modify_user_lvars, entry_ea, &mlv) != 0;
10104 return (uchar)(size_t)HEXDSP(hx_modify_user_lvar_info, func_ea, mli_flags, &info) != 0;
10110 return (uchar)(size_t)HEXDSP(hx_locate_lvar, out, func_ea, varname) != 0;
10116 return (uchar)(size_t)HEXDSP(hx_restore_user_defined_calls, udcalls, func_ea) != 0;
10122 HEXDSP(hx_save_user_defined_calls, func_ea, &udcalls);
10128 return (uchar)(size_t)HEXDSP(hx_parse_user_call, udc, decl, silent) != 0;
10134 return (
merror_t)(size_t)HEXDSP(hx_convert_to_user_call, &udc, &cdg);
10140 auto hrdsp = HEXDSP;
10141 return hrdsp !=
nullptr && (uchar)(
size_t)hrdsp(hx_install_microcode_filter, filter, install) != 0;
10147 HEXDSP(hx_udc_filter_t_cleanup,
this);
10151inline bool udc_filter_t::init(
const char *decl)
10153 return (uchar)(size_t)HEXDSP(hx_udc_filter_t_init,
this, decl) != 0;
10159 return (
merror_t)(size_t)HEXDSP(hx_udc_filter_t_apply,
this, &cdg);
10163inline bitset_t::bitset_t(
const bitset_t &m)
10165 HEXDSP(hx_bitset_t_bitset_t,
this, &m);
10171 return *(
bitset_t *)HEXDSP(hx_bitset_t_copy,
this, &m);
10175inline bool bitset_t::add(
int bit)
10177 return (uchar)(size_t)HEXDSP(hx_bitset_t_add,
this, bit) != 0;
10181inline bool bitset_t::add(
int bit,
int width)
10183 return (uchar)(size_t)HEXDSP(hx_bitset_t_add_,
this, bit, width) != 0;
10187inline bool bitset_t::add(
const bitset_t &ml)
10189 return (uchar)(size_t)HEXDSP(hx_bitset_t_add__,
this, &ml) != 0;
10193inline bool bitset_t::sub(
int bit)
10195 return (uchar)(size_t)HEXDSP(hx_bitset_t_sub,
this, bit) != 0;
10199inline bool bitset_t::sub(
int bit,
int width)
10201 return (uchar)(size_t)HEXDSP(hx_bitset_t_sub_,
this, bit, width) != 0;
10205inline bool bitset_t::sub(
const bitset_t &ml)
10207 return (uchar)(size_t)HEXDSP(hx_bitset_t_sub__,
this, &ml) != 0;
10211inline bool bitset_t::cut_at(
int maxbit)
10213 return (uchar)(size_t)HEXDSP(hx_bitset_t_cut_at,
this, maxbit) != 0;
10217inline void bitset_t::shift_down(
int shift)
10219 HEXDSP(hx_bitset_t_shift_down,
this, shift);
10223inline bool bitset_t::has(
int bit)
const
10225 return (uchar)(size_t)HEXDSP(hx_bitset_t_has,
this, bit) != 0;
10229inline bool bitset_t::has_all(
int bit,
int width)
const
10231 return (uchar)(size_t)HEXDSP(hx_bitset_t_has_all,
this, bit, width) != 0;
10235inline bool bitset_t::has_any(
int bit,
int width)
const
10237 return (uchar)(size_t)HEXDSP(hx_bitset_t_has_any,
this, bit, width) != 0;
10241inline const char *bitset_t::dstr()
const
10243 return (
const char *)HEXDSP(hx_bitset_t_dstr,
this);
10247inline bool bitset_t::empty()
const
10249 return (uchar)(size_t)HEXDSP(hx_bitset_t_empty,
this) != 0;
10253inline int bitset_t::count()
const
10255 return (
int)(size_t)HEXDSP(hx_bitset_t_count,
this);
10259inline int bitset_t::count(
int bit)
const
10261 return (
int)(size_t)HEXDSP(hx_bitset_t_count_,
this, bit);
10265inline int bitset_t::last()
const
10267 return (
int)(size_t)HEXDSP(hx_bitset_t_last,
this);
10271inline void bitset_t::fill_with_ones(
int maxbit)
10273 HEXDSP(hx_bitset_t_fill_with_ones,
this, maxbit);
10277inline bool bitset_t::fill_gaps(
int total_nbits)
10279 return (uchar)(size_t)HEXDSP(hx_bitset_t_fill_gaps,
this, total_nbits) != 0;
10283inline bool bitset_t::has_common(
const bitset_t &ml)
const
10285 return (uchar)(size_t)HEXDSP(hx_bitset_t_has_common,
this, &ml) != 0;
10289inline bool bitset_t::intersect(
const bitset_t &ml)
10291 return (uchar)(size_t)HEXDSP(hx_bitset_t_intersect,
this, &ml) != 0;
10295inline bool bitset_t::is_subset_of(
const bitset_t &ml)
const
10297 return (uchar)(size_t)HEXDSP(hx_bitset_t_is_subset_of,
this, &ml) != 0;
10301inline int bitset_t::compare(
const bitset_t &r)
const
10303 return (
int)(size_t)HEXDSP(hx_bitset_t_compare,
this, &r);
10307inline int bitset_t::goup(
int reg)
const
10309 return (
int)(size_t)HEXDSP(hx_bitset_t_goup,
this, reg);
10313inline const char *ivl_t::dstr()
const
10315 return (
const char *)HEXDSP(hx_ivl_t_dstr,
this);
10319inline int ivl_t::compare(
const ivl_t &r)
const
10321 return (
int)(size_t)HEXDSP(hx_ivl_t_compare,
this, &r);
10325inline bool ivlset_t::add(
const ivl_t &ivl)
10327 return (uchar)(size_t)HEXDSP(hx_ivlset_t_add,
this, &ivl) != 0;
10331inline bool ivlset_t::add(
const ivlset_t &ivs)
10333 return (uchar)(size_t)HEXDSP(hx_ivlset_t_add_,
this, &ivs) != 0;
10337inline bool ivlset_t::addmasked(
const ivlset_t &ivs,
const ivl_t &mask)
10339 return (uchar)(size_t)HEXDSP(hx_ivlset_t_addmasked,
this, &ivs, &mask) != 0;
10343inline bool ivlset_t::sub(
const ivl_t &ivl)
10345 return (uchar)(size_t)HEXDSP(hx_ivlset_t_sub,
this, &ivl) != 0;
10349inline bool ivlset_t::sub(
const ivlset_t &ivs)
10351 return (uchar)(size_t)HEXDSP(hx_ivlset_t_sub_,
this, &ivs) != 0;
10355inline bool ivlset_t::has_common(
const ivl_t &ivl,
bool strict)
const
10357 return (uchar)(size_t)HEXDSP(hx_ivlset_t_has_common,
this, &ivl, strict) != 0;
10361inline void ivlset_t::print(qstring *vout)
const
10363 HEXDSP(hx_ivlset_t_print,
this, vout);
10367inline const char *ivlset_t::dstr()
const
10369 return (
const char *)HEXDSP(hx_ivlset_t_dstr,
this);
10373inline asize_t ivlset_t::count()
const
10376 HEXDSP(hx_ivlset_t_count, &retval,
this);
10381inline bool ivlset_t::has_common(
const ivlset_t &ivs)
const
10383 return (uchar)(size_t)HEXDSP(hx_ivlset_t_has_common_,
this, &ivs) != 0;
10387inline bool ivlset_t::contains(uval_t off)
const
10389 return (uchar)(size_t)HEXDSP(hx_ivlset_t_contains,
this, off) != 0;
10393inline bool ivlset_t::includes(
const ivlset_t &ivs)
const
10395 return (uchar)(size_t)HEXDSP(hx_ivlset_t_includes,
this, &ivs) != 0;
10399inline bool ivlset_t::intersect(
const ivlset_t &ivs)
10401 return (uchar)(size_t)HEXDSP(hx_ivlset_t_intersect,
this, &ivs) != 0;
10405inline int ivlset_t::compare(
const ivlset_t &r)
const
10407 return (
int)(size_t)HEXDSP(hx_ivlset_t_compare,
this, &r);
10411inline void rlist_t::print(qstring *vout)
const
10413 HEXDSP(hx_rlist_t_print,
this, vout);
10417inline const char *rlist_t::dstr()
const
10419 return (
const char *)HEXDSP(hx_rlist_t_dstr,
this);
10423inline bool mlist_t::addmem(ea_t ea, asize_t size)
10425 return (uchar)(size_t)HEXDSP(hx_mlist_t_addmem,
this, ea, size) != 0;
10429inline void mlist_t::print(qstring *vout)
const
10431 HEXDSP(hx_mlist_t_print,
this, vout);
10435inline const char *mlist_t::dstr()
const
10437 return (
const char *)HEXDSP(hx_mlist_t_dstr,
this);
10441inline int mlist_t::compare(
const mlist_t &r)
const
10443 return (
int)(size_t)HEXDSP(hx_mlist_t_compare,
this, &r);
10449 return *(
const mlist_t *)HEXDSP(hx_get_temp_regs);
10455 return (uchar)(size_t)HEXDSP(hx_is_kreg, r) != 0;
10461 return (
mreg_t)(size_t)HEXDSP(hx_reg2mreg, reg);
10467 return (
int)(size_t)HEXDSP(hx_mreg2reg, reg, width);
10473 return (
int)(size_t)HEXDSP(hx_get_mreg_name, out, reg, width, ud);
10479 HEXDSP(hx_install_optinsn_handler, opt);
10485 auto hrdsp = HEXDSP;
10486 return hrdsp !=
nullptr && (uchar)(
size_t)hrdsp(hx_remove_optinsn_handler, opt) != 0;
10492 HEXDSP(hx_install_optblock_handler, opt);
10498 auto hrdsp = HEXDSP;
10499 return hrdsp !=
nullptr && (uchar)(
size_t)hrdsp(hx_remove_optblock_handler, opt) != 0;
10503inline int lvar_ref_t::compare(
const lvar_ref_t &r)
const
10505 return (
int)(size_t)HEXDSP(hx_lvar_ref_t_compare,
this, &r);
10511 return *(
lvar_t *)HEXDSP(hx_lvar_ref_t_var,
this);
10515inline int stkvar_ref_t::compare(
const stkvar_ref_t &r)
const
10517 return (
int)(size_t)HEXDSP(hx_stkvar_ref_t_compare,
this, &r);
10523 return (member_t *)HEXDSP(hx_stkvar_ref_t_get_stkvar,
this, p_off);
10527inline void fnumber_t::print(qstring *vout)
const
10529 HEXDSP(hx_fnumber_t_print,
this, vout);
10533inline const char *fnumber_t::dstr()
const
10535 return (
const char *)HEXDSP(hx_fnumber_t_dstr,
this);
10539inline void mop_t::copy(
const mop_t &rop)
10541 HEXDSP(hx_mop_t_copy,
this, &rop);
10545inline mop_t &mop_t::assign(
const mop_t &rop)
10547 return *(
mop_t *)HEXDSP(hx_mop_t_assign,
this, &rop);
10551inline void mop_t::swap(
mop_t &rop)
10553 HEXDSP(hx_mop_t_swap,
this, &rop);
10557inline void mop_t::erase()
10559 HEXDSP(hx_mop_t_erase,
this);
10563inline void mop_t::print(qstring *vout,
int shins_flags)
const
10565 HEXDSP(hx_mop_t_print,
this, vout, shins_flags);
10569inline const char *mop_t::dstr()
const
10571 return (
const char *)HEXDSP(hx_mop_t_dstr,
this);
10577 return (uchar)(size_t)HEXDSP(hx_mop_t_create_from_mlist,
this, mba, &lst, fullsize) != 0;
10583 return (uchar)(size_t)HEXDSP(hx_mop_t_create_from_ivlset,
this, mba, &ivs, fullsize) != 0;
10589 HEXDSP(hx_mop_t_create_from_vdloc,
this, mba, &loc, _size);
10595 HEXDSP(hx_mop_t_create_from_scattered_vdloc,
this, mba, name, &type, &loc);
10601 HEXDSP(hx_mop_t_create_from_insn,
this, m);
10607 HEXDSP(hx_mop_t_make_number,
this, _value, _size, _ea, opnum);
10613 return (uchar)(size_t)HEXDSP(hx_mop_t_make_fpnum,
this, bytes, _size) != 0;
10619 HEXDSP(hx_mop_t__make_gvar,
this, ea);
10625 HEXDSP(hx_mop_t_make_gvar,
this, ea);
10631 HEXDSP(hx_mop_t_make_reg_pair,
this, loreg, hireg, halfsize);
10637 HEXDSP(hx_mop_t_make_helper,
this, name);
10643 return (uchar)(size_t)HEXDSP(hx_mop_t_is_bit_reg, reg) != 0;
10649 return (uchar)(size_t)HEXDSP(hx_mop_t_may_use_aliased_memory,
this) != 0;
10655 return (uchar)(size_t)HEXDSP(hx_mop_t_is01,
this) != 0;
10661 return (uchar)(size_t)HEXDSP(hx_mop_t_is_sign_extended_from,
this, nbytes) != 0;
10667 return (uchar)(size_t)HEXDSP(hx_mop_t_is_zero_extended_from,
this, nbytes) != 0;
10673 return (uchar)(size_t)HEXDSP(hx_mop_t_equal_mops,
this, &rop, eqflags) != 0;
10677inline int mop_t::lexcompare(
const mop_t &rop)
const
10679 return (
int)(size_t)HEXDSP(hx_mop_t_lexcompare,
this, &rop);
10685 return (
int)(size_t)HEXDSP(hx_mop_t_for_all_ops,
this, &mv, type, is_target);
10691 return (
int)(size_t)HEXDSP(hx_mop_t_for_all_scattered_submops,
this, &sv);
10697 return (uchar)(size_t)HEXDSP(hx_mop_t_is_constant,
this, out, is_signed) != 0;
10703 return (uchar)(size_t)HEXDSP(hx_mop_t_get_stkoff,
this, p_off) != 0;
10709 return (uchar)(size_t)HEXDSP(hx_mop_t_make_low_half,
this, width) != 0;
10715 return (uchar)(size_t)HEXDSP(hx_mop_t_make_high_half,
this, width) != 0;
10721 return (uchar)(size_t)HEXDSP(hx_mop_t_make_first_half,
this, width) != 0;
10727 return (uchar)(size_t)HEXDSP(hx_mop_t_make_second_half,
this, width) != 0;
10733 return (uchar)(size_t)HEXDSP(hx_mop_t_shift_mop,
this, offset) != 0;
10739 return (uchar)(size_t)HEXDSP(hx_mop_t_change_size,
this, nsize, sideff) != 0;
10745 return (uchar)(size_t)HEXDSP(hx_mop_t_preserve_side_effects,
this, blk, top, moved_calls) != 0;
10751 HEXDSP(hx_mop_t_apply_ld_mcode,
this, mcode, ea, newsize);
10755inline void mcallarg_t::print(qstring *vout,
int shins_flags)
const
10757 HEXDSP(hx_mcallarg_t_print,
this, vout, shins_flags);
10761inline const char *mcallarg_t::dstr()
const
10763 return (
const char *)HEXDSP(hx_mcallarg_t_dstr,
this);
10767inline void mcallarg_t::set_regarg(
mreg_t mr,
int sz,
const tinfo_t &tif)
10769 HEXDSP(hx_mcallarg_t_set_regarg,
this, mr, sz, &tif);
10773inline int mcallinfo_t::lexcompare(
const mcallinfo_t &f)
const
10775 return (
int)(size_t)HEXDSP(hx_mcallinfo_t_lexcompare,
this, &f);
10779inline bool mcallinfo_t::set_type(
const tinfo_t &type)
10781 return (uchar)(size_t)HEXDSP(hx_mcallinfo_t_set_type,
this, &type) != 0;
10785inline tinfo_t mcallinfo_t::get_type()
const
10788 HEXDSP(hx_mcallinfo_t_get_type, &retval,
this);
10793inline void mcallinfo_t::print(qstring *vout,
int size,
int shins_flags)
const
10795 HEXDSP(hx_mcallinfo_t_print,
this, vout, size, shins_flags);
10799inline const char *mcallinfo_t::dstr()
const
10801 return (
const char *)HEXDSP(hx_mcallinfo_t_dstr,
this);
10805inline int mcases_t::compare(
const mcases_t &r)
const
10807 return (
int)(size_t)HEXDSP(hx_mcases_t_compare,
this, &r);
10811inline void mcases_t::print(qstring *vout)
const
10813 HEXDSP(hx_mcases_t_print,
this, vout);
10817inline const char *mcases_t::dstr()
const
10819 return (
const char *)HEXDSP(hx_mcases_t_dstr,
this);
10825 return (uchar)(size_t)HEXDSP(hx_vivl_t_extend_to_cover,
this, &r) != 0;
10832 HEXDSP(hx_vivl_t_intersect, &retval,
this, &r);
10837inline void vivl_t::print(qstring *vout)
const
10839 HEXDSP(hx_vivl_t_print,
this, vout);
10843inline const char *vivl_t::dstr()
const
10845 return (
const char *)HEXDSP(hx_vivl_t_dstr,
this);
10849inline void chain_t::print(qstring *vout)
const
10851 HEXDSP(hx_chain_t_print,
this, vout);
10855inline const char *chain_t::dstr()
const
10857 return (
const char *)HEXDSP(hx_chain_t_dstr,
this);
10863 HEXDSP(hx_chain_t_append_list,
this, mba, list);
10869 return (
const chain_t *)HEXDSP(hx_block_chains_t_get_chain,
this, &ch);
10873inline void block_chains_t::print(qstring *vout)
const
10875 HEXDSP(hx_block_chains_t_print,
this, vout);
10879inline const char *block_chains_t::dstr()
const
10881 return (
const char *)HEXDSP(hx_block_chains_t_dstr,
this);
10887 return (
int)(size_t)HEXDSP(hx_graph_chains_t_for_all_chains,
this, &cv, gca_flags);
10893 HEXDSP(hx_graph_chains_t_release,
this);
10897inline void minsn_t::init(ea_t _ea)
10899 HEXDSP(hx_minsn_t_init,
this, _ea);
10903inline void minsn_t::copy(
const minsn_t &m)
10905 HEXDSP(hx_minsn_t_copy,
this, &m);
10909inline void minsn_t::set_combined()
10911 HEXDSP(hx_minsn_t_set_combined,
this);
10917 HEXDSP(hx_minsn_t_swap,
this, &m);
10923 HEXDSP(hx_minsn_t_print,
this, vout, shins_flags);
10929 return (
const char *)HEXDSP(hx_minsn_t_dstr,
this);
10935 HEXDSP(hx_minsn_t_setaddr,
this, new_ea);
10941 return (
int)(size_t)HEXDSP(hx_minsn_t_optimize_subtree,
this, blk, top, parent, converted_call, optflags);
10947 return (
int)(size_t)HEXDSP(hx_minsn_t_for_all_ops,
this, &mv);
10953 return (
int)(size_t)HEXDSP(hx_minsn_t_for_all_insns,
this, &mv);
10959 HEXDSP(hx_minsn_t__make_nop,
this);
10965 return (uchar)(size_t)HEXDSP(hx_minsn_t_equal_insns,
this, &m, eqflags) != 0;
10969inline int minsn_t::lexcompare(
const minsn_t &ri)
const
10971 return (
int)(size_t)HEXDSP(hx_minsn_t_lexcompare,
this, &ri);
10977 return (uchar)(size_t)HEXDSP(hx_minsn_t_is_noret_call,
this, flags) != 0;
10983 return (uchar)(size_t)HEXDSP(hx_minsn_t_is_helper,
this, name) != 0;
10989 return (
minsn_t *)HEXDSP(hx_minsn_t_find_call,
this, with_helpers);
10995 return (uchar)(size_t)HEXDSP(hx_minsn_t_has_side_effects,
this, include_ldx_and_divs) != 0;
11001 return (
minsn_t *)HEXDSP(hx_minsn_t_find_opcode,
this, mcode);
11007 return (
const minsn_t *)HEXDSP(hx_minsn_t_find_ins_op,
this, other, op);
11013 return (
const mop_t *)HEXDSP(hx_minsn_t_find_num_op,
this, other);
11019 return (uchar)(size_t)HEXDSP(hx_minsn_t_modifies_d,
this) != 0;
11025 return (uchar)(size_t)HEXDSP(hx_minsn_t_is_between,
this, m1, m2) != 0;
11031 return (uchar)(size_t)HEXDSP(hx_minsn_t_may_use_aliased_memory,
this) != 0;
11037 return (
int)(size_t)HEXDSP(hx_minsn_t_serialize,
this, b);
11043 return (uchar)(size_t)HEXDSP(hx_minsn_t_deserialize,
this, bytes, nbytes, format_version) != 0;
11049 return (
const minsn_t *)HEXDSP(hx_getf_reginsn, ins);
11055 return (
const minsn_t *)HEXDSP(hx_getb_reginsn, ins);
11059inline void mblock_t::init()
11061 HEXDSP(hx_mblock_t_init,
this);
11067 HEXDSP(hx_mblock_t_print,
this, &vp);
11073 HEXDSP(hx_mblock_t_dump,
this);
11077inline AS_PRINTF(2, 0) void
mblock_t::vdump_block(const
char *title, va_list va)
const
11079 HEXDSP(hx_mblock_t_vdump_block,
this, title, va);
11085 return (
minsn_t *)HEXDSP(hx_mblock_t_insert_into_block,
this, nm, om);
11091 return (
minsn_t *)HEXDSP(hx_mblock_t_remove_from_block,
this, m);
11097 return (
int)(size_t)HEXDSP(hx_mblock_t_for_all_insns,
this, &mv);
11103 return (
int)(size_t)HEXDSP(hx_mblock_t_for_all_ops,
this, &mv);
11109 return (
int)(size_t)HEXDSP(hx_mblock_t_for_all_uses,
this, list, i1, i2, &mmv);
11115 return (
int)(size_t)HEXDSP(hx_mblock_t_optimize_insn,
this, m, optflags);
11121 return (
int)(size_t)HEXDSP(hx_mblock_t_optimize_block,
this);
11127 return (
int)(size_t)HEXDSP(hx_mblock_t_build_lists,
this, kill_deads);
11133 return (
int)(size_t)HEXDSP(hx_mblock_t_optimize_useless_jump,
this);
11139 HEXDSP(hx_mblock_t_append_use_list,
this, list, &op, maymust, &mask);
11145 HEXDSP(hx_mblock_t_append_def_list,
this, list, &op, maymust);
11152 HEXDSP(hx_mblock_t_build_use_list, &retval,
this, &ins, maymust);
11160 HEXDSP(hx_mblock_t_build_def_list, &retval,
this, &ins, maymust);
11167 return (
const minsn_t *)HEXDSP(hx_mblock_t_find_first_use,
this, list, i1, i2, maymust);
11173 return (
const minsn_t *)HEXDSP(hx_mblock_t_find_redefinition,
this, &list, i1, i2, maymust);
11179 return (uchar)(size_t)HEXDSP(hx_mblock_t_is_rhs_redefined,
this, ins, i1, i2) != 0;
11185 return (
minsn_t *)HEXDSP(hx_mblock_t_find_access,
this, &op, parent, mend, fdflags);
11191 return (uchar)(size_t)HEXDSP(hx_mblock_t_get_valranges,
this, res, &vivl, vrflags) != 0;
11197 return (uchar)(size_t)HEXDSP(hx_mblock_t_get_valranges_,
this, res, &vivl, m, vrflags) != 0;
11203 return (
size_t)HEXDSP(hx_mblock_t_get_reginsn_qty,
this);
11207inline bool mba_ranges_t::range_contains(ea_t ea)
const
11209 return (uchar)(size_t)HEXDSP(hx_mba_ranges_t_range_contains,
this, ea) != 0;
11213inline sval_t mba_t::stkoff_vd2ida(sval_t off)
const
11216 HEXDSP(hx_mba_t_stkoff_vd2ida, &retval,
this, off);
11221inline sval_t mba_t::stkoff_ida2vd(sval_t off)
const
11224 HEXDSP(hx_mba_t_stkoff_ida2vd, &retval,
this, off);
11229inline vdloc_t mba_t::idaloc2vd(
const argloc_t &loc,
int width, sval_t spd)
11232 HEXDSP(hx_mba_t_idaloc2vd, &retval, &loc, width, spd);
11237inline vdloc_t mba_t::idaloc2vd(
const argloc_t &loc,
int width)
const
11240 HEXDSP(hx_mba_t_idaloc2vd_, &retval,
this, &loc, width);
11245inline argloc_t mba_t::vd2idaloc(
const vdloc_t &loc,
int width, sval_t spd)
11248 HEXDSP(hx_mba_t_vd2idaloc, &retval, &loc, width, spd);
11253inline argloc_t mba_t::vd2idaloc(
const vdloc_t &loc,
int width)
const
11256 HEXDSP(hx_mba_t_vd2idaloc_, &retval,
this, &loc, width);
11261inline void mba_t::term()
11263 HEXDSP(hx_mba_t_term,
this);
11267inline func_t *mba_t::get_curfunc()
const
11269 return (func_t *)HEXDSP(hx_mba_t_get_curfunc,
this);
11275 return (uchar)(size_t)HEXDSP(hx_mba_t_set_maturity,
this, mat) != 0;
11281 return (
int)(size_t)HEXDSP(hx_mba_t_optimize_local,
this, locopt_bits);
11287 return (
merror_t)(size_t)HEXDSP(hx_mba_t_build_graph,
this);
11293 return (
mbl_graph_t *)HEXDSP(hx_mba_t_get_graph,
this);
11299 return (
int)(size_t)HEXDSP(hx_mba_t_analyze_calls,
this, acflags);
11305 return (
merror_t)(size_t)HEXDSP(hx_mba_t_optimize_global,
this);
11311 HEXDSP(hx_mba_t_alloc_lvars,
this);
11317 HEXDSP(hx_mba_t_dump,
this);
11321inline AS_PRINTF(3, 0) void
mba_t::vdump_mba(
bool _verify, const
char *title, va_list va)
const
11323 HEXDSP(hx_mba_t_vdump_mba,
this, _verify, title, va);
11329 HEXDSP(hx_mba_t_print,
this, &vp);
11335 HEXDSP(hx_mba_t_verify,
this, always);
11341 HEXDSP(hx_mba_t_mark_chains_dirty,
this);
11347 return (
mblock_t *)HEXDSP(hx_mba_t_insert_block,
this, bblk);
11353 return (uchar)(size_t)HEXDSP(hx_mba_t_remove_block,
this, blk) != 0;
11359 return (
mblock_t *)HEXDSP(hx_mba_t_copy_block,
this, blk, new_serial, cpblk_flags);
11365 return (uchar)(size_t)HEXDSP(hx_mba_t_remove_empty_and_unreachable_blocks,
this) != 0;
11371 return (uchar)(size_t)HEXDSP(hx_mba_t_combine_blocks,
this) != 0;
11377 return (
int)(size_t)HEXDSP(hx_mba_t_for_all_ops,
this, &mv);
11383 return (
int)(size_t)HEXDSP(hx_mba_t_for_all_insns,
this, &mv);
11389 return (
int)(size_t)HEXDSP(hx_mba_t_for_all_topinsns,
this, &mv);
11395 return (
mop_t *)HEXDSP(hx_mba_t_find_mop,
this, ctx, ea, is_dest, &list);
11401 return (
minsn_t *)HEXDSP(hx_mba_t_create_helper_call,
this, ea, helper, rettype, callargs, out);
11407 HEXDSP(hx_mba_t_get_func_output_lists,
this, return_regs, spoiled, &type, call_ea, tail_call);
11413 return *(
lvar_t *)HEXDSP(hx_mba_t_arg,
this, n);
11420 HEXDSP(hx_mba_t_alloc_fict_ea, &retval,
this, real_ea);
11428 HEXDSP(hx_mba_t_map_fict_ea, &retval,
this, fict_ea);
11435 HEXDSP(hx_mba_t_serialize,
this, &vout);
11441 return (
mba_t *)HEXDSP(hx_mba_t_deserialize, bytes, nbytes);
11447 HEXDSP(hx_mba_t_save_snapshot,
this, description);
11453 return (
mreg_t)(size_t)HEXDSP(hx_mba_t_alloc_kreg,
this, size, check_size);
11459 HEXDSP(hx_mba_t_free_kreg,
this, reg, size);
11463inline bool mba_t::set_lvar_name(
lvar_t &v,
const char *name,
int flagbits)
11465 return (uchar)(size_t)HEXDSP(hx_mba_t_set_lvar_name,
this, &v, name, flagbits) != 0;
11469inline bool mbl_graph_t::is_accessed_globally(
const mlist_t &list,
int b1,
int b2,
const minsn_t *m1,
const minsn_t *m2, access_type_t access_type, maymust_t maymust)
const
11471 return (uchar)(size_t)HEXDSP(hx_mbl_graph_t_is_accessed_globally,
this, &list, b1, b2, m1, m2, access_type, maymust) != 0;
11477 return (
graph_chains_t *)HEXDSP(hx_mbl_graph_t_get_ud,
this, gctype);
11483 return (
graph_chains_t *)HEXDSP(hx_mbl_graph_t_get_du,
this, gctype);
11487inline merror_t cdg_insn_iterator_t::next(insn_t *ins)
11489 return (
merror_t)(size_t)HEXDSP(hx_cdg_insn_iterator_t_next,
this, ins);
11495 return (
minsn_t *)HEXDSP(hx_codegen_t_emit,
this, code, width, l, r, d, offsize);
11501 return (
minsn_t *)HEXDSP(hx_codegen_t_emit_,
this, code, l, r, d);
11507 return (uchar)(size_t)HEXDSP(hx_change_hexrays_config, directive) != 0;
11513 return (
const char *)HEXDSP(hx_get_hexrays_version);
11519 return (uchar)(size_t)HEXDSP(hx_checkout_hexrays_license, silent) != 0;
11525 return (
vdui_t *)HEXDSP(hx_open_pseudocode, ea, flags);
11531 return (uchar)(size_t)HEXDSP(hx_close_pseudocode, f) != 0;
11537 return (
vdui_t *)HEXDSP(hx_get_widget_vdui, f);
11543 return (uchar)(size_t)HEXDSP(hx_decompile_many, outfile, funcaddrs, flags) != 0;
11547inline qstring hexrays_failure_t::desc()
const
11550 HEXDSP(hx_hexrays_failure_t_desc, &retval,
this);
11557 HEXDSP(hx_send_database, &err, silent);
11563 return (uchar)(size_t)HEXDSP(hx_gco_info_t_append_to_list,
this, list, mba) != 0;
11569 return (uchar)(size_t)HEXDSP(hx_get_current_operand, out) != 0;
11573inline void remitem(
const citem_t *e)
11575 HEXDSP(hx_remitem, e);
11581 return (
ctype_t)(size_t)HEXDSP(hx_negated_relation, op);
11587 return (
ctype_t)(size_t)HEXDSP(hx_swapped_relation, op);
11593 return (type_sign_t)(size_t)HEXDSP(hx_get_op_signness, op);
11599 return (
ctype_t)(size_t)HEXDSP(hx_asgop, cop);
11605 return (
ctype_t)(size_t)HEXDSP(hx_asgop_revert, cop);
11611 HEXDSP(hx_cnumber_t_print,
this, vout, &type, parent, nice_stroff);
11618 HEXDSP(hx_cnumber_t_value, &retval,
this, &type);
11625 HEXDSP(hx_cnumber_t_assign,
this, v, nbytes, sign);
11629inline int cnumber_t::compare(
const cnumber_t &r)
const
11631 return (
int)(size_t)HEXDSP(hx_cnumber_t_compare,
this, &r);
11635inline int var_ref_t::compare(
const var_ref_t &r)
const
11637 return (
int)(size_t)HEXDSP(hx_var_ref_t_compare,
this, &r);
11643 return (
int)(size_t)HEXDSP(hx_ctree_visitor_t_apply_to,
this, item, parent);
11649 return (
int)(size_t)HEXDSP(hx_ctree_visitor_t_apply_to_exprs,
this, item, parent);
11655 return (uchar)(size_t)HEXDSP(hx_ctree_parentee_t_recalc_parent_types,
this) != 0;
11661 return (uchar)(size_t)HEXDSP(hx_cfunc_parentee_t_calc_rvalue_type,
this, target, e) != 0;
11667 return (
int)(size_t)HEXDSP(hx_citem_locator_t_compare,
this, &r);
11673 return (uchar)(size_t)HEXDSP(hx_citem_t_contains_expr,
this, e) != 0;
11679 return (uchar)(size_t)HEXDSP(hx_citem_t_contains_label,
this) != 0;
11685 return (
const citem_t *)HEXDSP(hx_citem_t_find_parent_of,
this, sitem);
11689inline citem_t *citem_t::find_closest_addr(ea_t _ea)
11691 return (
citem_t *)HEXDSP(hx_citem_t_find_closest_addr,
this, _ea);
11697 return *(
cexpr_t *)HEXDSP(hx_cexpr_t_assign,
this, &r);
11701inline int cexpr_t::compare(
const cexpr_t &r)
const
11703 return (
int)(size_t)HEXDSP(hx_cexpr_t_compare,
this, &r);
11709 HEXDSP(hx_cexpr_t_replace_by,
this, r);
11715 HEXDSP(hx_cexpr_t_cleanup,
this);
11721 HEXDSP(hx_cexpr_t_put_number,
this, func, value, nbytes, sign);
11727 HEXDSP(hx_cexpr_t_print1,
this, vout, func);
11733 HEXDSP(hx_cexpr_t_calc_type,
this, recursive);
11739 return (uchar)(size_t)HEXDSP(hx_cexpr_t_equal_effect,
this, &r) != 0;
11745 return (uchar)(size_t)HEXDSP(hx_cexpr_t_is_child_of,
this, parent) != 0;
11751 return (uchar)(size_t)HEXDSP(hx_cexpr_t_contains_operator,
this, needed_op, times) != 0;
11758 HEXDSP(hx_cexpr_t_get_high_nbit_bound, &retval,
this);
11765 return (
int)(size_t)HEXDSP(hx_cexpr_t_get_low_nbit_bound,
this);
11771 return (uchar)(size_t)HEXDSP(hx_cexpr_t_requires_lvalue,
this, child) != 0;
11777 return (uchar)(size_t)HEXDSP(hx_cexpr_t_has_side_effects,
this) != 0;
11783 return (uchar)(size_t)HEXDSP(hx_cexpr_t_maybe_ptr,
this) != 0;
11787inline const char *cexpr_t::dstr()
const
11789 return (
const char *)HEXDSP(hx_cexpr_t_dstr,
this);
11795 return *(
cif_t *)HEXDSP(hx_cif_t_assign,
this, &r);
11799inline int cif_t::compare(
const cif_t &r)
const
11801 return (
int)(size_t)HEXDSP(hx_cif_t_compare,
this, &r);
11807 return *(
cloop_t *)HEXDSP(hx_cloop_t_assign,
this, &r);
11811inline int cfor_t::compare(
const cfor_t &r)
const
11813 return (
int)(size_t)HEXDSP(hx_cfor_t_compare,
this, &r);
11817inline int cwhile_t::compare(
const cwhile_t &r)
const
11819 return (
int)(size_t)HEXDSP(hx_cwhile_t_compare,
this, &r);
11823inline int cdo_t::compare(
const cdo_t &r)
const
11825 return (
int)(size_t)HEXDSP(hx_cdo_t_compare,
this, &r);
11829inline int creturn_t::compare(
const creturn_t &r)
const
11831 return (
int)(size_t)HEXDSP(hx_creturn_t_compare,
this, &r);
11835inline int cgoto_t::compare(
const cgoto_t &r)
const
11837 return (
int)(size_t)HEXDSP(hx_cgoto_t_compare,
this, &r);
11841inline int casm_t::compare(
const casm_t &r)
const
11843 return (
int)(size_t)HEXDSP(hx_casm_t_compare,
this, &r);
11849 return *(
cinsn_t *)HEXDSP(hx_cinsn_t_assign,
this, &r);
11853inline int cinsn_t::compare(
const cinsn_t &r)
const
11855 return (
int)(size_t)HEXDSP(hx_cinsn_t_compare,
this, &r);
11861 HEXDSP(hx_cinsn_t_replace_by,
this, r);
11867 HEXDSP(hx_cinsn_t_cleanup,
this);
11873 return *(
cinsn_t *)HEXDSP(hx_cinsn_t_new_insn,
this, insn_ea);
11879 return *(
cif_t *)HEXDSP(hx_cinsn_t_create_if,
this, cnd);
11885 HEXDSP(hx_cinsn_t_print,
this, indent, &vp, use_curly);
11891 HEXDSP(hx_cinsn_t_print1,
this, vout, func);
11897 return (uchar)(size_t)HEXDSP(hx_cinsn_t_is_ordinary_flow,
this) != 0;
11903 return (uchar)(size_t)HEXDSP(hx_cinsn_t_contains_insn,
this, type, times) != 0;
11909 return (uchar)(size_t)HEXDSP(hx_cinsn_t_collect_free_breaks,
this, breaks) != 0;
11915 return (uchar)(size_t)HEXDSP(hx_cinsn_t_collect_free_continues,
this, continues) != 0;
11919inline const char *cinsn_t::dstr()
const
11921 return (
const char *)HEXDSP(hx_cinsn_t_dstr,
this);
11925inline int cblock_t::compare(
const cblock_t &r)
const
11927 return (
int)(size_t)HEXDSP(hx_cblock_t_compare,
this, &r);
11931inline int carglist_t::compare(
const carglist_t &r)
const
11933 return (
int)(size_t)HEXDSP(hx_carglist_t_compare,
this, &r);
11937inline int ccase_t::compare(
const ccase_t &r)
const
11939 return (
int)(size_t)HEXDSP(hx_ccase_t_compare,
this, &r);
11943inline int ccases_t::compare(
const ccases_t &r)
const
11945 return (
int)(size_t)HEXDSP(hx_ccases_t_compare,
this, &r);
11949inline int cswitch_t::compare(
const cswitch_t &r)
const
11951 return (
int)(size_t)HEXDSP(hx_cswitch_t_compare,
this, &r);
11957 return (member_t *)HEXDSP(hx_ctree_item_t_get_memptr,
this, p_sptr);
11963 return (
int)(size_t)HEXDSP(hx_ctree_item_t_get_udm,
this, udm, parent, p_offset);
11969 return (
int)(size_t)HEXDSP(hx_ctree_item_t_get_edm,
this, parent);
11975 return (
lvar_t *)HEXDSP(hx_ctree_item_t_get_lvar,
this);
11982 HEXDSP(hx_ctree_item_t_get_ea, &retval,
this);
11989 return (
int)(size_t)HEXDSP(hx_ctree_item_t_get_label_num,
this, gln_flags);
11993inline void ctree_item_t::print(qstring *vout)
const
11995 HEXDSP(hx_ctree_item_t_print,
this, vout);
11999inline const char *ctree_item_t::dstr()
const
12001 return (
const char *)HEXDSP(hx_ctree_item_t_dstr,
this);
12007 return (
cexpr_t *)HEXDSP(hx_lnot, e);
12013 return (
cinsn_t *)HEXDSP(hx_new_block);
12017inline AS_PRINTF(3, 0)
cexpr_t *vcreate_helper(
bool standalone, const tinfo_t &type, const
char *format, va_list va)
12019 return (
cexpr_t *)HEXDSP(hx_vcreate_helper, standalone, &type, format, va);
12023inline AS_PRINTF(3, 0)
cexpr_t *vcall_helper(const tinfo_t &rettype,
carglist_t *args, const
char *format, va_list va)
12025 return (
cexpr_t *)HEXDSP(hx_vcall_helper, &rettype, args, format, va);
12031 return (
cexpr_t *)HEXDSP(hx_make_num, n, func, ea, opnum, sign, size);
12037 return (
cexpr_t *)HEXDSP(hx_make_ref, e);
12043 return (
cexpr_t *)HEXDSP(hx_dereference, e, ptrsize, is_flt);
12049 HEXDSP(hx_save_user_labels, func_ea, user_labels);
12053inline void save_user_labels2(ea_t func_ea,
const user_labels_t *user_labels,
const cfunc_t *func)
12055 HEXDSP(hx_save_user_labels2, func_ea, user_labels, func);
12061 HEXDSP(hx_save_user_cmts, func_ea, user_cmts);
12067 HEXDSP(hx_save_user_numforms, func_ea, numforms);
12073 HEXDSP(hx_save_user_iflags, func_ea, iflags);
12079 HEXDSP(hx_save_user_unions, func_ea, unions);
12085 return (
user_labels_t *)HEXDSP(hx_restore_user_labels, func_ea);
12091 return (
user_labels_t *)HEXDSP(hx_restore_user_labels2, func_ea, func);
12097 return (
user_cmts_t *)HEXDSP(hx_restore_user_cmts, func_ea);
12109 return (user_iflags_t *)HEXDSP(hx_restore_user_iflags, func_ea);
12115 return (user_unions_t *)HEXDSP(hx_restore_user_unions, func_ea);
12121 HEXDSP(hx_cfunc_t_build_c_tree,
this);
12127 HEXDSP(hx_cfunc_t_verify,
this, aul, even_without_debugger);
12133 HEXDSP(hx_cfunc_t_print_dcl,
this, vout);
12139 HEXDSP(hx_cfunc_t_print_func,
this, &vp);
12145 return (uchar)(size_t)HEXDSP(hx_cfunc_t_get_func_type,
this, type) != 0;
12151 return (
lvars_t *)HEXDSP(hx_cfunc_t_get_lvars,
this);
12158 HEXDSP(hx_cfunc_t_get_stkoff_delta, &retval,
this);
12165 return (
citem_t *)HEXDSP(hx_cfunc_t_find_label,
this, label);
12171 HEXDSP(hx_cfunc_t_remove_unused_labels,
this);
12177 return (
const char *)HEXDSP(hx_cfunc_t_get_user_cmt,
this, &loc, rt);
12183 HEXDSP(hx_cfunc_t_set_user_cmt,
this, &loc, cmt);
12189 return (int32)(size_t)HEXDSP(hx_cfunc_t_get_user_iflags,
this, &loc);
12195 HEXDSP(hx_cfunc_t_set_user_iflags,
this, &loc, iflags);
12201 return (uchar)(size_t)HEXDSP(hx_cfunc_t_has_orphan_cmts,
this) != 0;
12207 return (
int)(size_t)HEXDSP(hx_cfunc_t_del_orphan_cmts,
this);
12213 return (uchar)(size_t)HEXDSP(hx_cfunc_t_get_user_union_selection,
this, ea, path) != 0;
12219 HEXDSP(hx_cfunc_t_set_user_union_selection,
this, ea, &path);
12225 HEXDSP(hx_cfunc_t_save_user_labels,
this);
12231 HEXDSP(hx_cfunc_t_save_user_cmts,
this);
12237 HEXDSP(hx_cfunc_t_save_user_numforms,
this);
12243 HEXDSP(hx_cfunc_t_save_user_iflags,
this);
12249 HEXDSP(hx_cfunc_t_save_user_unions,
this);
12255 return (uchar)(size_t)HEXDSP(hx_cfunc_t_get_line_item,
this, line, x, is_ctree_line, phead, pitem, ptail) != 0;
12261 return *(hexwarns_t *)HEXDSP(hx_cfunc_t_get_warnings,
this);
12267 return *(eamap_t *)HEXDSP(hx_cfunc_t_get_eamap,
this);
12273 return *(boundaries_t *)HEXDSP(hx_cfunc_t_get_boundaries,
this);
12279 return *(
const strvec_t *)HEXDSP(hx_cfunc_t_get_pseudocode,
this);
12285 HEXDSP(hx_cfunc_t_refresh_func_ctext,
this);
12289inline bool cfunc_t::gather_derefs(
const ctree_item_t &ci, udt_type_data_t *udm)
const
12291 return (uchar)(size_t)HEXDSP(hx_cfunc_t_gather_derefs,
this, &ci, udm) != 0;
12295inline bool cfunc_t::find_item_coords(
const citem_t *item,
int *px,
int *py)
12297 return (uchar)(size_t)HEXDSP(hx_cfunc_t_find_item_coords,
this, item, px, py) != 0;
12301inline void cfunc_t::cleanup()
12303 HEXDSP(hx_cfunc_t_cleanup,
this);
12309 HEXDSP(hx_close_hexrays_waitbox);
12315 return cfuncptr_t((
cfunc_t *)HEXDSP(hx_decompile, &mbr, hf, decomp_flags));
12321 return (
mba_t *)HEXDSP(hx_gen_microcode, &mbr, hf, retlist, decomp_flags, reqmat);
12327 return cfuncptr_t((
cfunc_t *)HEXDSP(hx_create_cfunc, mba));
12333 return (uchar)(size_t)HEXDSP(hx_mark_cfunc_dirty, ea, close_views) != 0;
12339 HEXDSP(hx_clear_cached_cfuncs);
12345 return (uchar)(size_t)HEXDSP(hx_has_cached_cfunc, ea) != 0;
12349inline const char *get_ctype_name(
ctype_t op)
12351 return (
const char *)HEXDSP(hx_get_ctype_name, op);
12355inline qstring create_field_name(
const tinfo_t &type, uval_t offset)
12358 HEXDSP(hx_create_field_name, &retval, &type, offset);
12365 return (uchar)(size_t)HEXDSP(hx_install_hexrays_callback, callback, ud) != 0;
12371 auto hrdsp = HEXDSP;
12372 return hrdsp ==
nullptr ? 0 : (int)(
size_t)hrdsp(hx_remove_hexrays_callback, callback, ud);
12376inline bool vdui_t::set_locked(
bool v)
12378 return (uchar)(size_t)HEXDSP(hx_vdui_t_set_locked,
this, v) != 0;
12384 HEXDSP(hx_vdui_t_refresh_view,
this, redo_mba);
12390 HEXDSP(hx_vdui_t_refresh_ctext,
this, activate);
12396 HEXDSP(hx_vdui_t_switch_to,
this, &f, activate);
12402 return (
cnumber_t *)HEXDSP(hx_vdui_t_get_number,
this);
12408 return (
int)(size_t)HEXDSP(hx_vdui_t_get_current_label,
this);
12414 HEXDSP(hx_vdui_t_clear,
this);
12420 return (uchar)(size_t)HEXDSP(hx_vdui_t_refresh_cpos,
this, idv) != 0;
12426 return (uchar)(size_t)HEXDSP(hx_vdui_t_get_current_item,
this, idv) != 0;
12432 return (uchar)(size_t)HEXDSP(hx_vdui_t_ui_rename_lvar,
this, v) != 0;
12438 return (uchar)(size_t)HEXDSP(hx_vdui_t_rename_lvar,
this, v, name, is_user_name) != 0;
12444 return (uchar)(size_t)HEXDSP(hx_vdui_t_ui_set_call_type,
this, e) != 0;
12450 return (uchar)(size_t)HEXDSP(hx_vdui_t_ui_set_lvar_type,
this, v) != 0;
12456 return (uchar)(size_t)HEXDSP(hx_vdui_t_set_lvar_type,
this, v, &type) != 0;
12462 return (uchar)(size_t)HEXDSP(hx_vdui_t_set_noptr_lvar,
this, v) != 0;
12468 return (uchar)(size_t)HEXDSP(hx_vdui_t_ui_edit_lvar_cmt,
this, v) != 0;
12474 return (uchar)(size_t)HEXDSP(hx_vdui_t_set_lvar_cmt,
this, v, cmt) != 0;
12480 return (uchar)(size_t)HEXDSP(hx_vdui_t_ui_map_lvar,
this, v) != 0;
12486 return (uchar)(size_t)HEXDSP(hx_vdui_t_ui_unmap_lvar,
this, v) != 0;
12492 return (uchar)(size_t)HEXDSP(hx_vdui_t_map_lvar,
this, from, to) != 0;
12498 return (uchar)(size_t)HEXDSP(hx_vdui_t_set_strmem_type,
this, sptr, mptr) != 0;
12504 return (uchar)(size_t)HEXDSP(hx_vdui_t_set_udm_type,
this, &udt_type, udm_idx) != 0;
12510 return (uchar)(size_t)HEXDSP(hx_vdui_t_rename_strmem,
this, sptr, mptr) != 0;
12516 return (uchar)(size_t)HEXDSP(hx_vdui_t_rename_udm,
this, &udt_type, udm_idx) != 0;
12522 return (uchar)(size_t)HEXDSP(hx_vdui_t_set_global_type,
this, ea) != 0;
12528 return (uchar)(size_t)HEXDSP(hx_vdui_t_rename_global,
this, ea) != 0;
12534 return (uchar)(size_t)HEXDSP(hx_vdui_t_rename_label,
this, label) != 0;
12540 return (uchar)(size_t)HEXDSP(hx_vdui_t_jump_enter,
this, idv, omflags) != 0;
12546 return (uchar)(size_t)HEXDSP(hx_vdui_t_ctree_to_disasm,
this) != 0;
12552 return (
cmt_type_t)(size_t)HEXDSP(hx_vdui_t_calc_cmt_type,
this, lnnum, cmttype);
12558 return (uchar)(size_t)HEXDSP(hx_vdui_t_edit_cmt,
this, &loc) != 0;
12564 return (uchar)(size_t)HEXDSP(hx_vdui_t_edit_func_cmt,
this) != 0;
12570 return (uchar)(size_t)HEXDSP(hx_vdui_t_del_orphan_cmts,
this) != 0;
12576 return (uchar)(size_t)HEXDSP(hx_vdui_t_set_num_radix,
this, base) != 0;
12582 return (uchar)(size_t)HEXDSP(hx_vdui_t_set_num_enum,
this) != 0;
12588 return (uchar)(size_t)HEXDSP(hx_vdui_t_set_num_stroff,
this) != 0;
12594 return (uchar)(size_t)HEXDSP(hx_vdui_t_invert_sign,
this) != 0;
12600 return (uchar)(size_t)HEXDSP(hx_vdui_t_invert_bits,
this) != 0;
12606 return (uchar)(size_t)HEXDSP(hx_vdui_t_collapse_item,
this, hide) != 0;
12612 return (uchar)(size_t)HEXDSP(hx_vdui_t_collapse_lvars,
this, hide) != 0;
12618 return (uchar)(size_t)HEXDSP(hx_vdui_t_split_item,
this, split) != 0;
12624 return (
int)(size_t)HEXDSP(hx_select_udt_by_offset, udts, &ops, &applicator);
12628#pragma warning(pop)
Bit set class. See https://en.wikipedia.org/wiki/Bit_array.
const chain_t * get_stk_chain(sval_t off, int width=1) const
Get chain for the specified stack offset.
const chain_t * get_reg_chain(mreg_t reg, int width=1) const
Get chain for the specified register.
const chain_t * get_chain(const voff_t &k, int width=1) const
Get chain for the specified value offset.
Convenience class to release graph chains automatically.
ud (use->def) and du (def->use) chain.
void append_list(const mba_t *mba, mlist_t *list) const
Append the contents of the chain to the specified list of locations.
int width
size of the value in bytes
uchar flags
combination Chain properties bits
int varnum
allocated variable index (-1 - not allocated yet)
Helper class to generate the initial microcode.
virtual merror_t gen_micro()=0
Generate microcode for one instruction.
virtual mreg_t load_operand(int opnum, int flags=0)=0
Generate microcode to load one operand.
virtual mreg_t load_effective_address(int n, int flags=0)=0
Generate microcode to calculate the address of a memory operand.
minsn_t * emit_micro_mvm(mcode_t code, op_dtype_t dtype, uval_t l, uval_t r, uval_t d, int offsize)
Emit one microinstruction.
virtual merror_t prepare_gen_micro()
Setup internal data to handle new instruction.
virtual bool store_operand(int n, const mop_t &mop, int flags=0, minsn_t **outins=nullptr)
Generate microcode to store an operand.
virtual merror_t analyze_prolog(const class qflow_chart_t &fc, const class bitset_t &reachable)=0
Analyze prolog/epilog of the function to decompile.
minsn_t * emit(mcode_t code, int width, uval_t l, uval_t r, uval_t d, int offsize)
Emit one microinstruction.
virtual void microgen_completed()
This method is called when the microcode generation is done.
void release()
Unlock the chains.
bool is_locked() const
Are the chains locked? It is a good idea to lock the chains before using them.
int for_all_chains(chain_visitor_t &cv, int gca_flags)
Visit all chains.
void acquire()
Lock the chains.
Definition of a local variable (register or stack) #var #lvar.
bool is_spoiled_var() const
Is spoiled var? (meaningful only during lvar allocation)
bool is_arg_var() const
Is the function argument?
bool typed() const
Has the variable a type?
bool is_partialy_typed() const
Variable type should be handled as a partial one.
bool is_shared() const
Is lvar mapped to several chains.
bool is_aliasable(const mba_t *mba) const
Is the variable aliasable?
qstring cmt
variable comment string
void append_list(const mba_t *mba, mlist_t *lst, bool pad_if_scattered=false) const
Append local variable to mlist.
bool set_lvar_type(const tinfo_t &t, bool may_fail=false)
Set variable type Note: this function does not modify the idb, only the lvar instance in the memory.
bool is_promoted_arg() const
Is the promoted function argument?
bool is_automapped() const
Was the variable automatically mapped to another variable?
bool has_common_bit(const vdloc_t &loc, asize_t width2) const
Does the variable overlap with the specified location?
bool has_regname() const
Has a register name? (like _RAX)
bool mreg_done() const
Have corresponding microregs been replaced by references to this variable?
bool is_used_byref() const
Was the address of the variable taken?
bool has_common(const lvar_t &v) const
Do variables overlap?
bool used() const
Is the variable used in the code?
bool has_user_type() const
Has user-defined type?
bool is_decl_unused() const
Was declared as __unused by the user? See CVAR_UNUSED.
bool is_fake_var() const
Is fake return variable?
qstring name
variable name.
bool set_width(int w, int svw_flags=0)
Change the variable width.
bool is_dummy_arg() const
Is a dummy argument (added to fill a hole in the argument list)
bool is_unknown_width() const
Do we know the width of the variable?
bool in_asm() const
Is variable used in an instruction translated into __asm?
bool is_overlapped_var() const
Is overlapped variable?
bool accepts_type(const tinfo_t &t, bool may_change_thisarg=false)
Check if the variable accept the specified type.
bool has_user_name() const
Has user-defined name?
bool has_user_info() const
Has any user-defined information?
bool is_floating_var() const
Used by a fpu insn?
bool is_notarg() const
Is a local variable? (local variable cannot be an input argument)
bool has_nice_name() const
Does the variable have a nice name?
bool is_thisarg() const
Is 'this' argument of a C++ member function?
bool is_result_var() const
Is the function result?
bool is_split_var() const
Is a split variable?
int width
variable size in bytes
bool is_noptr_var() const
Variable type should not be a pointer.
const tinfo_t & type() const
Get variable type.
bool is_mapdst_var() const
Other variable(s) map to this var?
void set_final_lvar_type(const tinfo_t &t)
Set final variable type.
Micro block array (internal representation of the decompiled code).
int for_all_ops(mop_visitor_t &mv)
Visit all operands of all instructions.
mblock_t * copy_block(mblock_t *blk, int new_serial, int cpblk_flags=3)
Make a copy of a block.
void dump() const
Dump microcode to a file.
mreg_t alloc_kreg(size_t size, bool check_size=true)
Allocate a kernel register.
mbl_graph_t * get_graph()
Get control graph.
ea_t map_fict_ea(ea_t fict_ea) const
Resolve a fictional address.
bool remove_empty_and_unreachable_blocks()
Delete all empty and unreachable blocks.
ea_t alloc_fict_ea(ea_t real_ea)
Allocate a fictional address.
merror_t optimize_global()
Optimize microcode globally.
mlist_t spoiled_list
MBA_SPLINFO && !final_type: info in vd format.
int for_all_topinsns(minsn_visitor_t &mv)
Visit all top level instructions.
lvars_t vars
local variables
reginfovec_t idb_spoiled
MBA_SPLINFO && final_type: info in ida format.
ivl_with_name_t std_ivls[6]
we treat memory as consisting of 6 parts see memreg_index_t
void get_func_output_lists(mlist_t *return_regs, mlist_t *spoiled, const tinfo_t &type, ea_t call_ea=BADADDR, bool tail_call=false)
Prepare the lists of registers & memory that are defined/killed by a function.
sval_t fullsize
Full stack size including incoming args.
int optimize_local(int locopt_bits)
Optimize each basic block locally.
void alloc_lvars()
Allocate local variables.
void free_kreg(mreg_t reg, size_t size)
Free a kernel register.
void print(vd_printer_t &vp) const
Print microcode to any destination.
qstring label
name of the function or pattern (colored)
rlist_t consumed_argregs
registers converted into stack arguments, should not be used as arguments
void save_snapshot(const char *description)
Create and save microcode snapshot.
const ivl_t & get_std_region(memreg_index_t idx) const
Get information about various memory regions.
bool remove_block(mblock_t *blk)
Delete a block.
tinfo_t idb_type
function type as retrieved from the database
merror_t build_graph()
Build control flow graph.
bool combine_blocks()
Combine blocks.
void mark_chains_dirty()
Mark the microcode use-def chains dirty.
minsn_t * create_helper_call(ea_t ea, const char *helper, const tinfo_t *rettype=nullptr, const mcallargs_t *callargs=nullptr, const mop_t *out=nullptr)
Create a call of a helper function.
intvec_t argidx
input arguments (indexes into 'vars')
bool set_maturity(mba_maturity_t mat)
Set maturity level.
static WARN_UNUSED_RESULT mba_t * deserialize(const uchar *bytes, size_t nbytes)
Deserialize a byte sequence into mbl array.
void verify(bool always) const
Verify microcode consistency.
int for_all_insns(minsn_visitor_t &mv)
Visit all instructions.
netnode deprecated_idb_node
netnode with additional decompiler info.
int analyze_calls(int acflags)
Analyze calls and determine calling conventions.
const mblock_t * get_mblock(int n) const
Get basic block by its serial number.
mblock_t * insert_block(int bblk)
Insert a block in the middle of the mbl array.
void serialize(bytevec_t &vout) const
Serialize mbl array into a sequence of bytes.
mlist_t nodel_memory
global dead elimination may not delete references to this area
mop_t * find_mop(op_parent_info_t *ctx, ea_t ea, bool is_dest, const mlist_t &list)
Find an operand in the microcode.
ivlset_t gotoff_stkvars
stkvars that hold .got offsets. considered to be unaliasable
lvar_t & arg(int n)
Get input argument of the decompiled function.
Control flow graph of microcode.
bool is_redefined_globally(const mlist_t &list, int b1, int b2, const minsn_t *m1, const minsn_t *m2, maymust_t maymust=MAY_ACCESS) const
Is LIST redefined in the graph?
graph_chains_t * get_ud(gctype_t gctype)
Get use-def chains.
graph_chains_t * get_du(gctype_t gctype)
Get def-use chains.
bool is_ud_chain_dirty(gctype_t gctype)
Is the use-def chain of the specified kind dirty?
bool is_used_globally(const mlist_t &list, int b1, int b2, const minsn_t *m1, const minsn_t *m2, maymust_t maymust=MAY_ACCESS) const
Is LIST used in the graph?
bool is_du_chain_dirty(gctype_t gctype)
Is the def-use chain of the specified kind dirty?
Microcode of one basic block.
ea_t end
end address note: we cannot rely on start/end addresses very much because instructions are propagated...
mlist_t dnu
data that is defined but not used in the block
sval_t minbargref
the same for arguments
minsn_t * head
pointer to the first instruction of the block
void append_use_list(mlist_t *list, const mop_t &op, maymust_t maymust, bitrange_t mask=MAXRANGE) const
Append use-list of an operand.
minsn_t * tail
pointer to the last instruction of the block
minsn_t * insert_into_block(minsn_t *nm, minsn_t *om)
Insert instruction into the doubly linked list.
mblock_type_t type
block type (BLT_NONE - not computed yet)
intvec_t succset
control flow graph: list of our successors use nsucc() and succ() to access it
void print(vd_printer_t &vp) const
Print block contents.
void dump() const
Dump block info.
const minsn_t * find_redefinition(const mlist_t &list, const minsn_t *i1, const minsn_t *i2, maymust_t maymust=MAY_ACCESS) const
Find the first insn that redefines any part of the list in the insn range.
int optimize_insn(minsn_t *m, int optflags=OPTI_MINSTKREF|OPTI_COMBINSNS)
Optimize one instruction in the context of the block.
int for_all_ops(mop_visitor_t &mv)
Visit all operands.
bool is_used(mlist_t *list, const minsn_t *i1, const minsn_t *i2, maymust_t maymust=MAY_ACCESS) const
Is the list used by the specified instruction range?
const minsn_t * find_first_use(mlist_t *list, const minsn_t *i1, const minsn_t *i2, maymust_t maymust=MAY_ACCESS) const
Find the first insn that uses the specified list in the insn range.
mblock_t * prevb
previous block in the doubly linked list
mlist_t mustbuse
data that must be used by the block
intvec_t predset
control flow graph: list of our predecessors use npred() and pred() to access it
minsn_t * find_access(const mop_t &op, minsn_t **parent, const minsn_t *mend, int fdflags) const
Find the instruction that accesses the specified operand.
mlist_t maybuse
data that may be used by the block
bool is_rhs_redefined(const minsn_t *ins, const minsn_t *i1, const minsn_t *i2) const
Is the right hand side of the instruction redefined the insn range? "right hand side" corresponds to ...
mlist_t build_def_list(const minsn_t &ins, maymust_t maymust) const
Build def-list of an instruction.
mlist_t maybdef
data that may be defined by the block
int npred() const
Get number of block predecessors.
mlist_t dead_at_start
data that is dead at the block entry
int optimize_useless_jump()
Remove a jump at the end of the block if it is useless.
bool get_valranges(valrng_t *res, const vivl_t &vivl, int vrflags) const
Find possible values for a block.
mlist_t mustbdef
data that must be defined by the block
int for_all_insns(minsn_visitor_t &mv)
Visit all instructions.
sval_t maxbsp
maximal sp value in the block (0...stacksize)
uint32 flags
combination of Basic block properties bits
bool is_redefined(const mlist_t &list, const minsn_t *i1, const minsn_t *i2, maymust_t maymust=MAY_ACCESS) const
Is the list redefined by the specified instructions?
void append_def_list(mlist_t *list, const mop_t &op, maymust_t maymust) const
Append def-list of an operand.
int nsucc() const
Get number of block successors.
void make_nop(minsn_t *m)
Erase the instruction (convert it to nop) and mark the lists dirty.
int optimize_block()
Optimize a basic block.
sval_t minbstkref
lowest stack location accessible with indirect addressing (offset from the stack bottom) initially it...
mba_t * mba
the parent micro block array
minsn_t * remove_from_block(minsn_t *m)
Remove instruction from the doubly linked list.
mblock_t * nextb
next block in the doubly linked list
int build_lists(bool kill_deads)
Build def-use lists and eliminate deads.
mlist_t build_use_list(const minsn_t &ins, maymust_t maymust) const
Build use-list of an instruction.
int for_all_uses(mlist_t *list, minsn_t *i1, minsn_t *i2, mlist_mop_visitor_t &mmv)
Visit all operands that use LIST.
size_t get_reginsn_qty() const
Calculate number of regular instructions in the block.
tinfo_t type
formal argument type
argloc_t argloc
ida argloc
qstring name
formal argument name
Information about a call.
mcallargs_t args
call arguments
mlist_t return_regs
list of values returned by the function
ivlset_t visible_memory
what memory is visible to the call?
mlist_t spoiled
list of spoiled locations (includes return_regs)
ea_t callee
address of the called function, if known
type_attrs_t fti_attrs
extended function attributes
mlist_t dead_regs
registers defined by the function but never used.
mopvec_t retregs
return register(s) (e.g., AX, AX:DX, etc.) this vector is built from return_regs
funcrole_t role
function role
tinfo_t return_type
type of the returned value
argloc_t return_argloc
location of the returned value
int solid_args
number of solid args.
mlist_t pass_regs
passthrough registers: registers that depend on input values (subset of spoiled)
List of switch cases and targets.
casevec_t values
expression values for each target
intvec_t targets
target block numbers
Microinstruction class #insn.
int optimize_subtree(mblock_t *blk, minsn_t *top, minsn_t *parent, ea_t *converted_call, int optflags=OPTI_MINSTKREF)
Optimize instruction in its context.
minsn_t * prev
prev insn in doubly linked list. check also previ()
bool is_noret_call(int flags=0)
Is a non-returing call?
bool may_use_aliased_memory() const
Is it possible for the instruction to use aliased memory?
bool contains_opcode(mcode_t mcode) const
Does the instruction have the specified opcode? This function searches subinstructions as well.
minsn_t * next
next insn in doubly linked list. check also nexti()
bool contains_call(bool with_helpers=false) const
Does the instruction contain a call?
int for_all_insns(minsn_visitor_t &mv)
Visit all instructions.
bool has_side_effects(bool include_ldx_and_divs=false) const
Does the instruction have a side effect?
funcrole_t get_role() const
Get the function role of a call.
const minsn_t * find_ins_op(const mop_t **other, mcode_t op=m_nop) const
Find an operand that is a subinsruction with the specified opcode.
void setaddr(ea_t new_ea)
Change the instruction address.
ea_t ea
instruction address
void print(qstring *vout, int shins_flags=SHINS_SHORT|SHINS_VALNUM) const
Generate insn text into the buffer.
bool modifies_d() const
Does the instruction modify its 'd' operand? Some instructions (e.g.
minsn_t(ea_t _ea)
Constructor.
int optimize_solo(int optflags=0)
Optimize one instruction without context.
bool is_between(const minsn_t *m1, const minsn_t *m2) const
Is the instruction in the specified range of instructions?
const mop_t * find_num_op(const mop_t **other) const
Find a numeric operand of the current instruction.
int for_all_ops(mop_visitor_t &mv)
Visit all instruction operands.
bool is_after(const minsn_t *m) const
Is the instruction after the specified one?
void swap(minsn_t &m)
Swap two instructions.
int serialize(bytevec_t *b) const
Serialize an instruction.
mop_t d
destination operand
bool is_unknown_call() const
Is an unknown call? Unknown calls are calls without the argument list (mcallinfo_t).
minsn_t * find_call(bool with_helpers=false) const
Find a call instruction.
bool equal_insns(const minsn_t &m, int eqflags) const
Compare instructions.
const minsn_t * find_opcode(mcode_t mcode) const
Find a (sub)insruction with the specified opcode.
const char * dstr() const
Get displayable text without tags in a static buffer.
bool is_helper(const char *name) const
Is a helper call with the specified name? Helper calls usually have well-known function names (see We...
void _make_nop()
Convert instruction to nop.
mcode_t opcode
instruction opcode
bool deserialize(const uchar *bytes, size_t nbytes, int format_version)
Deserialize an instruction.
int iprops
combination of instruction property bits bits
Address of an operand (mop_l, mop_v, mop_S, mop_r)
A microinstruction operand.
void _make_gvar(ea_t ea)
Create a global variable operand without erasing previous data.
member_t * get_stkvar(uval_t *p_off) const
Retrieve the referenced stack variable.
bool has_side_effects(bool include_ldx_and_divs=false) const
Has any side effects?
uint8 oprops
Operand properties.
bool is_insn() const
Is a sub-instruction?
int for_all_ops(mop_visitor_t &mv, const tinfo_t *type=nullptr, bool is_target=false)
Visit the operand and all its sub-operands.
bool is_constant(uint64 *out=nullptr, bool is_signed=true) const
Retrieve value of a constant integer operand.
bool is_zero_extended_from(int nbytes) const
Does the high part of the operand consist of zero bytes?
bool is_reg() const
Is a register operand? See also get_mreg_name()
void create_from_insn(const minsn_t *m)
Create operand from an instruction.
bool create_from_mlist(mba_t *mba, const mlist_t &lst, sval_t fullsize)
Create operand from mlist_t.
void make_reg_pair(int loreg, int hireg, int halfsize)
Create pair of registers.
bool get_stkoff(sval_t *p_off) const
Get the referenced stack offset.
bool is_mob(int serial) const
Is a block reference to the specified block?
void _make_lvar(mba_t *mba, int idx, sval_t off=0)
Create a local variable operand.
bool make_low_half(int width)
Make the low part of the operand.
uint16 valnum
Value number.
void _make_blkref(int blknum)
Create a block reference operand without erasing previous data.
bool preserve_side_effects(mblock_t *blk, minsn_t *top, bool *moved_calls=nullptr)
Move subinstructions with side effects out of the operand.
bool equal_mops(const mop_t &rop, int eqflags) const
Compare operands.
bool change_size(int nsize, side_effect_t sideff=WITH_SIDEFF)
Change the operand size.
bool is_reg(mreg_t _r) const
Is the specified register?
const minsn_t * get_insn(mcode_t code) const
Get subinstruction of the operand.
bool make_fpnum(const void *bytes, size_t _size)
Create a floating point constant operand.
void _make_cases(mcases_t *_cases)
Create a 'switch cases' operand without erasing previous data.
void make_insn(minsn_t *ins)
Create a nested instruction.
void make_number(uint64 _value, int _size, ea_t _ea=BADADDR, int opnum=0)
Create an integer constant operand.
bool is_arglist() const
Is a list of arguments?
bool make_first_half(int width)
Make the first part of the operand.
bool is_sign_extended_from(int nbytes) const
Does the high part of the operand consist of the sign bytes?
bool make_high_half(int width)
Make the high part of the operand.
uint64 value(bool is_signed) const
Retrieve value of a constant integer operand.
bool is_glbaddr() const
Is address of a global memory cell?
void _make_reg(mreg_t reg)
Create a register operand without erasing previous data.
bool is_scattered() const
Is a scattered operand?
void _make_insn(minsn_t *ins)
Create a nested instruction without erasing previous data.
void _make_strlit(const char *str)
Create a constant string operand.
bool is_kreg() const
Is a kernel register?
bool is_cc() const
Is a condition code?
bool is_reg(mreg_t _r, int _size) const
Is the specified register of the specified size?
int for_all_scattered_submops(scif_visitor_t &sv) const
Visit all sub-operands of a scattered operand.
static bool is_bit_reg(mreg_t reg)
Is a bit register? This includes condition codes and eventually other bit registers.
bool create_from_ivlset(mba_t *mba, const ivlset_t &ivs, sval_t fullsize)
Create operand from ivlset_t.
void make_reg(mreg_t reg)
Create a register operand.
bool is_extended_from(int nbytes, bool is_signed) const
Does the high part of the operand consist of zero or sign bytes?
bool shift_mop(int offset)
Shift the operand.
void _make_stkvar(mba_t *mba, sval_t off)
Create a stack variable operand.
bool is_stkaddr() const
Is address of a stack variable?
bool is01() const
Are the possible values of the operand only 0 and 1? This function returns true for 0/1 constants,...
void make_helper(const char *name)
Create a helper operand.
void create_from_vdloc(mba_t *mba, const vdloc_t &loc, int _size)
Create operand from vdloc_t.
void make_blkref(int blknum)
Create a global variable operand.
void _make_callinfo(mcallinfo_t *fi)
Create a call info operand without erasing previous data.
bool make_second_half(int width)
Make the second part of the operand.
void create_from_scattered_vdloc(mba_t *mba, const char *name, tinfo_t type, const vdloc_t &loc)
Create operand from scattered vdloc_t.
void apply_ld_mcode(mcode_t mcode, ea_t ea, int newsize)
Apply a unary opcode to the operand.
void make_gvar(ea_t ea)
Create a global variable operand.
void _make_pair(mop_pair_t *_pair)
Create a pair operand without erasing previous data.
bool may_use_aliased_memory() const
Is it possible for the operand to use aliased memory?
Vector of colored strings.
Abstract class: User-defined call generator derived classes should implement method 'match'.
virtual bool match(codegen_t &cdg) override=0
return true if the filter object should be applied to given instruction
void cleanup()
Cleanup the filter This function properly clears type information associated to this filter.
virtual merror_t apply(codegen_t &cdg) override
generate microcode for an instruction
Iterator class for user_cmts_t.
Iterator class for user_labels_t.
User defined label names.
#define CHF_REPLACED
chain operands have been replaced?
#define CHF_OVER
overlapped chain
#define CHF_FAKE
fake chain created by widen_chains()
#define CHF_INITED
is chain initialized? (valid only after lvar allocation)
#define CHF_PASSTHRU
pass-thru chain, must use the input variable to the block
#define CHF_TERM
terminating chain; the variable does not survive across the block
#define CV_RESTART
restart enumeration at the top expr (apply_to_exprs)
#define CV_PRUNE
this bit is set by visit...() to prune the walk
#define CV_PARENTS
maintain parent information
#define CV_POST
call the leave...() functions
#define CV_INSNS
visit only statements, prune all expressions do not use before the final ctree maturity because expre...
#define CVAR_FLOAT
used in a fpu insn
#define CVAR_THISARG
'this' argument of c++ member functions
#define CVAR_REGNAME
has a register name (like _RAX): if lvar is used by an m_ext instruction
#define CVAR_BYREF
the address of the variable was taken
#define CVAR_NAME
has nice name?
#define CVAR_SHARED
variable is mapped to several chains
#define CVAR_INASM
variable is used in instructions translated into __asm {...}
#define CVAR_UTYPE
user-defined type
#define CVAR_UNUSED
user-defined __unused attribute meaningful only if: is_arg_var() && !mba->final_type
#define CVAR_MAPDST
other variables are mapped to this var
#define CVAR_USED
is used in the code?
#define CVAR_OVER
overlapping variable
#define CVAR_SPLIT
variable was created by an explicit request otherwise we could reuse an existing var
#define CVAR_FAKE
fake variable (return var or va_list)
#define CVAR_RESULT
function result variable
#define CVAR_ARG
function argument
#define CVAR_TYPE
the type is defined?
#define CVAR_AUTOMAP
variable was automatically mapped
#define CVAR_PARTIAL
variable type is partialy defined
#define CVAR_MREG
corresponding mregs were replaced?
#define CVAR_NOWD
width is unknown
#define CVAR_SPOILED
internal flag, do not use: spoiled var
#define CVAR_DUMMY
dummy argument (added to fill a hole in the argument list)
#define CVAR_NOTARG
variable cannot be an input argument
#define CVAR_NOPTR
variable cannot be a pointer (user choice)
#define CVAR_UNAME
user-defined name
#define DECOMP_VOID_MBA
return empty mba object (to be used with gen_microcode)
#define EXFL_CPADONE
pointer arithmetic correction done
#define EXFL_CSTR
string literal
#define EXFL_FPOP
floating point operation
#define EXFL_LVALUE
expression is lvalue even if it doesn't look like it
#define EXFL_UNDEF
expression uses undefined value
#define EXFL_VFTABLE
is ptr to vftable (used for cot_memptr, cot_memref)
#define EXFL_PARTIAL
type of the expression is considered partial
#define EXFL_JUMPOUT
jump out-of-function
#define LVINF_UNUSED
unused argument, corresponds to CVAR_UNUSED
#define LVINF_SPLIT
split allocation of a new variable.
#define LVINF_KEEP
preserve saved user settings regardless of vars for example, if a var loses all its user-defined attr...
#define LVINF_NOMAP
forbid automatic mapping of the variable
#define LVINF_NOPTR
variable type should not be a pointer
@ MERR_ONLY32
only 32-bit functions can be decompiled for the current database
@ MERR_LICENSE
no license available
@ MERR_CANCELED
decompilation has been cancelled
@ MERR_UNKTYPE
undefined type s (currently unused error code)
@ MERR_BADFRAME
function frame is wrong
@ MERR_BUSY
already decompiling a function
@ MERR_HUGESTACK
stack frame is too big
@ MERR_BADBLK
bad block found
@ MERR_BADIDB
inconsistent database information
@ MERR_EXCEPTION
exception analysis failed
@ MERR_BLOCK
no error, switch to new block
@ MERR_FUNCSIZE
too big function
@ MERR_PARTINIT
partially initialized variable s
@ MERR_BADRANGES
bad input ranges
@ MERR_DSLOT
bad instruction in the delay slot
@ MERR_INSN
cannot convert to microcode
@ MERR_COMPLEX
too complex function
@ MERR_BADARCH
current architecture is not supported
@ MERR_ONLY64
only 64-bit functions can be decompiled for the current database
@ MERR_RECDEPTH
max recursion depth reached during lvar allocation
@ MERR_FARPTR
far memory model is supported only for pc
@ MERR_STOP
no error, stop the analysis
@ MERR_BADCALL
could not determine call arguments
@ MERR_SIZEOF
wrong basic type sizes in compiler settings
@ MERR_EXTERN
special segments cannot be decompiled
@ MERR_BITNESS
16-bit functions cannot be decompiled
@ MERR_LOOP
internal code: redo last loop (never reported)
@ MERR_REDO
redecompilation has been requested
@ MERR_PROLOG
prolog analysis failed
@ MERR_LVARS
local variable allocation failed
@ MERR_INTERR
internal error
@ MERR_OVERLAP
variables would overlap: s
@ MERR_BADSP
positive sp value has been found
@ MERR_SWITCH
wrong switch idiom
@ MERR_MEM
not enough memory
#define MLI_NAME
apply lvar name
#define NF_VALID
internal bit: stroff or enum is valid for enums: this bit is set immediately for stroffs: this bit is...
#define NF_NEGATE
The user asked to negate the constant.
#define NF_NEGDONE
temporary internal bit: negation has been performed
#define NF_BINVDONE
temporary internal bit: inverting bits is done
#define NF_BITNOT
The user asked to invert bits of the constant.
#define SHINS_VALNUM
display value numbers
#define SHINS_NUMADDR
display definition addresses for numbers
#define SHINS_SHORT
do not display use-def chains and other attrs
#define ULV_PRECISE_DEFEA
Use precise defea's for lvar locations.
#define VDUI_VISIBLE
is visible?
#define VDUI_VALID
is valid?
tinfo_t dummy_ptrtype(int ptrsize, bool isfp)
Generate a dummy pointer type.
bool get_type(uval_t id, tinfo_t *tif, type_source_t guess)
Get a global type.
bool get_member_type(const member_t *mptr, tinfo_t *type)
Get type of a structure field.
bool set_type(uval_t id, const tinfo_t &tif, type_source_t source, bool force=false)
Set a global type.
bool is_type_correct(const type_t *ptr)
Verify a type string.
int partial_type_num(const tinfo_t &type)
Calculate number of partial subtypes.
bool is_small_udt(const tinfo_t &tif)
Is a small structure or union?
THREAD_SAFE bool is_inplace_def(const tinfo_t &type)
Is struct/union/enum definition (not declaration)?
type_source_t
Type source (where the type information comes from)
bool is_bool_type(const tinfo_t &type)
Is a boolean type?
bool is_nonbool_type(const tinfo_t &type)
Is definitely a non-boolean type?
tinfo_t get_int_type_by_width_and_sign(int srcwidth, type_sign_t sign)
Create a type info by width and sign.
THREAD_SAFE bool is_ptr_or_array(type_t t)
Is a pointer or array type?
tinfo_t create_typedef(const char *name)
Create a reference to a named type.
const char * dstr(const tinfo_t *tif)
Print the specified type info.
tinfo_t get_unk_type(int size)
Create a partial type info by width.
THREAD_SAFE bool is_paf(type_t t)
Is a pointer, array, or function type?
tinfo_t make_pointer(const tinfo_t &type)
Create a pointer type.
tinfo_t get_float_type(int width)
Get a type of a floating point value with the specified width.
input_device_t
Type of the input device.
bool is_break_consumer(ctype_t op)
Does a break statement influence the specified statement code?
operand_locator_t const & user_numforms_first(user_numforms_iterator_t p)
Get reference to the current map key.
void udcall_map_free(udcall_map_t *map)
Delete udcall_map_t instance.
int select_udt_by_offset(const qvector< tinfo_t > *udts, const ui_stroff_ops_t &ops, ui_stroff_applicator_t &applicator)
Select UDT.
#define MBA_PASSREGS
has mcallinfo_t::pass_regs
#define MBA2_ARGIDX_OK
may verify input argument list?
cursor_item_type_t
Type of the cursor item.
@ VDI_FUNC
the function itself (the very first line with the function prototype)
@ VDI_TAIL
cursor is at (beyond) the line end (commentable line)
@ VDI_LVAR
declaration of local variable
boundaries_iterator_t boundaries_end(const boundaries_t *map)
Get iterator pointing to the end of boundaries_t.
#define MBL_PROP
needs 'propagation' pass
user_cmts_iterator_t user_cmts_prev(user_cmts_iterator_t p)
Move to the previous element.
#define IPROP_OPTIONAL
optional instruction
size_t user_numforms_size(user_numforms_t *map)
Get size of user_numforms_t.
boundaries_iterator_t boundaries_find(const boundaries_t *map, const cinsn_t *&key)
Find the specified key in boundaries_t.
void user_cmts_clear(user_cmts_t *map)
Clear user_cmts_t.
const cmt_type_t CMT_FUNC
Function comment.
memreg_index_t
< memory region types
@ MMIDX_SHADOW
stack: shadow arguments
@ MMIDX_GLBLOW
global memory: low part
@ MMIDX_GLBHIGH
global memory: high part
@ MMIDX_ARGS
stack: regular stack arguments
@ MMIDX_RETADDR
stack: return address
@ MMIDX_LVARS
stack: local variables
bool is_unary(ctype_t op)
Is unary operator?
user_iflags_iterator_t user_iflags_insert(user_iflags_t *map, const citem_locator_t &key, const int32 &val)
Insert new (citem_locator_t, int32) pair into user_iflags_t.
const mopt_t mop_d
result of another instruction
const cmt_type_t CMT_BLOCK2
Posterior block comment.
#define MBA2_OVER_CHAINS
has overlapped chains?
const minsn_t * getb_reginsn(const minsn_t *ins)
Skip assertions backward.
void user_labels_clear(user_labels_t *map)
Clear user_labels_t.
bool arglocs_overlap(const vdloc_t &loc1, size_t w1, const vdloc_t &loc2, size_t w2)
Do two arglocs overlap?
enum hexrays_event_t ENUM_SIZE(int)
Decompiler events.
user_cmts_iterator_t user_cmts_end(const user_cmts_t *map)
Get iterator pointing to the end of user_cmts_t.
#define IPROP_WAS_NORET
was noret icall
#define MBA_SHORT
use short display
void * hexdsp_t(int code,...)
Hex-Rays decompiler dispatcher.
THREAD_SAFE bool must_mcode_close_block(mcode_t mcode, bool including_calls)
Must an instruction with the given opcode be the last one in a block? Such opcodes are called closing...
size_t user_unions_size(user_unions_t *map)
Get size of user_unions_t.
#define GCO_USE
is source operand?
#define MBL_INCONST
inconsistent lists: we are building them
bool is_relational(ctype_t op)
Is comparison operator?
bool init_hexrays_plugin(int flags=0)
Check that your plugin is compatible with hex-rays decompiler.
void lvar_mapping_clear(lvar_mapping_t *map)
Clear lvar_mapping_t.
merror_t convert_to_user_call(const udcall_t &udc, codegen_t &cdg)
try to generate user-defined call for an instruction
item_preciser_t
Comment item preciser.
@ ITP_CASE
bit for switch cases
@ ITP_BLOCK2
closing block comment.
@ ITP_SIGN
if this bit is set too, then we have a negative case value
@ ITP_ARG1
, (64 entries are reserved for 64 call arguments)
@ ITP_BLOCK1
opening block comment.
user_unions_iterator_t user_unions_prev(user_unions_iterator_t p)
Move to the previous element.
int mreg_t
Micro register.
#define ANCHOR_ITP
item type preciser
#define hexapi
Public functions are marked with this keyword.
bool is_bitop(ctype_t op)
Is bit related operator?
user_unions_iterator_t user_unions_next(user_unions_iterator_t p)
Move to the next element.
#define IPROP_SPLIT4
into 4 bytes
user_numforms_iterator_t user_numforms_find(const user_numforms_t *map, const operand_locator_t &key)
Find the specified key in user_numforms_t.
void user_cmts_free(user_cmts_t *map)
Delete user_cmts_t instance.
udcall_map_iterator_t udcall_map_insert(udcall_map_t *map, const ea_t &key, const udcall_t &val)
Insert new (ea_t, udcall_t) pair into udcall_map_t.
const mopt_t mop_l
local variable
#define IPROP_PERSIST
persistent insn; they are not destroyed
user_iflags_iterator_t user_iflags_next(user_iflags_iterator_t p)
Move to the next element.
void user_iflags_clear(user_iflags_t *map)
Clear user_iflags_t.
bool has_cached_cfunc(ea_t ea)
Do we have a cached decompilation result for 'ea'?
udcall_map_iterator_t udcall_map_end(const udcall_map_t *map)
Get iterator pointing to the end of udcall_map_t.
cexpr_t * lnot(cexpr_t *e)
Logically negate the specified expression.
#define ANCHOR_CITEM
c-tree item
bool mark_cfunc_dirty(ea_t ea, bool close_views=false)
Flush the cached decompilation results.
eamap_iterator_t eamap_prev(eamap_iterator_t p)
Move to the previous element.
const cmt_type_t CMT_TAIL
Indented comment.
boundaries_iterator_t boundaries_begin(const boundaries_t *map)
Get iterator pointing to the beginning of boundaries_t.
bool is_additive(ctype_t op)
Is additive operator?
vdui_t * open_pseudocode(ea_t ea, int flags)
Open pseudocode window.
intvec_t & user_unions_second(user_unions_iterator_t p)
Get reference to the current map value.
int get_mreg_name(qstring *out, mreg_t reg, int width, void *ud=nullptr)
Get the microregister name.
rangeset_t & boundaries_second(boundaries_iterator_t p)
Get reference to the current map value.
#define MBA_THUNK
thunk function
cmt_retrieval_type_t
Comment retrieval type.
@ RETRIEVE_ALWAYS
Retrieve comment even if it has been used.
@ RETRIEVE_ONCE
Retrieve comment if it has not been used yet.
bool modify_user_lvar_info(ea_t func_ea, uint mli_flags, const lvar_saved_info_t &info)
Modify saved local variable settings of one variable.
size_t user_cmts_size(user_cmts_t *map)
Get size of user_cmts_t.
user_numforms_iterator_t user_numforms_begin(const user_numforms_t *map)
Get iterator pointing to the beginning of user_numforms_t.
void print_vdloc(qstring *vout, const vdloc_t &loc, int nbytes)
Print vdloc.
void user_cmts_erase(user_cmts_t *map, user_cmts_iterator_t p)
Erase current element from user_cmts_t.
eamap_iterator_t eamap_find(const eamap_t *map, const ea_t &key)
Find the specified key in eamap_t.
bool op_uses_z(ctype_t op)
Does operator use the 'z' field of cexpr_t?
qvector< citem_t * > ctree_items_t
Vector of parents.
void clear_cached_cfuncs()
Flush all cached decompilation results.
ea_t const & user_unions_first(user_unions_iterator_t p)
Get reference to the current map key.
lvar_mapping_iterator_t lvar_mapping_end(const lvar_mapping_t *map)
Get iterator pointing to the end of lvar_mapping_t.
lvar_locator_t & lvar_mapping_second(lvar_mapping_iterator_t p)
Get reference to the current map value.
size_t udcall_map_size(udcall_map_t *map)
Get size of udcall_map_t.
void save_user_iflags(ea_t func_ea, const user_iflags_t *iflags)
Save user defined citem iflags into the database.
bool accepts_small_udts(ctype_t op)
Is the operator allowed on small structure or union?
const minsn_t * getf_reginsn(const minsn_t *ins)
Skip assertions forward.
udcall_map_iterator_t udcall_map_begin(const udcall_map_t *map)
Get iterator pointing to the beginning of udcall_map_t.
#define MBA2_LVARS_RENAMED
accept empty names now?
const cmt_type_t CMT_LVAR
Local variable comment.
user_numforms_iterator_t user_numforms_prev(user_numforms_iterator_t p)
Move to the previous element.
#define MBA_CMNSTK
stkvars+stkargs should be considered as one area
bool change_hexrays_config(const char *directive)
Parse DIRECTIVE and update the current configuration variables.
#define IPROP_WILDMATCH
match multiple insns
void block_chains_free(block_chains_t *set)
Delete block_chains_t instance.
cfuncptr_t decompile_snippet(const rangevec_t &ranges, hexrays_failure_t *hf=nullptr, int decomp_flags=0)
Decompile a snippet.
#define OPROP_IMPDONE
imported operand (a pointer) has been dereferenced
eamap_iterator_t eamap_next(eamap_iterator_t p)
Move to the next element.
#define GCO_REG
is register? otherwise a stack variable
udcall_map_iterator_t udcall_map_next(udcall_map_iterator_t p)
Move to the next element.
bool is_commutative(ctype_t op)
Is commutative operator?
udcall_map_iterator_t udcall_map_prev(udcall_map_iterator_t p)
Move to the previous element.
void user_numforms_erase(user_numforms_t *map, user_numforms_iterator_t p)
Erase current element from user_numforms_t.
const mlist_t & get_temp_regs()
Get list of temporary registers.
void save_user_cmts(ea_t func_ea, const user_cmts_t *user_cmts)
Save user defined comments into the database.
std::map< lvar_locator_t, lvar_locator_t > lvar_mapping_t
Local variable mapping (is used to merge variables)
user_numforms_iterator_t user_numforms_next(user_numforms_iterator_t p)
Move to the next element.
eamap_iterator_t eamap_begin(const eamap_t *map)
Get iterator pointing to the beginning of eamap_t.
ea_t get_merror_desc(qstring *out, merror_t code, mba_t *mba)
Get textual description of an error code.
const mopt_t mop_b
micro basic block (mblock_t)
block_chains_iterator_t block_chains_next(block_chains_iterator_t p)
Move to the next element.
const mopt_t mop_S
local stack variable (they exist until MMAT_LVARS)
int32 & user_iflags_second(user_iflags_iterator_t p)
Get reference to the current map value.
user_unions_t * user_unions_new()
Create a new user_unions_t instance.
size_t boundaries_size(boundaries_t *map)
Get size of boundaries_t.
void eamap_erase(eamap_t *map, eamap_iterator_t p)
Erase current element from eamap_t.
const mopt_t mop_sc
scattered
#define IPROP_CLNPOP
the purpose of the instruction is to clean stack (e.g.
#define FD_DEF
look for definition
const int NOSIZE
wrong or unexisting operand size
bool get_current_operand(gco_info_t *out)
Get the instruction operand under the cursor.
size_t eamap_size(eamap_t *map)
Get size of eamap_t.
void block_chains_clear(block_chains_t *set)
Clear block_chains_t.
chain_t & block_chains_get(block_chains_iterator_t p)
Get reference to the current set value.
#define MBA_CALLS
callinfo has been built
bool op_uses_y(ctype_t op)
Does operator use the 'y' field of cexpr_t?
allow_unused_labels_t
Unused label disposition.
@ ALLOW_UNUSED_LABELS
Unused labels are permitted.
@ FORBID_UNUSED_LABELS
Unused labels cause interr.
#define MBA_ASRPROP
assertion have been propagated
user_labels_iterator_t user_labels_begin(const user_labels_t *map)
Get iterator pointing to the beginning of user_labels_t.
int const & user_labels_first(user_labels_iterator_t p)
Get reference to the current map key.
#define MBA_ASRTOK
assertions have been generated
#define ANCHOR_BLKCMT
block comment (for ctree items)
cexpr_t * dereference(cexpr_t *e, int ptrsize, bool is_flt=false)
Dereference a pointer.
#define IPROP_SPLIT1
into 1 byte
boundaries_iterator_t boundaries_prev(boundaries_iterator_t p)
Move to the previous element.
#define ANCHOR_LVAR
declaration of local variable
lvar_mapping_iterator_t lvar_mapping_prev(lvar_mapping_iterator_t p)
Move to the previous element.
const mopt_t mop_fn
floating point constant
user_labels_iterator_t user_labels_find(const user_labels_t *map, const int &key)
Find the specified key in user_labels_t.
bool is_lvalue(ctype_t op)
Is Lvalue operator?
#define MBA_WINGR32
use wingraph32
#define MBA_SAVRST
save-restore analysis has been performed
bool parse_user_call(udcall_t *udc, const char *decl, bool silent)
Convert function type declaration into internal structure.
THREAD_SAFE bool is_mcode_propagatable(mcode_t mcode)
May opcode be propagated? Such opcodes can be used in sub-instructions (nested instructions) There is...
user_labels_iterator_t user_labels_insert(user_labels_t *map, const int &key, const qstring &val)
Insert new (int, qstring) pair into user_labels_t.
user_unions_iterator_t user_unions_end(const user_unions_t *map)
Get iterator pointing to the end of user_unions_t.
cinsn_t *const & boundaries_first(boundaries_iterator_t p)
Get reference to the current map key.
user_cmts_iterator_t user_cmts_begin(const user_cmts_t *map)
Get iterator pointing to the beginning of user_cmts_t.
const cmt_type_t CMT_NONE
No comment is possible.
cexpr_t * make_num(uint64 n, cfunc_t *func=nullptr, ea_t ea=BADADDR, int opnum=0, type_sign_t sign=no_sign, int size=0)
Create a number expression.
#define MBA_RETREF
return type has been refined
block_chains_iterator_t block_chains_find(const block_chains_t *set, const chain_t &val)
Find the specified key in set block_chains_t.
#define IPROP_FARCALL
call of a far function using push cs/call sequence
#define MBA2_HAS_OUTLINES
calls to outlined code have been inlined
user_cmts_iterator_t user_cmts_insert(user_cmts_t *map, const treeloc_t &key, const citem_cmt_t &val)
Insert new (treeloc_t, citem_cmt_t) pair into user_cmts_t.
user_numforms_iterator_t user_numforms_insert(user_numforms_t *map, const operand_locator_t &key, const number_format_t &val)
Insert new (operand_locator_t, number_format_t) pair into user_numforms_t.
#define OPROP_FLOAT
possibly floating value
qstack< history_item_t > history_t
Navigation history.
void user_iflags_erase(user_iflags_t *map, user_iflags_iterator_t p)
Erase current element from user_iflags_t.
#define MBA_LVARS1
lvar real allocation has been performed
const mopt_t mop_r
register (they exist until MMAT_LVARS)
cinsnptrvec_t & eamap_second(eamap_iterator_t p)
Get reference to the current map value.
void boundaries_free(boundaries_t *map)
Delete boundaries_t instance.
eamap_iterator_t eamap_end(const eamap_t *map)
Get iterator pointing to the end of eamap_t.
void udcall_map_clear(udcall_map_t *map)
Clear udcall_map_t.
#define CFS_LOCKED
cfunc is temporarily locked
user_cmts_iterator_t user_cmts_next(user_cmts_iterator_t p)
Move to the next element.
bool modify_user_lvars(ea_t entry_ea, user_lvar_modifier_t &mlv)
Modify saved local variable settings.
ea_t const & eamap_first(eamap_iterator_t p)
Get reference to the current map key.
const mopt_t mop_a
mop_addr_t: address of operand (mop_l, mop_v, mop_S, mop_r)
const cmt_type_t CMT_BLOCK1
Anterioir block comment.
const mopt_t mop_str
immediate string constant (user representation)
bool is_prepost(ctype_t op)
Is pre/post increment/decrement operator?
uint8 mopt_t
Instruction operand types.
void eamap_clear(eamap_t *map)
Clear eamap_t.
gctype_t
Kind of use-def and def-use chains.
@ GC_DIRTY_ALL
bitmask to represent all chains
@ GC_ASR
all the above and assertions
@ GC_END
number of chain types
@ GC_REGS_AND_STKVARS
registers and stkvars (restricted memory only)
@ GC_XDSU
only registers calculated with FULL_XDSU
user_iflags_t * restore_user_iflags(ea_t func_ea)
Restore user defined citem iflags from the database.
ctree_maturity_t
Ctree maturity level.
@ CMAT_CPA
corrected pointer arithmetic
@ CMAT_CASTED
added necessary casts
@ CMAT_BUILT
just generated
@ CMAT_NICE
nicefied expressions
@ CMAT_TRANS2
applied second wave of transformations
@ CMAT_TRANS3
applied third wave of transformations
@ CMAT_TRANS1
applied first wave of transformations
@ CMAT_ZERO
does not exist
bool is_loop(ctype_t op)
Is loop statement code?
#define OPTI_COMBINSNS
may combine insns (only for optimize_insn)
type_sign_t get_op_signness(ctype_t op)
Get operator sign. Meaningful for sign-dependent operators, like cot_sdiv.
user_unions_t * restore_user_unions(ea_t func_ea)
Restore user defined union field selections from the database.
qvector< block_chains_t > block_chains_vec_t
Graph chains.
#define MBA_NICE
apply transformations to c code
block_chains_iterator_t block_chains_insert(block_chains_t *set, const chain_t &val)
Insert new (chain_t) into set block_chains_t.
#define IPROP_INV_JX
inverted conditional jump
cfuncptr_t create_cfunc(mba_t *mba)
Create a new cfunc_t object.
#define OPROP_CCFLAGS
mop_n: a pc-relative value mop_a: an address obtained from a relocation else: value of a condition co...
#define IPROP_SPLIT
the instruction has been split:
ctype_t negated_relation(ctype_t op)
Negate a comparison operator. For example, cot_sge becomes cot_slt.
#define IPROP_UNMERGED
'goto' instruction was transformed info 'call'
#define MBA_LVARS0
lvar pre-allocation has been performed
user_numforms_iterator_t user_numforms_end(const user_numforms_t *map)
Get iterator pointing to the end of user_numforms_t.
int mreg2reg(mreg_t reg, int width)
Map a microregister to a processor register.
const mopt_t mop_p
operand pair
size_t user_iflags_size(user_iflags_t *map)
Get size of user_iflags_t.
mreg_t reg2mreg(int reg)
Map a processor register to a microregister.
#define MBA_PATTERN
microcode pattern, callinfo is present
#define MBA_LOADED
loaded gdl, no instructions (debugging)
ctype_t swapped_relation(ctype_t op)
Swap a comparison operator. For example, cot_sge becomes cot_sle.
int cmt_type_t
Comment types.
use_curly_t
Should curly braces be printed?
@ USE_CURLY_BRACES
print curly braces without any checks
@ CALC_CURLY_BRACES
print curly braces if necessary
@ NO_CURLY_BRACES
don't print curly braces
udcall_map_iterator_t udcall_map_find(const udcall_map_t *map, const ea_t &key)
Find the specified key in udcall_map_t.
void user_numforms_clear(user_numforms_t *map)
Clear user_numforms_t.
@ cot_asgsdiv
x /= y signed
@ cit_break
break-statement
@ cot_sgt
x > y signed or fpu (see EXFL_FPOP)
@ cot_insn
instruction in expression, internal representation only
@ cit_block
block-statement: { ... }
@ cit_continue
continue-statement
@ cot_ptr
*x, access size in 'ptrsize'
@ cot_slt
x < y signed or fpu (see EXFL_FPOP)
@ cot_asgsshr
x >>= y signed
@ cot_eq
x == y int or fpu (see EXFL_FPOP)
@ cit_return
return-statement
@ cot_ne
x != y int or fpu (see EXFL_FPOP)
@ cit_empty
instruction types start here
@ cot_helper
arbitrary name
@ cot_asgushr
x >>= y unsigned
@ cot_sle
x <= y signed or fpu (see EXFL_FPOP)
@ cot_ushr
x >> y unsigned
@ cit_while
while-statement
@ cot_str
string constant (user representation)
@ cot_sge
x >= y signed or fpu (see EXFL_FPOP)
@ cit_switch
switch-statement
@ cot_asgsmod
x %= y signed
@ cot_memptr
x->m, access size in 'ptrsize'
@ cot_asgumod
x %= y unsigned
@ cot_asgudiv
x /= y unsigned
@ cit_expr
expression-statement: expr;
lvar_mapping_iterator_t lvar_mapping_next(lvar_mapping_iterator_t p)
Move to the next element.
bool restore_user_lvar_settings(lvar_uservec_t *lvinf, ea_t func_ea)
Restore user defined local variable settings in the database.
cfuncptr_t decompile(const mba_ranges_t &mbr, hexrays_failure_t *hf=nullptr, int decomp_flags=0)
Decompile a snippet or a function.
funcrole_t
Function roles.
@ ROLE_3WAYCMP1
3-way compare helper, returns 0/1/2
@ ROLE_VA_COPY
va_copy() function
@ ROLE_UNK
unknown function role
@ ROLE_VA_ARG
va_arg() macro
@ ROLE_BUG
BUG() helper macro: never returns, causes exception.
@ ROLE_SSE_CMP4
e.g. _mm_cmpgt_ss
@ ROLE_EMPTY
empty, does not do anything (maybe spoils regs)
@ ROLE_MEMSET64
memset64(void *dst, uint64 value, size_t count);
@ ROLE_ALLOCA
alloca() function
@ ROLE_WMEMCPY
wchar_t *wmemcpy(wchar_t *dst, const wchar_t *src, size_t n)
@ ROLE_FASTFAIL
__fastfail()
@ ROLE_SATURATED_MUL
saturated_mul
@ ROLE_BITTESTANDSET
[lock] bts
@ ROLE_WCSCPY
wchar_t *wcscpy(wchar_t *dst, const wchar_t *src);
@ ROLE_SSE_CMP8
e.g. _mm_cmpgt_sd
@ ROLE_STRCAT
strcat(char *dst, const char *src);
@ ROLE_TAIL
char *tail(const char *str);
@ ROLE_CFSUB3
carry flag after subtract with carry
@ ROLE_READFLAGS
__readeflags, __readcallersflags
@ ROLE_MEMCPY
memcpy(void *dst, const void *src, size_t count);
@ ROLE_OFSUB3
overflow flag after subtract with carry
@ ROLE_PRESENT
present() function (used in patterns)
@ ROLE_BITTESTANDCOMPLEMENT
[lock] btc
@ ROLE_ABS
integer absolute value
@ ROLE_VA_START
va_start() function
@ ROLE_STRLEN
strlen(const char *src);
@ ROLE_STRCPY
strcpy(char *dst, const char *src);
@ ROLE_WCSLEN
size_t wcslen(const wchar_t *s)
@ ROLE_MEMSET
memset(void *dst, uchar value, size_t count);
@ ROLE_IS_MUL_OK
is_mul_ok
@ ROLE_VA_END
va_end() function
@ ROLE_WMEMSET
wchar_t *wmemset(wchar_t *dst, wchar_t wc, size_t n)
@ ROLE_CONTAINING_RECORD
CONTAINING_RECORD() macro.
@ ROLE_BITTESTANDRESET
[lock] btr
@ ROLE_MEMSET32
memset32(void *dst, uint32 value, size_t count);
@ ROLE_BSWAP
bswap() function (any size)
@ ROLE_WCSCAT
wchar_t *wcscat(wchar_t *dst, const wchar_t *src)
@ ROLE_3WAYCMP0
3-way compare helper, returns -1/0/1
bool remove_optblock_handler(optblock_t *opt)
Remove a block level custom optimizer.
#define MBA_GLBOPT
microcode has been optimized globally
bool checkout_hexrays_license(bool silent)
Check out a floating decompiler license.
#define MBA2_IS_DTR
is destructor?
void save_user_labels(ea_t func_ea, const user_labels_t *user_labels)
Save user defined labels into the database.
user_labels_t * user_labels_new()
Create a new user_labels_t instance.
user_labels_iterator_t user_labels_end(const user_labels_t *map)
Get iterator pointing to the end of user_labels_t.
#define MBA_REFINE
may refine return value size
bool close_pseudocode(TWidget *f)
Close pseudocode window.
void close_hexrays_waitbox()
Close the waitbox displayed by the decompiler.
bool install_hexrays_callback(hexrays_cb_t *callback, void *ud)
Install handler for decompiler events.
user_iflags_t * user_iflags_new()
Create a new user_iflags_t instance.
#define MBA2_CODE16_BIT
the code16 bit removed
void boundaries_clear(boundaries_t *map)
Clear boundaries_t.
#define IPROP_COMBINED
insn has been modified because of a partial reference
const mopt_t mop_n
immediate number constant
#define MBA_INSGDL
display instruction in graphs
user_numforms_t * user_numforms_new()
Create a new user_numforms_t instance.
mba_t * create_empty_mba(const mba_ranges_t &mbr, hexrays_failure_t *hf=nullptr)
Create an empty microcode object.
user_unions_iterator_t user_unions_find(const user_unions_t *map, const ea_t &key)
Find the specified key in user_unions_t.
hexcall_t
API call numbers.
#define MBA2_STACK_RETVAL
the return value is on the stack
boundaries_t * boundaries_new()
Create a new boundaries_t instance.
#define MBA_CHVARS
can verify chain varnums
side_effect_t
How to handle side effect of change_size() Sometimes we need to create a temporary operand and change...
@ ONLY_SIDEFF
only handle side effects
@ ANY_REGSIZE
any register size is permitted
@ NO_SIDEFF
change operand size but ignore side effects if you decide to keep the changed operand,...
@ ANY_FPSIZE
any size of floating operand is permitted
@ WITH_SIDEFF
change operand size and handle side effects
int remove_hexrays_callback(hexrays_cb_t *callback, void *ud)
Uninstall handler for decompiler events.
bool is_assignment(ctype_t op)
Is assignment operator?
void save_user_numforms(ea_t func_ea, const user_numforms_t *numforms)
Save user defined number formats into the database.
void user_numforms_free(user_numforms_t *map)
Delete user_numforms_t instance.
user_unions_iterator_t user_unions_begin(const user_unions_t *map)
Get iterator pointing to the beginning of user_unions_t.
#define IPROP_MBARRIER
this instruction acts as a memory barrier (instructions accessing memory may not be reordered past it...
void install_optblock_handler(optblock_t *opt)
Install a block level custom optimizer.
cexpr_t * make_ref(cexpr_t *e)
Create a reference.
#define MBA2_PROP_COMPLEX
allow propagation of more complex variable definitions
boundaries_iterator_t boundaries_next(boundaries_iterator_t p)
Move to the next element.
void user_unions_erase(user_unions_t *map, user_unions_iterator_t p)
Erase current element from user_unions_t.
number_format_t & user_numforms_second(user_numforms_iterator_t p)
Get reference to the current map value.
mba_t * gen_microcode(const mba_ranges_t &mbr, hexrays_failure_t *hf=nullptr, const mlist_t *retlist=nullptr, int decomp_flags=0, mba_maturity_t reqmat=MMAT_GLBOPT3)
Generate microcode of an arbitrary code snippet.
void user_unions_free(user_unions_t *map)
Delete user_unions_t instance.
bool is_logical(ctype_t op)
Is logical operator?
bool install_microcode_filter(microcode_filter_t *filter, bool install=true)
register/unregister non-standard microcode generator
lvar_locator_t const & lvar_mapping_first(lvar_mapping_iterator_t p)
Get reference to the current map key.
citem_cmt_t & user_cmts_second(user_cmts_iterator_t p)
Get reference to the current map value.
user_iflags_iterator_t user_iflags_find(const user_iflags_t *map, const citem_locator_t &key)
Find the specified key in user_iflags_t.
#define MBA_COLGDL
display graph after each reduction
#define IPROP_TAILCALL
tail call
const mopt_t mop_f
list of arguments
eamap_iterator_t eamap_insert(eamap_t *map, const ea_t &key, const cinsnptrvec_t &val)
Insert new (ea_t, cinsnptrvec_t) pair into eamap_t.
cfuncptr_t decompile_func(func_t *pfn, hexrays_failure_t *hf=nullptr, int decomp_flags=0)
Decompile a function.
void lvar_mapping_free(lvar_mapping_t *map)
Delete lvar_mapping_t instance.
#define MBA_NUMADDR
display definition addresses for numbers
size_t block_chains_size(block_chains_t *set)
Get size of block_chains_t.
#define MBL_LIST
use/def lists are ready (not dirty)
#define OPTI_MINSTKREF
may update minstkref
ea_t const & udcall_map_first(udcall_map_iterator_t p)
Get reference to the current map key.
void user_labels_free(user_labels_t *map)
Delete user_labels_t instance.
size_t lvar_mapping_size(lvar_mapping_t *map)
Get size of lvar_mapping_t.
#define MBA_DELPAIRS
pairs have been deleted once
#define MBA2_IS_CTR
is constructor?
void install_optinsn_handler(optinsn_t *opt)
Install an instruction level custom optimizer.
void user_iflags_free(user_iflags_t *map)
Delete user_iflags_t instance.
bool rename_lvar(ea_t func_ea, const char *oldname, const char *newname)
Rename a local variable.
#define MBA2_ARGIDX_SORTED
args finally sorted according to ABI (e.g.
user_iflags_iterator_t user_iflags_begin(const user_iflags_t *map)
Get iterator pointing to the beginning of user_iflags_t.
void user_labels_erase(user_labels_t *map, user_labels_iterator_t p)
Erase current element from user_labels_t.
lvar_mapping_iterator_t lvar_mapping_find(const lvar_mapping_t *map, const lvar_locator_t &key)
Find the specified key in lvar_mapping_t.
lvar_mapping_iterator_t lvar_mapping_begin(const lvar_mapping_t *map)
Get iterator pointing to the beginning of lvar_mapping_t.
user_numforms_t * restore_user_numforms(ea_t func_ea)
Restore user defined number formats from the database.
eamap_t * eamap_new()
Create a new eamap_t instance.
block_chains_iterator_t block_chains_end(const block_chains_t *set)
Get iterator pointing to the end of block_chains_t.
#define IPROP_DONT_COMB
may not combine this instruction with others
lvar_mapping_iterator_t lvar_mapping_insert(lvar_mapping_t *map, const lvar_locator_t &key, const lvar_locator_t &val)
Insert new (lvar_locator_t, lvar_locator_t) pair into lvar_mapping_t.
#define OPROP_UDEFVAL
uses undefined value
void save_user_unions(ea_t func_ea, const user_unions_t *unions)
Save user defined union field selections into the database.
#define IPROP_SPLIT2
into 2 bytes
bool op_uses_x(ctype_t op)
Does operator use the 'x' field of cexpr_t?
citem_locator_t const & user_iflags_first(user_iflags_iterator_t p)
Get reference to the current map key.
#define IPROP_SPLIT8
into 8 bytes
#define MBL_DMT64
needs "demote 64bits"
#define FD_USE
look for use
user_unions_iterator_t user_unions_insert(user_unions_t *map, const ea_t &key, const intvec_t &val)
Insert new (ea_t, intvec_t) pair into user_unions_t.
bool locate_lvar(lvar_locator_t *out, ea_t func_ea, const char *varname)
Find a variable by name.
user_cmts_t * user_cmts_new()
Create a new user_cmts_t instance.
qvector< cinsn_t * > cinsnptrvec_t
Vector of pointers to statements.
#define MBA2_VALRNG_DONE
calculated valranges?
udcall_t & udcall_map_second(udcall_map_iterator_t p)
Get reference to the current map value.
block_chains_t * block_chains_new()
Create a new block_chains_t instance.
void term_hexrays_plugin()
Stop working with hex-rays decompiler.
mblock_type_t
Basic block types.
@ BLT_NONE
unknown block type
@ BLT_XTRN
external block (out of function address)
@ BLT_STOP
stops execution regularly (must be the last block)
@ BLT_2WAY
passes execution to two blocks (conditional jump)
@ BLT_0WAY
does not have successors (tail is a noret function)
@ BLT_1WAY
passes execution to one block (regular or goto block)
@ BLT_NWAY
passes execution to many blocks (switch idiom)
ctype_t asgop_revert(ctype_t cop)
Convert assignment operator into plain operator.
size_t user_labels_size(user_labels_t *map)
Get size of user_labels_t.
#define IPROP_FPINSN
floating point insn
block_chains_iterator_t block_chains_begin(const block_chains_t *set)
Get iterator pointing to the beginning of block_chains_t.
bool decompile_many(const char *outfile, const eavec_t *funcaddrs, int flags)
Batch decompilation.
#define IPROP_EXTSTX
this is m_ext propagated into m_stx
void boundaries_erase(boundaries_t *map, boundaries_iterator_t p)
Erase current element from boundaries_t.
boundaries_iterator_t boundaries_insert(boundaries_t *map, const cinsn_t *&key, const rangeset_t &val)
Insert new (cinsn_t *, rangeset_t) pair into boundaries_t.
user_cmts_iterator_t user_cmts_find(const user_cmts_t *map, const treeloc_t &key)
Find the specified key in user_cmts_t.
#define IPROP_MULTI_MOV
the minsn was generated as part of insn that moves multiple registers (example: STM on ARM may transf...
#define IPROP_IGNLOWSRC
low part of the instruction source operand has been created artificially (this bit is used only for '...
vdui_t * get_widget_vdui(TWidget *f)
Get the vdui_t instance associated to the TWidget.
const mopt_t mop_v
global variable
user_iflags_iterator_t user_iflags_end(const user_iflags_t *map)
Get iterator pointing to the end of user_iflags_t.
#define MBA2_LVARNAMES_OK
may verify lvar_names?
user_labels_iterator_t user_labels_prev(user_labels_iterator_t p)
Move to the previous element.
user_iflags_iterator_t user_iflags_prev(user_iflags_iterator_t p)
Move to the previous element.
bool is_multiplicative(ctype_t op)
Is multiplicative operator?
#define MBA_PRCDEFS
use precise defeas for chain-allocated lvars
void udcall_map_erase(udcall_map_t *map, udcall_map_iterator_t p)
Erase current element from udcall_map_t.
cinsn_t * new_block()
Create a new block-statement.
mba_maturity_t
Microcode maturity levels.
@ MMAT_LOCOPT
local optimization of each basic block is complete.
@ MMAT_LVARS
allocated local variables
@ MMAT_CALLS
detected call arguments. see also hxe_calls_done
@ MMAT_GLBOPT1
performed the first pass of global optimization
@ MMAT_PREOPTIMIZED
preoptimized pass is complete
@ MMAT_ZERO
microcode does not exist
@ MMAT_GLBOPT3
completed all global optimization. microcode is fixed now.
@ MMAT_GLBOPT2
most global optimization passes are done
@ MMAT_GENERATED
generated microcode
void save_user_lvar_settings(ea_t func_ea, const lvar_uservec_t &lvinf)
Save user defined local variable settings into the database.
ctype_t asgop(ctype_t cop)
Convert plain operator into assignment operator. For example, cot_add returns cot_asgadd.
bool restore_user_defined_calls(udcall_map_t *udcalls, ea_t func_ea)
Restore user defined function calls from the database.
bool remove_optinsn_handler(optinsn_t *opt)
Remove an instruction level custom optimizer.
void eamap_free(eamap_t *map)
Delete eamap_t instance.
@ WARN_OPT_VALRNG2
52 mask 0xX is shortened because s <= 0xX"
@ WARN_GUESSED_TYPE
9 using guessed type s;
@ WARN_BAD_STROFF
33 user specified stroff has not been processed: s
@ WARN_OPT_USELESS_JCND
54 simplified comparisons for 's': s became s
@ WARN_FIXED_MACRO
29 fixed broken macro-insn
@ WARN_ODD_INPUT_REG
15 odd input register s
@ WARN_ILL_FUNCTYPE
2 invalid function type 's' has been ignored
@ WARN_ILL_PURGED
1 odd caller purged bytes d, correcting
@ WARN_UNINITED_REG
28 reference to an uninitialized register has been removed: s
@ WARN_ODD_ADDR_USE
16 odd use of a variable address
@ WARN_CBUILD_LOOPS
13 too many cbuild loops
@ WARN_BAD_VARSIZE
34 inconsistent variable size for 's'
@ WARN_VARARG_MANY
5 too many varargs, some ignored
@ WARN_MAX
may be used in notes as a placeholder when the warning id is not available
@ WARN_UNBALANCED_STACK
51 unbalanced stack, ignored a potential tail call
@ WARN_FRAG_LVAR
26 fragmented variable at s may be wrong
@ WARN_BAD_PURGED
12 inconsistent function type and number of purged bytes
@ WARN_UNSUPP_REG
35 unsupported processor register 's'
@ WARN_VARARG_REGS
0 cannot handle register arguments in vararg function, discarded them
@ WARN_MISSED_SWITCH
39 wrong markup of switch jump, skipped it
@ WARN_UNDEF_LVAR
42 variable 's' is possibly undefined
@ WARN_RET_LOCREF
47 returning address of temporary local variable 's'
@ WARN_BAD_RETVAR
25 wrong return variable
@ WARN_CR_NOFIELD
31 CONTAINING_RECORD: no field 's' in struct 's' at d
@ WARN_BAD_CALL_SP
38 bad sp value at call
@ WARN_WRITE_CONST
24 write access to const memory at a has been detected
@ WARN_WIDEN_CHAINS
11 failed to widen chains
@ WARN_ILL_FPU_STACK
18 inconsistent fpu stack
@ WARN_SELFREF_PROP
19 self-referencing variable has been detected
@ WARN_WRONG_VA_OFF
30 wrong offset of va_list variable
@ WARN_BAD_STKPNT
41 wrong sp change point
@ WARN_OPT_VALRNG
46 conditional instruction was optimized away because s
@ WARN_BAD_SHADOW
45 ignored the value written to the shadow area of the succeeding call
@ WARN_NO_SAVE_REST
14 could not find valid save-restore pair for s
@ WARN_BAD_INSN
49 bad instruction
@ WARN_ILL_ELLIPSIS
8 erroneously detected ellipsis type has been ignored
@ WARN_EXP_LINVAR
10 failed to expand a linear variable
@ WARN_VARARG_NOSTK
4 call vararg without local stack
@ WARN_MUST_RET_FP
17 function return type is incorrect (must be floating point)
@ WARN_JUMPOUT
43 control flows out of bounds
@ WARN_BAD_FIELD_TYPE
23 incorrect structure member type for s::s, ignored
@ WARN_WOULD_OVERLAP
20 variables would overlap: s
@ WARN_VARARG_TCAL
3 cannot handle tail call to vararg
@ WARN_ODD_ABI
50 encountered odd instruction for the current ABI
@ WARN_HUGE_STKOFF
27 exceedingly huge offset into the stack frame
@ WARN_ADDR_OUTARGS
6 cannot handle address arithmetics in outgoing argument area of stack frame – unused
@ WARN_MAX_ARGS
22 too many input arguments, some ignored
@ WARN_ARRAY_INARG
21 array has been used for an input argument
@ WARN_UNALIGNED_ARG
36 unaligned function argument 's'
@ WARN_CR_BADOFF
32 CONTAINING_RECORD: too small offset d for struct 's'
@ WARN_BAD_SP
40 positive sp value a has been found
@ WARN_OPT_VALRNG3
53 masking with 0XX was optimized away because s <= 0xX
@ WARN_BAD_VALRNG
44 values range analysis failed
@ WARN_DEP_UNK_CALLS
7 found interdependent unknown calls
@ WARN_BAD_STD_TYPE
37 corrupted or unexisting local type 's'
@ WARN_BAD_MAPDST
48 too short map destination 's' for variable 's'
treeloc_t const & user_cmts_first(user_cmts_iterator_t p)
Get reference to the current map key.
void block_chains_erase(block_chains_t *set, block_chains_iterator_t p)
Erase current element from block_chains_t.
#define IPROP_ASSERT
assertion: usually mov #val, op.
user_labels_t * restore_user_labels(ea_t func_ea)
Restore user defined labels from the database.
block_chains_iterator_t block_chains_prev(block_chains_iterator_t p)
Move to the previous element.
user_cmts_t * restore_user_cmts(ea_t func_ea)
Restore user defined comments from the database.
const cmt_type_t CMT_ALL
All comments.
#define MBA_VALNUM
display value numbers
void user_unions_clear(user_unions_t *map)
Clear user_unions_t.
#define MBA_RETFP
function returns floating point value
const mopt_t mop_h
helper function
void lvar_mapping_erase(lvar_mapping_t *map, lvar_mapping_iterator_t p)
Erase current element from lvar_mapping_t.
#define OPROP_LOWADDR
a low address offset
const char * get_hexrays_version()
Get decompiler version.
bool is_binary(ctype_t op)
Is binary operator?
#define GCO_DEF
is destination operand?
#define OPROP_UDT
a struct or union
ivlset_tpl< ivl_t, uval_t > uval_ivl_ivlset_t
Set of address intervals.
lvar_mapping_t * lvar_mapping_new()
Create a new lvar_mapping_t instance.
bool is_kreg(mreg_t r)
Is a kernel register? Kernel registers are temporary registers that can be used freely.
udcall_map_t * udcall_map_new()
Create a new udcall_map_t instance.
void send_database(const hexrays_failure_t &err, bool silent)
Send the database to Hex-Rays.
void save_user_defined_calls(ea_t func_ea, const udcall_map_t &udcalls)
Save user defined local function calls into the database.
ssize_t hexrays_cb_t(void *ud, hexrays_event_t event, va_list va)
Handler of decompiler events.
#define IPROP_DONT_PROP
may not propagate
user_labels_iterator_t user_labels_next(user_labels_iterator_t p)
Move to the next element.
qstring & user_labels_second(user_labels_iterator_t p)
Get reference to the current map value.
tinfo_t formal_type
formal parameter type (if known)
tinfo_t functype
function object type
Compound statement (curly braces)
Switch case. Usually cinsn_t is a block.
uint64vec_t values
List of case values.
Statement with an expression.
cexpr_t expr
Expression of the statement.
type_sign_t get_type_sign() const
Get expression sign.
bit_bound_t get_high_nbit_bound() const
Get max number of bits that can really be used by the expression.
int ptrsize
memory access size (used for cot_ptr, cot_memptr)
bool contains_comma(int times=1) const
Does the expression contain a comma operator?
bool is_value_used(const citem_t *parent) const
Does the PARENT need the expression value.
void replace_by(cexpr_t *r)
Replace the expression.
bool is_type_unsigned() const
Is expression unsigned?
void cleanup()
Cleanup the expression.
bool is_nice_cond() const
Is nice condition?.
bool is_aliasable() const
Check if the expression if aliasable.
bool is_call_arg_of(const citem_t *parent) const
Is call argument?
fnumber_t * fpc
used for cot_fnum
carglist_t * a
argument list (used for cot_call)
bool requires_lvalue(const cexpr_t *child) const
Check if the expression requires an lvalue.
uint64 numval() const
Get numeric value of the expression.
bool is_zero_const() const
Check if the expression is a zero.
void print1(qstring *vout, const cfunc_t *func) const
Print expression into one line.
bool like_boolean() const
Does the expression look like a boolean expression? In other words, its possible values are only 0 an...
cexpr_t * get_ptr_or_array()
Find pointer or array child.
const cexpr_t * find_op(ctype_t _op) const
Find the child with the specified operator.
bool is_type_signed() const
Is expression signed?
char * string
utf8 string constant, user representation (used for cot_str)
bool is_negative_const() const
Check if the expression is a negative number.
bool is_nice_expr() const
Is nice expression? Nice expressions do not contain comma operators, embedded statements,...
const cexpr_t * find_num_op() const
Find the operand with a numeric value.
cinsn_t * insn
an embedded statement, they are prohibited at the final maturity stage (CMAT_FINAL)
bool is_non_negative_const() const
Check if the expression is a non-negative number.
bool is_const_value(uint64 _v) const
Check if the expression is a number with the specified value.
void calc_type(bool recursive)
Calculate the type of the expression.
cnumber_t * n
used for cot_num
bool equal_effect(const cexpr_t &r) const
Compare two expressions.
ea_t obj_ea
used for cot_obj
cexpr_t * y
the second operand of the expression
bool is_call_object_of(const citem_t *parent) const
Is call object?
const cexpr_t * theother(const cexpr_t *what) const
Get the other operand.
bool contains_insn_or_label() const
Does the expression contain an embedded statement operator or a label?
bool is_child_of(const citem_t *parent) const
Verify if the specified item is our parent.
bool contains_insn(int times=1) const
Does the expression contain an embedded statement operator?
char * helper
helper name (used for cot_helper)
var_ref_t v
used for cot_var
bool has_side_effects() const
Check if the expression has side effects.
void put_number(cfunc_t *func, uint64 value, int nbytes, type_sign_t sign=no_sign)
Assign a number to the expression.
cexpr_t * z
the third operand of the expression
int get_low_nbit_bound() const
Get min number of bits that are certainly required to represent the expression.
bool contains_operator(ctype_t needed_op, int times=1) const
Check if the expression contains the specified operator.
bool cpadone() const
Pointer arithmetic correction done for this expression?
const cexpr_t * find_ptr_or_array(bool remove_eqsize_casts) const
Find the pointer operand.
bool is_non_zero_const() const
Check if the expression is a non-zero number.
uint32 m
member offset (used for cot_memptr, cot_memref) for unions, the member number
cexpr_t * x
the first operand of the expression
bool contains_comma_or_insn_or_label(int maxcommas=1) const
Does the expression contain a comma operator or an embedded statement operator or a label?
tinfo_t type
expression type. must be carefully maintained
bool get_1num_op(cexpr_t **o1, cexpr_t **o2)
Get pointers to operands.
int refwidth
how many bytes are accessed? (-1: none)
bool get_const_value(uint64 *out) const
Get expression value.
bool maybe_ptr() const
May the expression be a pointer?
cexpr_t init
Initialization expression.
cexpr_t step
Step expression.
Class to traverse the whole function.
cfunc_t * func
Pointer to current function.
bool calc_rvalue_type(tinfo_t *target, const cexpr_t *e)
Calculate rvalue type.
Decompiled function. Decompilation result is kept here.
void set_user_union_selection(ea_t ea, const intvec_t &path)
Set a union field selection.
user_cmts_t * user_cmts
user-defined comments.
user_unions_t * user_unions
user-defined union field selections.
void build_c_tree()
Generate the function body.
const char * get_user_cmt(const treeloc_t &loc, cmt_retrieval_type_t rt) const
Retrieve a user defined comment.
void remove_unused_labels()
Remove unused labels.
strvec_t sv
decompilation output: function text. use get_pseudocode
sval_t get_stkoff_delta()
Get stack offset delta.
void print_func(vc_printer_t &vp) const
Print function text.
const strvec_t & get_pseudocode()
Get pointer to decompilation output: the pseudocode.
bool get_line_item(const char *line, int x, bool is_ctree_line, ctree_item_t *phead, ctree_item_t *pitem, ctree_item_t *ptail)
Get ctree item for the specified cursor position.
user_iflags_t * user_iflags
user-defined item flags ctree item iflags bits
void set_user_iflags(const citem_locator_t &loc, int32 iflags)
Set citem iflags.
int hdrlines
number of lines in the declaration area
boundaries_t & get_boundaries()
Get pointer to map of instruction boundaries.
hexwarns_t & get_warnings()
Get information about decompilation warnings.
lvars_t * get_lvars()
Get vector of local variables.
bool has_orphan_cmts() const
Check if there are orphan comments.
void print_dcl(qstring *vout) const
Print function prototype.
eamap_t * eamap
ea->insn map. use get_eamap
user_numforms_t * numforms
user-defined number formats.
ctree_maturity_t maturity
maturity level
void save_user_labels() const
Save user-defined labels into the database.
void save_user_unions() const
Save user-defined union field selections into the database.
intvec_t & argidx
list of arguments (indexes into vars)
boundaries_t * boundaries
map of instruction boundaries. use get_boundaries
int statebits
current cfunc_t state.
citem_t * find_label(int label)
Find the label.
user_labels_t * user_labels
user-defined labels.
int refcnt
reference count to this object. use cfuncptr_t
bool get_user_union_selection(ea_t ea, intvec_t *path)
Retrieve a user defined union field selection.
void save_user_iflags() const
Save user-defined iflags into the database.
void refresh_func_ctext()
Refresh ctext after a ctree modification.
ctree_items_t treeitems
vector of ctree items
int del_orphan_cmts()
Delete all orphan comments.
void save_user_cmts() const
Save user-defined comments into the database.
mba_t * mba
underlying microcode
void set_user_cmt(const treeloc_t &loc, const char *cmt)
Set a user defined comment.
ea_t entry_ea
function entry address
cinsn_t body
function body, must be a block
eamap_t & get_eamap()
Get pointer to ea->insn map.
void verify(allow_unused_labels_t aul, bool even_without_debugger) const
Verify the ctree.
bool get_func_type(tinfo_t *type) const
Get the function type.
void save_user_numforms() const
Save user-defined number formats into the database.
int32 get_user_iflags(const citem_locator_t &loc) const
Retrieve citem iflags.
int label_num
Target label number.
cdo_t * cdo
details of do-statement
bool contains_free_continue() const
Check if the statement has free continue statements.
bool is_ordinary_flow() const
Check if the statement passes execution to the next statement.
void zero()
Overwrite with zeroes without cleaning memory or deleting children.
cgoto_t * cgoto
details of goto-statement
cif_t * cif
details of if-statement
cexpr_t * cexpr
details of expression-statement
void print1(qstring *vout, const cfunc_t *func) const
Print the statement into one line.
cif_t & create_if(cexpr_t *cnd)
Create a new if-statement.
cfor_t * cfor
details of for-statement
cswitch_t * cswitch
details of switch-statement
void print(int indent, vc_printer_t &vp, use_curly_t use_curly=CALC_CURLY_BRACES) const
Print the statement into many lines.
bool collect_free_continues(cinsnptrvec_t *continues)
Collect free continue statements.
void replace_by(cinsn_t *r)
Replace the statement.
bool collect_free_breaks(cinsnptrvec_t *breaks)
Collect free break statements.
void cleanup()
Cleanup the statement.
bool contains_insn(ctype_t type, int times=1) const
Check if the statement contains a statement of the specified type.
bool contains_free_break() const
Check if the statement has free break statements.
cinsn_t & new_insn(ea_t insn_ea)
Create a new statement.
cwhile_t * cwhile
details of while-statement
creturn_t * creturn
details of return-statement
cblock_t * cblock
details of block-statement
casm_t * casm
details of asm-statement
Generic ctree item locator.
ctype_t op
citem operation
bool contains_expr(const cexpr_t *e) const
Does the item contain an expression?
bool is_expr() const
Is an expression?
void print1(qstring *vout, const cfunc_t *func) const
Print item into one line.
bool contains_label() const
Does the item contain a label?
int label_num
label number.
void swap(citem_t &r)
Swap two citem_t.
const citem_t * find_parent_of(const citem_t *sitem) const
Find parent of the specified item.
ea_t ea
address that corresponds to the item. may be BADADDR
Base class for loop statements.
uint64 value(const tinfo_t &type) const
Get value.
void print(qstring *vout, const tinfo_t &type, const citem_t *parent=nullptr, bool *nice_stroff=nullptr) const
Get text representation.
void assign(uint64 v, int nbytes, type_sign_t sign)
Assign new value.
number_format_t nf
how to represent it
cnumber_t mvnf
Maximal switch value and number format.
ccases_t cases
Switch cases: values and instructions.
Cursor position in the output text (pseudocode).
bool in_ctree(int hdrlines) const
Is the cursor in the variable/type declaration area?
int y
y coordinate of the cursor within the window
int x
x coordinate of the cursor within the window
DECLARE_COMPARISONS(ctext_position_t)
Comparison operators.
Invisible COLOR_ADDR tags in the output text are used to refer to ctree items and variables.
int get_udm(udm_t *udm=nullptr, tinfo_t *parent=nullptr, uint64 *p_offset=nullptr) const
Get type of a structure field.
lvar_t * l
VDI_LVAR: Local variable.
int get_edm(tinfo_t *parent) const
Get type of an enum member.
ea_t get_ea() const
Get address of the current item.
cinsn_t * i
VDI_EXPR: Statement.
int get_label_num(int gln_flags) const
Get label number of the current item.
cfunc_t * f
VDI_FUNC: Function.
treeloc_t loc
VDI_TAIL: Line tail.
lvar_t * get_lvar() const
Get pointer to local variable.
cexpr_t * e
VDI_EXPR: Expression.
bool is_citem() const
Is the current item is a ctree item?
member_t * get_memptr(struc_t **p_sptr=nullptr) const
Get pointer to structure member.
A helper ctree traversal class that maintains parent information.
bool recalc_parent_types()
Recalculate type of parent nodes.
cblock_t * get_block()
Get pointer to the parent block of the currently visited item.
A generic helper class that is used for ctree traversal.
virtual int visit_expr(cexpr_t *)
Visit an expression.
virtual int leave_expr(cexpr_t *)
Visit an expression after having visited its children.
void set_restart()
Restart the travesal. Meaningful only in apply_to_exprs()
virtual int visit_insn(cinsn_t *)
Visit a statement.
void clr_prune()
Do not prune children. This is an internal function, no need to call it.
parents_t parents
Vector of parents of the current item.
ctree_visitor_t(int _flags)
Constructor.
bool maintain_parents() const
Should the parent information by maintained?
int apply_to(citem_t *item, citem_t *parent)
Traverse ctree.
cexpr_t * parent_expr()
Get parent of the current item as an expression.
bool is_postorder() const
Should the leave...() functions be called?
bool must_restart() const
Should the traversal restart?
void clr_restart()
Do not restart. This is an internal function, no need to call it.
bool only_insns() const
Should all expressions be automatically pruned?
cinsn_t * parent_insn()
Get parent of the current item as a statement.
void prune_now()
Prune children.
int cv_flags
Ctree visitor property bits
bool must_prune() const
Should the traversal skip the children of the current item?
virtual int leave_insn(cinsn_t *)
Visit a statement after having visited its children.
int apply_to_exprs(citem_t *item, citem_t *parent)
Traverse only expressions.
Helper class to convert binary data structures into text and put into a file.
FILE * fp
Output file pointer.
fpvalue_t fnum
Internal representation of the number.
int nbytes
Original size of the constant in bytes.
Result of get_current_operand()
int regnum
if register, the register id
vivl_t cvt_to_ivl() const
Convert operand info to VIVL.
qstring name
register or stkvar name
bool append_to_list(mlist_t *list, const mba_t *mba) const
Append operand info to LIST.
sval_t stkoff
if stkvar, stack offset
Exception object: decompiler failure information.
qstring str
string information
merror_t code
Microcode error codes
ea_t errea
associated address
ea_t ea
Address where the warning occurred.
qstring text
Fully formatted text of the warning.
ea_t end
BADADDR-decompile function; otherwise end of the range.
ea_t ea
The entry address of the decompiled function.
bool is_reg2() const
Is variable located on two registers?
bool is_reg1() const
Is variable located on one register?
const scattered_aloc_t & get_scattered() const
Get information about scattered variable.
bool is_scattered() const
Is variable scattered?
sval_t get_stkoff() const
Get offset of the varialbe in the stack frame.
bool is_stk_var() const
Is variable located on the stack?
bool is_reg_var() const
Is variable located on register(s)?
mreg_t get_reg2() const
Get the number of the second register (works only for ALOC_REG2 lvars)
vdloc_t location
Variable location.
mreg_t get_reg1() const
Get the register number of the variable.
Reference to a local variable. Used by mop_l.
int idx
index into mba->vars
mba_t *const mba
Pointer to the parent mba_t object.
lvar_t & var() const
Retrieve the referenced variable.
sval_t off
offset from the beginning of the variable
Saved user settings for local variables: name, type, comment.
lvar_locator_t ll
Variable locator.
All user-defined information about local variables.
int ulv_flags
Various flags. Possible values are from lvar_uservec_t property bits.
uval_t stkoff_delta
Delta to add to IDA stack offset to calculate Hex-Rays stack offsets.
lvar_mapping_t lmaps
Local variable mapping (used for merging variables)
lvar_saved_infos_t lvvec
User-specified names, types, comments for lvars.
lvar_saved_info_t * find_info(const lvar_locator_t &vloc)
find saved user settings for given var
void keep_info(const lvar_t &v)
Preserve user settings for given var.
Vector of local variables.
int find_stkvar(sval_t spoff, int width)
Find stack variable at the specified location.
lvar_t * find(const lvar_locator_t &ll)
Find variable at the specified location.
int find_lvar(const vdloc_t &location, int width, int defblk=-1) const
Find variable at the specified location.
int find_input_lvar(const vdloc_t &argloc, int _size)
Find input variable at the specified location.
Item iterator for mba_ranges_t.
Chunk iterator for mba_ranges_t.
Ranges to decompile. Either a function or an explicit vector of ranges.
rangevec_t ranges
snippet mode: ranges to decompile.
func_t * pfn
function to decompile. if not null, then function mode.
Generic microcode generator class.
virtual merror_t apply(codegen_t &cdg)=0
generate microcode for an instruction
virtual bool match(codegen_t &cdg)=0
check if the filter object is to be applied
Micro instruction visitor.
bool prune
Should skip sub-operands of the current operand? visit_mop() may set 'prune=true' for that.
The context info used by visitors.
ea_t ea
address of the original processor instruction
int opnum
operand number in the instruction
User defined callback to optimize microcode blocks.
virtual int func(mblock_t *blk)=0
Optimize a block.
User defined callback to optimize individual microcode instructions.
virtual int func(mblock_t *blk, minsn_t *ins, int optflags)=0
Optimize an instruction.
Helper class to convert cfunc_t into a text string.
bool with_tags
Generate output with color tags.
qstring & s
Reference to the output string.
qstring_printer_t(const cfunc_t *f, qstring &_s, bool tags)
Constructor.
Chunk iterator of arbitrary rangevec items.
Item iterator of arbitrary rangevec items.
Scattered operand info. Used for mop_sc.
tinfo_t type
Scattered operands always have type info assigned to them because without it we won't be able to mani...
mba_t * mba
Pointer to the parent mba_t object.
qstring name
Usually scattered operands are created from a function prototype, which has the name information.
Scattered mop: visit each of the scattered locations as a separate mop.
Reference to a stack variable. Used for mop_S.
sval_t off
Offset to the stack variable from the bottom of the stack frame.
mba_t *const mba
Pointer to the parent mba_t object.
member_t * get_stkvar(uval_t *p_off=nullptr) const
Retrieve the referenced stack variable.
Ctree location. Used to denote comment locations.
User-defined function calls.
Callback to apply the selection.
virtual bool apply(size_t opnum, const intvec_t &path, const tinfo_t &top_tif, const char *spath)=0
Select UDT for the operands using "Select offsets" widget.
uval_t offset
operand offset, will be used when calculating the UDT path
qstring text
any text for the column "Operand" of widget
Helper class to modify saved local variable settings.
virtual bool modify_lvars(lvar_uservec_t *lvinf)=0
Modify lvar settings.
Reference to a local variable.
int idx
index into lvars_t
mba_t * mba
pointer to the underlying micro array
Helper class to convert cfunc_t into text.
const cfunc_t * func
cfunc_t to generate text for
virtual bool oneliner() const newapi
Are we generating one-line text representation?
vc_printer_t(const cfunc_t *f)
Constructor.
Exception object: decompiler exception.
Exception object: decompiler internal error.
Base helper class to convert binary data structures into text.
int hdrlines
number of header lines (prototype+typedef+lvars) valid at the end of print process
Information about the pseudocode window.
bool visible() const
Is the pseudocode window visible? if not, it might be invisible or destroyed.
bool rename_label(int label)
Rename a label.
TWidget * ct
pseudocode view
bool set_strmem_type(struc_t *sptr, member_t *mptr)
Set structure field type.
merror_t last_code
result of the last user action. See Microcode error codes
bool collapse_lvars(bool hide)
Collapse/uncollapse local variable declarations.
bool set_lvar_cmt(lvar_t *v, const char *cmt)
Set local variable comment.
bool set_global_type(ea_t ea)
Set global item type.
bool refresh_cpos(input_device_t idv)
Refresh the current position.
bool set_lvar_type(lvar_t *v, const tinfo_t &type)
Set local variable type.
void refresh_ctext(bool activate=true)
Refresh pseudocode window.
ctree_item_t head
First ctree item on the current line (for block comments)
bool map_lvar(lvar_t *from, lvar_t *to)
Map a local variable to another.
bool invert_bits()
Bitwise negate a number.
bool rename_strmem(struc_t *sptr, member_t *mptr)
Rename structure field.
bool ui_map_lvar(lvar_t *v)
Map a local variable to another.
void refresh_view(bool redo_mba)
Refresh pseudocode window.
bool set_noptr_lvar(lvar_t *v)
Inform that local variable should have a non-pointer type This function permanently sets a correspond...
int get_current_label()
Get current label.
bool valid() const
Does the pseudocode window contain valid code? It can become invalid if the function type gets change...
bool ui_set_lvar_type(lvar_t *v)
Set local variable type.
void clear()
Clear the pseudocode window.
bool ui_rename_lvar(lvar_t *v)
Rename local variable.
ctree_item_t item
Current ctree item.
ctext_position_t cpos
Current ctext position.
bool invert_sign()
Negate a number.
bool in_ctree() const
Is the current item a statement?
bool edit_cmt(const treeloc_t &loc)
Edit an indented comment.
int view_idx
pseudocode window index (0..)
bool set_num_radix(int base)
Change number base.
bool edit_func_cmt()
Edit a function comment.
void switch_to(cfuncptr_t f, bool activate)
Display the specified pseudocode.
bool del_orphan_cmts()
Delete all orphan comments.
bool collapse_item(bool hide)
Collapse/uncollapse item.
mba_t * mba
pointer to underlying microcode
bool jump_enter(input_device_t idv, int omflags)
Process the Enter key.
bool split_item(bool split)
Split/unsplit item.
cfuncptr_t cfunc
pointer to function object
bool set_udm_type(tinfo_t &udt_type, int udm_idx)
Set structure field type.
bool rename_global(ea_t ea)
Rename global item.
bool rename_lvar(lvar_t *v, const char *name, bool is_user_name)
Rename local variable.
int flags
Properties of pseudocode window
cmt_type_t calc_cmt_type(size_t lnnum, cmt_type_t cmttype) const
Check if the specified line can have a comment.
bool get_current_item(input_device_t idv)
Get current item.
bool ui_set_call_type(const cexpr_t *e)
Set type of a function call This function displays a dialog box and allows the user to change the typ...
bool ctree_to_disasm()
Jump to disassembly.
bool set_num_enum()
Convert number to symbolic constant.
bool ui_edit_lvar_cmt(lvar_t *v)
Set local variable comment.
bool rename_udm(tinfo_t &udt_type, int udm_idx)
Rename structure field.
ctree_item_t tail
Tail ctree item on the current line (for indented comments)
cnumber_t * get_number()
Get current number.
bool ui_unmap_lvar(lvar_t *v)
Unmap a local variable.
bool locked() const
Does the pseudocode window contain valid code? We lock windows before modifying them,...
bool set_num_stroff()
Convert number to structure field offset.
Value interval (register or stack range)
uval_t intersect(const vivl_t &r)
Intersect value intervals the same type.
bool overlap(const vivl_t &r) const
Do two value intervals overlap?
bool contains(const voff_t &voff2) const
Does our value interval contain the specified value offset?
int size
Interval size in bytes.
bool includes(const vivl_t &r) const
Does our value interval include another?
bool extend_to_cover(const vivl_t &r)
Extend a value interval using another value interval of the same type.
Value offset (microregister number or stack offset)
sval_t off
register number or stack offset
mopt_t type
mop_r - register, mop_S - stack, mop_z - undefined