220#pragma warning(disable:4062)
221#pragma warning(disable:4265)
258typedef std::set<voff_t> voff_set_t;
272typedef std::set<ea_t> easet_t;
273typedef std::set<minsn_t *> minsn_ptr_set_t;
274typedef std::set<qstring> strings_t;
275typedef qvector<minsn_t*> minsnptrs_t;
276typedef qvector<mop_t*> mopptrs_t;
277typedef qvector<mop_t> mopvec_t;
278typedef qvector<uint64> uint64vec_t;
279typedef qvector<mreg_t> mregvec_t;
280typedef qrefcnt_t<cfunc_t> cfuncptr_t;
284#define MAX_SUPPORTED_STACK_SIZE 0x100000
289#define HEXRAYS_PLACEMENT_DELETE void operator delete(void *, void *) {}
290#define HEXRAYS_MEMORY_ALLOCATION_FUNCS() \
291 void *operator new (size_t _s) { return hexrays_alloc(_s); } \
292 void *operator new[](size_t _s) { return hexrays_alloc(_s); } \
293 void *operator new(size_t , void *_v) { return _v; } \
294 void operator delete (void *_blk) { hexrays_free(_blk); } \
295 void operator delete[](void *_blk) { hexrays_free(_blk); } \
296 HEXRAYS_PLACEMENT_DELETE
298void *
hexapi hexrays_alloc(
size_t size);
299void hexapi hexrays_free(
void *ptr);
301typedef uint64 uvlr_t;
303enum { MAX_VLR_SIZE =
sizeof(uvlr_t) };
304const uvlr_t MAX_VALUE = uvlr_t(-1);
305const svlr_t MAX_SVALUE = svlr_t(uvlr_t(-1) >> 1);
306const svlr_t MIN_SVALUE = ~MAX_SVALUE;
332#define VLR_RANGE 0x03
333#define VLR_SRANGE 0x04
337#define VLR_UNION 0x07
358 char reserved[
sizeof(qvector<int>)];
366 explicit valrng_t(
int size_ = MAX_VLR_SIZE)
367 : flags(VLR_NONE), size(size_), value(0), limit(0), stride(0) {}
371 void swap(
valrng_t &r) { qswap(*
this, r); }
373 DEFINE_MEMORY_ALLOCATION_FUNCS()
375 void set_none(
void) { clear(); }
376 void set_all(
void) { clear(); flags = VLR_ALL; }
377 void set_unk(
void) { clear(); flags = VLR_UNK; }
378 void hexapi set_eq(uvlr_t v);
379 void hexapi set_cmp(cmpop_t cmp, uvlr_t _value);
388 bool hexapi reduce_size(
int new_size);
396 bool empty(
void)
const {
return flags == VLR_NONE; }
397 bool all_values(
void)
const {
return flags == VLR_ALL; }
398 bool is_unknown(
void)
const {
return flags == VLR_UNK; }
399 bool hexapi has(uvlr_t v)
const;
401 void hexapi print(qstring *vout)
const;
402 const char *
hexapi dstr(
void)
const;
404 bool hexapi cvt_to_single_value(uvlr_t *v)
const;
405 bool hexapi cvt_to_cmp(cmpop_t *cmp, uvlr_t *val,
bool strict)
const;
407 int get_size()
const {
return size; }
408 static uvlr_t max_value(
int size_)
410 return size_ == MAX_VLR_SIZE
412 : (uvlr_t(1) << (size_ * 8)) - 1;
414 static uvlr_t min_svalue(
int size_)
416 return size_ == MAX_VLR_SIZE
418 : (uvlr_t(1) << (size_ * 8 - 1));
420 static uvlr_t max_svalue(
int size_)
422 return size_ == MAX_VLR_SIZE
424 : (uvlr_t(1) << (size_ * 8 - 1)) - 1;
426 uvlr_t max_value()
const {
return max_value(size); }
427 uvlr_t min_svalue()
const {
return min_svalue(size); }
428 uvlr_t max_svalue()
const {
return max_svalue(size); }
440typedef int maymust_t;
446 MAYMUST_ACCESS_MASK = 0x01,
448 ONE_ACCESS_TYPE = 0x20,
451 INCLUDE_SPOILED_REGS = 0x40,
453 EXCLUDE_PASS_REGS = 0x80,
458 WITH_ASSERTS = 0x200,
460 EXCLUDE_VOLATILE = 0x400,
462 INCLUDE_UNUSED_SRC = 0x800,
464 INCLUDE_DEAD_RETREGS = 0x1000,
466 INCLUDE_RESTRICTED = 0x2000,
467 CALL_SPOILS_ONLY_ARGS = 0x4000;
471inline THREAD_SAFE
bool is_may_access(maymust_t maymust)
473 return (maymust & MAYMUST_ACCESS_MASK) != MUST_ACCESS;
637inline THREAD_SAFE
bool is_mcode_addsub(mcode_t mcode) {
return mcode == m_add || mcode == m_sub; }
639inline THREAD_SAFE
bool is_mcode_xdsu(mcode_t mcode) {
return mcode == m_xds || mcode == m_xdu; }
641inline THREAD_SAFE
bool is_mcode_set(mcode_t mcode) {
return mcode >= m_sets && mcode <= m_setle; }
643inline THREAD_SAFE
bool is_mcode_set1(mcode_t mcode) {
return mcode == m_sets; }
645inline THREAD_SAFE
bool is_mcode_j1(mcode_t mcode) {
return mcode == m_jcnd; }
647inline THREAD_SAFE
bool is_mcode_jcond(mcode_t mcode) {
return mcode >= m_jcnd && mcode <= m_jle; }
649inline THREAD_SAFE
bool is_mcode_convertible_to_jmp(mcode_t mcode) {
return mcode >= m_setnz && mcode <= m_setle; }
651inline THREAD_SAFE
bool is_mcode_convertible_to_set(mcode_t mcode) {
return mcode >= m_jnz && mcode <= m_jle; }
653inline THREAD_SAFE
bool is_mcode_call(mcode_t mcode) {
return mcode == m_call || mcode == m_icall; }
655inline THREAD_SAFE
bool is_mcode_fpu(mcode_t mcode) {
return mcode >= m_f2i; }
657inline THREAD_SAFE
bool is_mcode_commutative(mcode_t mcode)
659 return mcode == m_add
670inline THREAD_SAFE
bool is_mcode_shift(mcode_t mcode)
672 return mcode == m_shl
677inline THREAD_SAFE
bool is_mcode_divmod(mcode_t op)
679 return op == m_udiv || op == m_sdiv || op == m_umod || op == m_smod;
682inline THREAD_SAFE
bool has_mcode_seloff(mcode_t op)
684 return op == m_ldx || op == m_stx || op == m_icall || op == m_ijmp;
689inline THREAD_SAFE mcode_t set2jcnd(mcode_t code)
691 return mcode_t(code - m_setnz + m_jnz);
696inline THREAD_SAFE mcode_t jcnd2set(mcode_t code)
698 return mcode_t(code + m_setnz - m_jnz);
705THREAD_SAFE mcode_t
hexapi negate_mcode_relation(mcode_t code);
714THREAD_SAFE mcode_t
hexapi swap_mcode_relation(mcode_t code);
720THREAD_SAFE mcode_t
hexapi get_signed_mcode(mcode_t code);
727THREAD_SAFE mcode_t
hexapi get_unsigned_mcode(mcode_t code);
730inline THREAD_SAFE
bool is_signed_mcode(mcode_t code) {
return get_unsigned_mcode(code) != code; }
732inline THREAD_SAFE
bool is_unsigned_mcode(mcode_t code) {
return get_signed_mcode(code) != code; }
741THREAD_SAFE
bool hexapi mcode_modifies_d(mcode_t mcode);
752const int cc_count = mr_pf - mr_cf + 1;
771 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
786#define NF_NEGDONE 0x02
787#define NF_BINVDONE 0x04
788#define NF_NEGATE 0x08
789#define NF_BITNOT 0x10
833 bool has_unmutable_type()
const
837 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
858 AS_PRINTF(3, 4) virtual
int hexapi print(
int indent, const
char *format,...);
859 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
871 virtual bool idaapi
oneliner(
void)
const newapi {
return false; }
885 AS_PRINTF(3, 4) int
hexapi print(
int indent, const
char *format, ...) override;
905 AS_PRINTF(3, 4) int
hexapi print(
int indent, const
char *format, ...) override;
947 return is_type_ptr(t) || is_type_array(t);
959 return type.is_decl_complex() && !type.is_typeref();
1031 tif.create_typedef(
nullptr, n);
1042 TS_NOELL = 0x8000000,
1043 TS_SHRINK = 0x4000000,
1044 TS_DONTREF = 0x2000000,
1045 TS_MASK = 0xE000000,
1087 int reg1(
void)
const {
return atype() == ALOC_REG2 ? argloc_t::reg1() : get_reginfo(); }
1092 void _set_reg1(
int r1) { argloc_t::_set_reg1(r1, r1>>16); }
1095 void set_reg1(
int r1) { cleanup_argloc(
this); _set_reg1(r1); }
1104 bool hexapi is_aliasable(
const mba_t *mb,
int size)
const;
1134 return location.is_stkoff() ? location.stkoff() : -1;
1137 bool is_reg1(
void)
const {
return location.is_reg1(); }
1139 bool is_reg2(
void)
const {
return location.is_reg2(); }
1151 const scattered_aloc_t &
get_scattered(
void)
const {
return location.scattered(); }
1152 scattered_aloc_t &get_scattered(
void) {
return location.scattered(); }
1154 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
1167#define CVAR_USED 0x00000001
1168#define CVAR_TYPE 0x00000002
1169#define CVAR_NAME 0x00000004
1170#define CVAR_MREG 0x00000008
1171#define CVAR_NOWD 0x00000010
1172#define CVAR_UNAME 0x00000020
1173#define CVAR_UTYPE 0x00000040
1174#define CVAR_RESULT 0x00000080
1175#define CVAR_ARG 0x00000100
1176#define CVAR_FAKE 0x00000200
1177#define CVAR_OVER 0x00000400
1178#define CVAR_FLOAT 0x00000800
1179#define CVAR_SPOILED 0x00001000
1180#define CVAR_MAPDST 0x00002000
1181#define CVAR_PARTIAL 0x00004000
1182#define CVAR_THISARG 0x00008000
1183#define CVAR_FORCED 0x00010000
1185#define CVAR_REGNAME 0x00020000
1187#define CVAR_NOPTR 0x00040000
1188#define CVAR_DUMMY 0x00080000
1190#define CVAR_NOTARG 0x00100000
1191#define CVAR_AUTOMAP 0x00200000
1192#define CVAR_BYREF 0x00400000
1193#define CVAR_INASM 0x00800000
1195#define CVAR_UNUSED 0x01000000
1197#define CVAR_SHARED 0x02000000
1212 lvar_t(
const qstring &n,
const vdloc_t &l, ea_t e,
const tinfo_t &t,
int w,
int db)
1244 bool hexapi is_promoted_arg(
void)
const;
1279 void set_used(
void) { flags |=
CVAR_USED; }
1280 void clear_used(
void) { flags &= ~CVAR_USED; }
1281 void set_typed(
void) { flags |=
CVAR_TYPE; clr_noptr_var(); }
1282 void set_non_typed(
void) { flags &= ~CVAR_TYPE; }
1286 void clr_user_type(
void) { flags &= ~CVAR_UTYPE; }
1287 void clr_user_name(
void) { flags &= ~CVAR_UNAME; }
1288 void set_mreg_done(
void) { flags |=
CVAR_MREG; }
1289 void clr_mreg_done(
void) { flags &= ~CVAR_MREG; }
1290 void set_unknown_width(
void) { flags |=
CVAR_NOWD; }
1291 void clr_unknown_width(
void) { flags &= ~CVAR_NOWD; }
1292 void set_arg_var(
void) { flags |=
CVAR_ARG; }
1294 void set_fake_var(
void) { flags |=
CVAR_FAKE; }
1295 void clr_fake_var(
void) { flags &= ~CVAR_FAKE; }
1296 void set_overlapped_var(
void) { flags |=
CVAR_OVER; }
1297 void clr_overlapped_var(
void) { flags &= ~CVAR_OVER; }
1298 void set_floating_var(
void) { flags |=
CVAR_FLOAT; }
1299 void clr_floating_var(
void) { flags &= ~CVAR_FLOAT; }
1301 void clr_spoiled_var(
void) { flags &= ~CVAR_SPOILED; }
1302 void set_mapdst_var(
void) { flags |=
CVAR_MAPDST; }
1303 void clr_mapdst_var(
void) { flags &= ~CVAR_MAPDST; }
1304 void set_partialy_typed(
void) { flags |=
CVAR_PARTIAL; }
1305 void clr_partialy_typed(
void) { flags &= ~CVAR_PARTIAL; }
1306 void set_noptr_var(
void) { flags |=
CVAR_NOPTR; }
1307 void clr_noptr_var(
void) { flags &= ~CVAR_NOPTR; }
1309 void clr_thisarg(
void) { flags &= ~CVAR_THISARG; }
1310 void set_forced_var(
void) { flags |=
CVAR_FORCED; }
1311 void clr_forced_var(
void) { flags &= ~CVAR_FORCED; }
1312 void set_dummy_arg(
void) { flags |=
CVAR_DUMMY; }
1313 void clr_dummy_arg(
void) { flags &= ~CVAR_DUMMY; }
1314 void set_notarg(
void) { clr_arg_var(); flags |=
CVAR_NOTARG; }
1315 void clr_notarg(
void) { flags &= ~CVAR_NOTARG; }
1317 void clr_automapped(
void) { flags &= ~CVAR_AUTOMAP; }
1318 void set_used_byref(
void) { flags |=
CVAR_BYREF; }
1319 void clr_used_byref(
void) { flags &= ~CVAR_BYREF; }
1320 void set_decl_unused(
void) { flags |=
CVAR_UNUSED; }
1321 void clr_decl_unused(
void) { flags &= ~CVAR_UNUSED; }
1323 void clr_shared(
void) { flags &= ~CVAR_SHARED; }
1336 const tinfo_t &
type(
void)
const {
return tif; }
1337 tinfo_t &type(
void) {
return tif; }
1341 bool hexapi accepts_type(
const tinfo_t &t,
bool may_change_thisarg=
false);
1352 bool hexapi set_lvar_type(
const tinfo_t &t,
bool may_fail=
false);
1367 bool hexapi set_width(
int w,
int svw_flags=0);
1369#define SVW_FLOAT 0x01
1370#define SVW_SOFT 0x02
1377 void hexapi append_list(
const mba_t *mba,
mlist_t *lst,
bool pad_if_scattered=
false)
const;
1384 return location.is_aliasable(mba, width);
1388DECLARE_TYPE_AS_MOVABLE(
lvar_t);
1404 int hexapi find_stkvar(sval_t spoff,
int width);
1418 int hexapi find_lvar(
const vdloc_t &location,
int width,
int defblk=-1)
const;
1433#define LVINF_KEEP 0x0001
1439#define LVINF_FORCE 0x0002
1442#define LVINF_NOPTR 0x0004
1443#define LVINF_NOMAP 0x0008
1444#define LVINF_UNUSED 0x0010
1446 lvar_saved_info_t(void) : size(BADSIZE), flags(0) {}
1447 bool has_info(
void)
const
1449 return !name.empty()
1458 return name == r.
name
1464 bool is_kept(
void)
const {
return (flags &
LVINF_KEEP) != 0; }
1465 void clear_keep(
void) { flags &= ~LVINF_KEEP; }
1467 bool is_forced_lvar(
void)
const {
return (flags &
LVINF_FORCE) != 0; }
1468 void set_forced_lvar(
void) { flags |=
LVINF_FORCE; }
1469 void clr_forced_lvar(
void) { flags &= ~LVINF_FORCE; }
1470 bool is_noptr_lvar(
void)
const {
return (flags &
LVINF_NOPTR) != 0; }
1471 void set_noptr_lvar(
void) { flags |=
LVINF_NOPTR; }
1472 void clr_noptr_lvar(
void) { flags &= ~LVINF_NOPTR; }
1473 bool is_nomap_lvar(
void)
const {
return (flags &
LVINF_NOMAP) != 0; }
1474 void set_nomap_lvar(
void) { flags |=
LVINF_NOMAP; }
1475 void clr_nomap_lvar(
void) { flags &= ~LVINF_NOMAP; }
1476 bool is_unused_lvar(
void)
const {
return (flags &
LVINF_UNUSED) != 0; }
1478 void clr_unused_lvar(
void) { flags &= ~LVINF_UNUSED; }
1481typedef qvector<lvar_saved_info_t> lvar_saved_infos_t;
1505#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;
1730 void hexapi cleanup(
void);
1735 bool hexapi init(
const char *decl);
1738 bool empty(
void)
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;
1754 bitset_t(
void) : bitmap(
nullptr), high(0) {}
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(
void)
const;
1785 int hexapi count(
void)
const;
1786 int hexapi count(
int bit)
const;
1787 int hexapi last(
void)
const;
1788 void clear(
void) { 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*(
void)
const {
return i; }
1810 iterator begin(
void)
const {
return itat(0); }
1811 iterator end(
void)
const {
return iterator(high); }
1812 int front(
void)
const {
return *begin(); }
1813 int back(
void)
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(
void)
const {
return size == 0; }
1847 void clear(
void) { 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(
void)
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(
void)
const {
return bag.back(); }
1940 size_t nivls(
void)
const {
return bag.size(); }
1941 bool empty(
void)
const {
return bag.empty(); }
1942 void clear(
void) { bag.clear(); }
1943 void qclear(
void) { 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(
void)
const {
return bag.begin(); }
1955 const_iterator end(
void)
const {
return bag.end(); }
1956 iterator begin(
void) {
return bag.begin(); }
1957 iterator end(
void) {
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(
void)
const;
1983 bool hexapi contains(uval_t off)
const;
1991typedef qvector<ivlset_t> array_of_ivlsets;
2005 void hexapi print(qstring *vout)
const;
2008DECLARE_TYPE_AS_MOVABLE(
rlist_t);
2021 void swap(
mlist_t &r) { reg.swap(r.reg); mem.swap(r.mem); }
2022 bool hexapi addmem(ea_t ea, asize_t size);
2023 bool add(
mreg_t r,
int size) {
return add(
mlist_t(r, size)); }
2024 bool add(
const rlist_t &r) {
return reg.add(r); }
2025 bool add(
const ivl_t &ivl) {
return add(
mlist_t(ivl)); }
2026 bool add(
const mlist_t &lst) {
return reg.add(lst.reg) | mem.add(lst.mem); }
2027 bool sub(
mreg_t r,
int size) {
return sub(
mlist_t(r, size)); }
2028 bool sub(
const ivl_t &ivl) {
return sub(
mlist_t(ivl)); }
2029 bool sub(
const mlist_t &lst) {
return reg.sub(lst.reg) | mem.sub(lst.mem); }
2030 asize_t count(
void)
const {
return reg.count() + mem.count(); }
2031 void hexapi print(qstring *vout)
const;
2033 bool empty(
void)
const {
return reg.empty() && mem.empty(); }
2034 void clear(
void) { reg.clear(); mem.clear(); }
2035 bool has(
mreg_t r)
const {
return reg.has(r); }
2036 bool has_all(
mreg_t r,
int size)
const {
return reg.has_all(r, size); }
2037 bool has_any(
mreg_t r,
int size)
const {
return reg.has_any(r, size); }
2038 bool has_memory(
void)
const {
return !mem.empty(); }
2039 bool has_allmem(
void)
const {
return mem == ALLMEM; }
2040 bool has_common(
const mlist_t &lst)
const {
return reg.has_common(lst.reg) || mem.has_common(lst.mem); }
2041 bool includes(
const mlist_t &lst)
const {
return reg.includes(lst.reg) && mem.includes(lst.mem); }
2042 bool intersect(
const mlist_t &lst) {
return reg.intersect(lst.reg) | mem.intersect(lst.mem); }
2043 bool is_subset_of(
const mlist_t &lst)
const {
return lst.includes(*
this); }
2046 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
2048DECLARE_TYPE_AS_MOVABLE(
mlist_t);
2049typedef qvector<mlist_t> mlistvec_t;
2050DECLARE_TYPE_AS_MOVABLE(mlistvec_t);
2155 bool colored_gdl_edges;
2157 friend class iterator;
2158 virtual int goup(
int node)
const newapi;
2179 mba_t *_mba=
nullptr,
2182 : mba(_mba), blk(_blk), topins(_topins), curins(
nullptr) {}
2183 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
2184 bool really_alloc(
void)
const;
2193 mba_t *_mba=
nullptr,
2197 virtual int idaapi visit_minsn(
void) = 0;
2206 mba_t *_mba=
nullptr,
2213 virtual int idaapi visit_mop(
mop_t *op,
const tinfo_t *type,
bool is_target) = 0;
2220 virtual int idaapi visit_scif_mop(
const mop_t &r,
int off) = 0;
2231 mlist_mop_visitor_t(
void): topins(
nullptr), curins(
nullptr), changed(
false), list(
nullptr) {}
2232 virtual int idaapi visit_mop(
mop_t *op) = 0;
2282 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
2285 std::swap(off, r.off);
2286 std::swap(idx, r.idx);
2307 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
2310 std::swap(off, r.off);
2315 member_t *
hexapi get_stkvar(uval_t *p_off=
nullptr)
const;
2338 scif_t(
mba_t *_mba, tinfo_t *tif, qstring *n=
nullptr) : mba(_mba)
2358 mnumber_t(uint64 v, ea_t _ea=BADADDR,
int n=0)
2360 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
2363 if ( value < r.value )
2365 if ( value > r.value )
2370 void update_value(uint64 val64)
2384 operator uint16 *(void) {
return fnum.w; }
2385 operator const uint16 *(void)
const {
return fnum.w; }
2386 void hexapi print(qstring *vout)
const;
2388 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
2391 return ecmp(fnum, r.fnum);
2398#define SHINS_NUMADDR 0x01
2399#define SHINS_VALNUM 0x02
2400#define SHINS_SHORT 0x04
2401#define SHINS_LDXEA 0x08
2434#define OPROP_IMPDONE 0x01
2435#define OPROP_UDT 0x02
2436#define OPROP_FLOAT 0x04
2437#define OPROP_CCFLAGS 0x08
2439#define OPROP_UDEFVAL 0x10
2440#define OPROP_LOWADDR 0x20
2476 void set_udt(
void) { oprops |=
OPROP_UDT; }
2479 bool is_impptr_done(
void)
const {
return (oprops &
OPROP_IMPDONE) != 0; }
2480 bool is_udt(
void)
const {
return (oprops &
OPROP_UDT) != 0; }
2481 bool probably_floating(
void)
const {
return (oprops &
OPROP_FLOAT) != 0; }
2482 bool is_undef_val(
void)
const {
return (oprops &
OPROP_UDEFVAL) != 0; }
2483 bool is_lowaddr(
void)
const {
return (oprops &
OPROP_LOWADDR) != 0; }
2484 bool is_ccflags(
void)
const
2489 bool is_pcval(
void)
const
2494 mop_t(
void) { zero(); }
2496 mop_t(
mreg_t _r,
int _s) : t(
mop_r), oprops(0), valnum(0), size(_s), r(_r) {}
2497 mop_t &operator=(
const mop_t &rop) {
return assign(rop); }
2503 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
2504 void zero(
void) { t =
mop_z; oprops = 0; valnum = 0; size =
NOSIZE; nnn =
nullptr; }
2507 void erase_but_keep_size(
void) {
int s2 = size; erase(); size = s2; }
2552 void hexapi create_from_scattered_vdloc(
2570 void hexapi make_number(uint64 _value,
int _size, ea_t _ea=BADADDR,
int opnum=0);
2577 bool hexapi make_fpnum(
const void *bytes,
size_t _size);
2588 void _make_reg(
mreg_t reg,
int _size)
2596 void make_reg(
mreg_t reg,
int _size) { erase(); _make_reg(reg, _size); }
2614 void hexapi _make_gvar(ea_t ea);
2616 void hexapi make_gvar(ea_t ea);
2628 void make_stkvar(
mba_t *mba, sval_t off) { erase(); _make_stkvar(mba, off); }
2634 void hexapi make_reg_pair(
int loreg,
int hireg,
int halfsize);
2641 void _make_insn(
minsn_t *ins);
2660 void hexapi make_helper(
const char *name);
2666 cstr = ::qstrdup(str);
2668 void _make_strlit(qstring *str)
2671 cstr = str->extract();
2705 bool empty(
void)
const {
return t ==
mop_z; }
2716 bool is_cc(
void)
const {
return is_reg() && r >= mr_cf && r < mr_first; }
2720 bool is_bit_reg(
void)
const {
return is_reg() && is_bit_reg(r); }
2728 bool is_glbaddr()
const;
2730 bool is_glbaddr(ea_t ea)
const;
2732 bool is_stkaddr()
const;
2736 bool is_insn(mcode_t code)
const;
2739 bool has_side_effects(
bool include_ldx_and_divs=
false)
const;
2741 bool hexapi may_use_aliased_memory(
void)
const;
2746 bool hexapi is01(
void)
const;
2753 bool hexapi is_sign_extended_from(
int nbytes)
const;
2760 bool hexapi is_zero_extended_from(
int nbytes)
const;
2766 return is_sign_extended_from(nbytes);
2768 return is_zero_extended_from(nbytes);
2778 bool hexapi equal_mops(
const mop_t &rop,
int eqflags)
const;
2779 bool operator==(
const mop_t &rop)
const {
return equal_mops(rop, 0); }
2780 bool operator!=(
const mop_t &rop)
const {
return !equal_mops(rop, 0); }
2784 bool operator <(
const mop_t &rop)
const {
return lexcompare(rop) < 0; }
2785 friend int lexcompare(
const mop_t &a,
const mop_t &b) {
return a.lexcompare(b); }
2798 const tinfo_t *type=
nullptr,
2799 bool is_target=
false);
2814 uint64
value(
bool is_signed)
const {
return extend_sign(nnn->value, size, is_signed); }
2815 int64 signed_value(
void)
const {
return value(
true); }
2816 uint64 unsigned_value(
void)
const {
return value(
false); }
2817 void update_numop_value(uint64 val)
2819 nnn->update_value(extend_sign(val, size,
false));
2826 bool hexapi is_constant(uint64 *out=
nullptr,
bool is_signed=
true)
const;
2828 bool is_equal_to(uint64 n,
bool is_signed=
true)
const
2831 return is_constant(&v, is_signed) && v == n;
2833 bool is_zero(
void)
const {
return is_equal_to(0,
false); }
2834 bool is_one(
void)
const {
return is_equal_to(1,
false); }
2835 bool is_positive_constant(
void)
const
2838 return is_constant(&v,
true) && int64(v) > 0;
2840 bool is_negative_constant(
void)
const
2843 return is_constant(&v,
true) && int64(v) < 0;
2852 member_t *
get_stkvar(uval_t *p_off)
const {
return s->get_stkvar(p_off); }
2859 bool hexapi get_stkoff(sval_t *p_off)
const;
2868 const minsn_t *get_insn(mcode_t code)
const;
2869 minsn_t *get_insn(mcode_t code);
2878 bool hexapi make_low_half(
int width);
2884 bool hexapi make_high_half(
int width);
2890 bool hexapi make_first_half(
int width);
2896 bool hexapi make_second_half(
int width);
2907 bool hexapi shift_mop(
int offset);
2933 bool hexapi preserve_side_effects(
2936 bool *moved_calls=
nullptr);
2944 void hexapi apply_ld_mcode(mcode_t mcode, ea_t ea,
int newsize);
2945 void apply_xdu(ea_t ea,
int newsize) { apply_ld_mcode(m_xdu, ea, newsize); }
2946 void apply_xds(ea_t ea,
int newsize) { apply_ld_mcode(m_xds, ea, newsize); }
2948DECLARE_TYPE_AS_MOVABLE(
mop_t);
2956 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
2968 :
mop_t(ra), insize(ra.insize), outsize(ra.outsize) {}
2970 :
mop_t(ra), insize(isz), outsize(osz) {}
2975 insize = rop.insize;
2976 outsize = rop.outsize;
2981 int code = mop_t::lexcompare(ra);
2982 return code != 0 ? code
2983 : insize != ra.insize ? (insize-ra.insize)
2984 : outsize != ra.outsize ? (outsize-ra.outsize)
3002 void copy_mop(
const mop_t &op) { *(
mop_t *)
this = op; }
3005 void hexapi set_regarg(
mreg_t mr,
int sz,
const tinfo_t &tif);
3006 void set_regarg(
mreg_t mr,
const tinfo_t &tif)
3008 set_regarg(mr, tif.get_size(), tif);
3010 void set_regarg(
mreg_t mr,
char dt, type_sign_t sign = type_unsigned)
3012 int sz = get_dtype_size(dt);
3015 void make_int(
int val, ea_t val_ea,
int opno = 0)
3017 type = tinfo_t(BTF_INT);
3018 make_number(val, inf_get_cc_size_i(), val_ea, opno);
3020 void make_uint(
int val, ea_t val_ea,
int opno = 0)
3022 type = tinfo_t(BTF_UINT);
3023 make_number(val, inf_get_cc_size_i(), val_ea, opno);
3027typedef qvector<mcallarg_t> mcallargs_t;
3079#define FUNC_NAME_MEMCPY "memcpy"
3080#define FUNC_NAME_WMEMCPY "wmemcpy"
3081#define FUNC_NAME_MEMSET "memset"
3082#define FUNC_NAME_WMEMSET "wmemset"
3083#define FUNC_NAME_MEMSET32 "memset32"
3084#define FUNC_NAME_MEMSET64 "memset64"
3085#define FUNC_NAME_STRCPY "strcpy"
3086#define FUNC_NAME_WCSCPY "wcscpy"
3087#define FUNC_NAME_STRLEN "strlen"
3088#define FUNC_NAME_WCSLEN "wcslen"
3089#define FUNC_NAME_STRCAT "strcat"
3090#define FUNC_NAME_WCSCAT "wcscat"
3091#define FUNC_NAME_TAIL "tail"
3092#define FUNC_NAME_VA_ARG "va_arg"
3093#define FUNC_NAME_EMPTY "$empty"
3094#define FUNC_NAME_PRESENT "$present"
3095#define FUNC_NAME_CONTAINING_RECORD "CONTAINING_RECORD"
3101#define MAX_FUNC_ARGS 64
3131#define FCI_PROP 0x001
3132#define FCI_DEAD 0x002
3133#define FCI_FINAL 0x004
3134#define FCI_NORET 0x008
3135#define FCI_PURE 0x010
3136#define FCI_NOSIDE 0x020
3137#define FCI_SPLOK 0x040
3142#define FCI_HASCALL 0x080
3145#define FCI_HASFMT 0x100
3147#define FCI_EXPLOCS 0x400
3153 : callee(_callee), solid_args(_sargs), call_spd(0), stkargs_top(0),
3154 cc(CM_CC_INVALID), flags(0), role(
ROLE_UNK) {}
3155 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
3159 bool is_vararg(
void)
const {
return is_vararg_cc(cc); }
3173 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
3174 bool empty(
void)
const {
return targets.empty(); }
3175 size_t size(
void)
const {
return targets.size(); }
3176 void resize(
int s) { values.resize(s); targets.resize(s); }
3177 void hexapi print(qstring *vout)
const;
3189 voff_t(
mopt_t _type, sval_t _off) : off(_off), type(_type) {}
3196 void set(
mopt_t _type, sval_t _off) { type = _type; off = _off; }
3197 void set_stkoff(sval_t stkoff) { set(
mop_S, stkoff); }
3199 void undef() { set(
mop_z, -1); }
3201 bool defined()
const {
return type !=
mop_z; }
3202 bool is_reg()
const {
return type ==
mop_r; }
3203 bool is_stkoff()
const {
return type ==
mop_S; }
3204 mreg_t get_reg()
const { QASSERT(51892, is_reg());
return off; }
3205 sval_t get_stkoff()
const { QASSERT(51893, is_stkoff());
return off; }
3207 void inc(sval_t delta) { off += delta; }
3208 voff_t add(
int width)
const {
return voff_t(type, off+width); }
3209 sval_t diff(
const voff_t &r)
const { QASSERT(51894, type == r.
type);
return off - r.
off; }
3211 DECLARE_COMPARISONS(
voff_t)
3213 int code = ::compare(type, r.type);
3214 return code != 0 ? code : ::compare(off, r.off);
3225 :
voff_t(_type, _off), size(_size) {}
3230 void set(
mopt_t _type, sval_t _off,
int _size = 0)
3231 { voff_t::set(_type, _off); size = _size; }
3232 void set(
const voff_t &voff,
int _size)
3233 { set(voff.
type, voff.
off, _size); }
3234 void set_stkoff(sval_t stkoff,
int sz = 0) { set(
mop_S, stkoff, sz); }
3235 void set_reg (
mreg_t mreg,
int sz = 0) { set(
mop_r, mreg, sz); }
3248 return type == r.
type
3249 && interval::overlap(off, size, r.
off, r.
size);
3254 return type == r.
type
3255 && interval::includes(off, size, r.
off, r.
size);
3261 return type == voff2.
type
3262 && interval::contains(off, size, voff2.
off);
3266 DECLARE_COMPARISONS(
vivl_t)
3268 int code = voff_t::compare(r);
3271 bool operator==(
const mop_t &mop)
const
3273 return type == mop.
t && off == (mop.
is_reg() ? mop.r : mop.s->
off);
3275 void hexapi print(qstring *vout)
const;
3294#define CHF_INITED 0x01
3295#define CHF_REPLACED 0x02
3296#define CHF_OVER 0x04
3297#define CHF_FAKE 0x08
3298#define CHF_PASSTHRU 0x10
3299#define CHF_TERM 0x20
3301 chain_t() : width(0), varnum(-1), flags(CHF_INITED) {}
3303 : k(t, off), width(w), varnum(v), flags(
CHF_INITED) {}
3305 : k(_k), width(w), varnum(-1), flags(
CHF_INITED) {}
3306 void set_value(
const chain_t &r)
3307 { width = r.
width; varnum = r.
varnum; flags = r.
flags; *(intvec_t *)
this = (intvec_t &)r; }
3308 const voff_t &key()
const {
return k; }
3309 bool is_inited(
void)
const {
return (flags &
CHF_INITED) != 0; }
3310 bool is_reg(
void)
const {
return k.is_reg(); }
3311 bool is_stkoff(
void)
const {
return k.is_stkoff(); }
3312 bool is_replaced(
void)
const {
return (flags &
CHF_REPLACED) != 0; }
3313 bool is_overlapped(
void)
const {
return (flags &
CHF_OVER) != 0; }
3314 bool is_fake(
void)
const {
return (flags &
CHF_FAKE) != 0; }
3315 bool is_passreg(
void)
const {
return (flags &
CHF_PASSTHRU) != 0; }
3316 bool is_term(
void)
const {
return (flags &
CHF_TERM) != 0; }
3317 void set_inited(
bool b) { setflag(flags,
CHF_INITED, b); }
3318 void set_replaced(
bool b) { setflag(flags,
CHF_REPLACED, b); }
3319 void set_overlapped(
bool b) { setflag(flags,
CHF_OVER, b); }
3320 void set_term(
bool b) { setflag(flags,
CHF_TERM, b); }
3321 mreg_t get_reg()
const {
return k.get_reg(); }
3322 sval_t get_stkoff()
const {
return k.get_stkoff(); }
3323 bool overlap(
const chain_t &r)
const
3325 bool includes(
const chain_t &r)
const
3327 const voff_t endoff()
const {
return k.add(width); }
3329 bool operator<(
const chain_t &r)
const {
return key() < r.key(); }
3331 void hexapi print(qstring *vout)
const;
3335 void clear_varnum(
void) { varnum = -1; set_replaced(
false); }
3340#define SIZEOF_BLOCK_CHAINS 24
3341#elif defined(__MAC__)
3342#define SIZEOF_BLOCK_CHAINS 32
3344#define SIZEOF_BLOCK_CHAINS 56
3354 size_t body[SIZEOF_BLOCK_CHAINS/
sizeof(size_t)];
3370 chain_t *get_stk_chain(sval_t off,
int width=1)
3377 {
return get_chain(
chain_t(k, width)); }
3387 void hexapi print(qstring *vout)
const;
3389 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
3397 virtual int idaapi visit_chain(
int nblock,
chain_t &ch) = 0;
3416#define GCA_EMPTY 0x01
3417#define GCA_SPEC 0x02
3418#define GCA_ALLOC 0x04
3419#define GCA_NALLOC 0x08
3420#define GCA_OFIRST 0x10
3421#define GCA_OLAST 0x20
3431 void hexapi release(
void);
3434 qvector<block_chains_t>::swap(r);
3435 std::swap(lock, r.lock);
3442 void hexapi init(ea_t _ea);
3457#define IPROP_OPTIONAL 0x0001
3458#define IPROP_PERSIST 0x0002
3459#define IPROP_WILDMATCH 0x0004
3462#define IPROP_CLNPOP 0x0008
3464#define IPROP_FPINSN 0x0010
3465#define IPROP_FARCALL 0x0020
3466#define IPROP_TAILCALL 0x0040
3467#define IPROP_ASSERT 0x0080
3472#define IPROP_SPLIT 0x0700
3473#define IPROP_SPLIT1 0x0100
3474#define IPROP_SPLIT2 0x0200
3475#define IPROP_SPLIT4 0x0300
3476#define IPROP_SPLIT8 0x0400
3477#define IPROP_COMBINED 0x0800
3478#define IPROP_EXTSTX 0x1000
3479#define IPROP_IGNLOWSRC 0x2000
3482#define IPROP_INV_JX 0x4000
3483#define IPROP_WAS_NORET 0x8000
3484#define IPROP_MULTI_MOV 0x10000
3488#define IPROP_DONT_PROP 0x20000
3489#define IPROP_DONT_COMB 0x40000
3490#define IPROP_MBARRIER 0x80000
3492#define IPROP_UNMERGED 0x100000
3495 bool is_optional(
void)
const {
return (iprops &
IPROP_OPTIONAL) != 0; }
3496 bool is_combined(
void)
const {
return (iprops &
IPROP_COMBINED) != 0; }
3497 bool is_farcall(
void)
const {
return (iprops &
IPROP_FARCALL) != 0; }
3498 bool is_cleaning_pop(
void)
const {
return (iprops &
IPROP_CLNPOP) != 0; }
3499 bool is_extstx(
void)
const {
return (iprops &
IPROP_EXTSTX) != 0; }
3500 bool is_tailcall(
void)
const {
return (iprops &
IPROP_TAILCALL) != 0; }
3501 bool is_fpinsn(
void)
const {
return (iprops &
IPROP_FPINSN) != 0; }
3502 bool is_assert(
void)
const {
return (iprops &
IPROP_ASSERT) != 0; }
3503 bool is_persistent(
void)
const {
return (iprops &
IPROP_PERSIST) != 0; }
3504 bool is_wild_match(
void)
const {
return (iprops &
IPROP_WILDMATCH) != 0; }
3505 bool is_propagatable(
void)
const {
return (iprops &
IPROP_DONT_PROP) == 0; }
3506 bool is_ignlowsrc(
void)
const {
return (iprops &
IPROP_IGNLOWSRC) != 0; }
3507 bool is_inverted_jx(
void)
const {
return (iprops &
IPROP_INV_JX) != 0; }
3508 bool was_noret_icall(
void)
const {
return (iprops &
IPROP_WAS_NORET) != 0; }
3509 bool is_multimov(
void)
const {
return (iprops &
IPROP_MULTI_MOV) != 0; }
3510 bool is_combinable(
void)
const {
return (iprops &
IPROP_DONT_COMB) == 0; }
3511 bool was_split(
void)
const {
return (iprops &
IPROP_SPLIT) != 0; }
3512 bool is_mbarrier(
void)
const {
return (iprops &
IPROP_MBARRIER) != 0; }
3513 bool was_unmerged(
void)
const {
return (iprops &
IPROP_UNMERGED) != 0; }
3516 void hexapi set_combined(
void);
3517 void clr_combined(
void) { iprops &= ~IPROP_COMBINED; }
3519 void set_cleaning_pop(
void) { iprops |=
IPROP_CLNPOP; }
3522 void clr_tailcall(
void) { iprops &= ~IPROP_TAILCALL; }
3524 void clr_fpinsn(
void) { iprops &= ~IPROP_FPINSN; }
3526 void clr_assert(
void) { iprops &= ~IPROP_ASSERT; }
3531 void clr_ignlowsrc(
void) { iprops &= ~IPROP_IGNLOWSRC; }
3534 void clr_noret_icall(
void) { iprops &= ~IPROP_WAS_NORET; }
3536 void clr_multimov(
void) { iprops &= ~IPROP_MULTI_MOV; }
3537 void set_combinable(
void) { iprops &= ~IPROP_DONT_COMB; }
3541 void set_split_size(
int s)
3543 iprops &= ~IPROP_SPLIT;
3549 int get_split_size(
void)
const
3552 return cnt == 0 ? 0 : 1 << (cnt-1);
3558 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
3576 void hexapi setaddr(ea_t new_ea);
3585 int optimize_solo(
int optflags=0) {
return optimize_subtree(
nullptr,
nullptr,
nullptr,
nullptr, optflags); }
3588#define OPTI_ADDREXPRS 0x0001
3589#define OPTI_MINSTKREF 0x0002
3590#define OPTI_COMBINSNS 0x0004
3591#define OPTI_NO_LDXOPT 0x0008
3598 int hexapi optimize_subtree(
3602 ea_t *converted_call,
3621 void hexapi _make_nop(
void);
3627 bool hexapi equal_insns(
const minsn_t &m,
int eqflags)
const;
3630#define EQ_IGNSIZE 0x0001
3631#define EQ_IGNCODE 0x0002
3632#define EQ_CMPDEST 0x0004
3633#define EQ_OPTINSN 0x0008
3638 bool operator <(
const minsn_t &ri)
const {
return lexcompare(ri) < 0; }
3646 bool hexapi is_noret_call(
int flags=0);
3647#define NORET_IGNORE_WAS_NORET_ICALL 0x01
3648#define NORET_FORBID_ANALYSIS 0x02
3661 bool hexapi is_helper(
const char *name)
const;
3669 bool contains_call(
bool with_helpers=
false)
const {
return find_call(with_helpers) !=
nullptr; }
3675 bool hexapi has_side_effects(
bool include_ldx_and_divs=
false)
const;
3679 bool is_memcpy(
void)
const {
return get_role() ==
ROLE_MEMCPY; }
3680 bool is_memset(
void)
const {
return get_role() ==
ROLE_MEMSET; }
3681 bool is_alloca(
void)
const {
return get_role() ==
ROLE_ALLOCA; }
3682 bool is_bswap (
void)
const {
return get_role() ==
ROLE_BSWAP; }
3683 bool is_readflags (
void)
const {
return get_role() ==
ROLE_READFLAGS; }
3705 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)); }
3713 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)); }
3715 bool is_mov(
void)
const {
return opcode == m_mov || (opcode == m_f2f && l.
size == d.
size); }
3716 bool is_like_move(
void)
const {
return is_mov() || is_mcode_xdsu(opcode) || opcode == m_low; }
3720 bool hexapi modifies_d(
void)
const;
3721 bool modifies_pair_mop(
void)
const {
return d.
t ==
mop_p && modifies_d(); }
3735 bool hexapi may_use_aliased_memory(
void)
const;
3759#define MAXRANGE bitrange_t(0, USHRT_MAX)
3778#define MBL_PRIV 0x0001
3780#define MBL_NONFAKE 0x0000
3781#define MBL_FAKE 0x0002
3782#define MBL_GOTO 0x0004
3783#define MBL_TCAL 0x0008
3784#define MBL_PUSH 0x0010
3785#define MBL_DMT64 0x0020
3786#define MBL_COMB 0x0040
3787#define MBL_PROP 0x0080
3788#define MBL_DEAD 0x0100
3789#define MBL_LIST 0x0200
3790#define MBL_INCONST 0x0400
3791#define MBL_CALL 0x0800
3792#define MBL_BACKPROP 0x1000
3793#define MBL_NORET 0x2000
3794#define MBL_DSLOT 0x4000
3795#define MBL_VALRANGES 0x8000
3796#define MBL_KEEP 0x10000
3830 void mark_lists_dirty(
void) { flags &= ~MBL_LIST; request_propagation(); }
3831 void request_propagation(
void) { flags |=
MBL_PROP; }
3832 bool needs_propagation(
void)
const {
return (flags &
MBL_PROP) != 0; }
3833 void request_demote64(
void) { flags |=
MBL_DMT64; }
3834 bool lists_dirty(
void)
const {
return (flags &
MBL_LIST) == 0; }
3836 int make_lists_ready(
void)
3838 if ( lists_ready() )
3840 return build_lists(
false);
3844 int npred(
void)
const {
return predset.size(); }
3846 int nsucc(
void)
const {
return succset.size(); }
3848 int pred(
int n)
const {
return predset[n]; }
3850 int succ(
int n)
const {
return succset[n]; }
3854 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
3855 bool empty(
void)
const {
return head ==
nullptr; }
3864 void hexapi dump(
void)
const;
3865 AS_PRINTF(2, 0) void
hexapi vdump_block(const
char *title, va_list va) const;
3866 AS_PRINTF(2, 3)
void dump_block(const
char *title, ...)
const
3869 va_start(va, title);
3870 vdump_block(title, va);
3942 int hexapi optimize_block(
void);
3948 int hexapi build_lists(
bool kill_deads);
3956 int hexapi optimize_useless_jump(
void);
3973 void hexapi append_use_list(
3977 bitrange_t mask=MAXRANGE)
const;
3986 void hexapi append_def_list(
3989 maymust_t maymust)
const;
4031 {
return find_first_use(list, i1, i2, maymust) !=
nullptr; }
4047 return CONST_CAST(
minsn_t*)(find_first_use(list,
4048 CONST_CAST(
const minsn_t*)(i1),
4064 maymust_t maymust=MAY_ACCESS)
const
4066 return find_redefinition(list, i1, i2, maymust) !=
nullptr;
4081 maymust_t maymust=MAY_ACCESS)
const;
4086 maymust_t maymust=MAY_ACCESS)
const
4088 return CONST_CAST(
minsn_t*)(find_redefinition(list,
4089 CONST_CAST(
const minsn_t*)(i1),
4123#define FD_BACKWARD 0x0000
4124#define FD_FORWARD 0x0001
4125#define FD_USE 0x0000
4126#define FD_DEF 0x0002
4127#define FD_DIRTY 0x0004
4138 return find_access(op, p_i1, i2, fdflags|
FD_DEF);
4146 return find_access(op, p_i1, i2, fdflags|
FD_USE);
4153 bool hexapi get_valranges(
4163 bool hexapi get_valranges(
4171#define VR_AT_START 0x0000
4173#define VR_AT_END 0x0001
4176#define VR_EXACT 0x0002
4188 size_t hexapi get_reginsn_qty(
void)
const;
4190 bool is_call_block(
void)
const {
return tail !=
nullptr && is_mcode_call(tail->
opcode); }
4191 bool is_unknown_call(
void)
const {
return tail !=
nullptr && tail->
is_unknown_call(); }
4192 bool is_nway(
void)
const {
return type ==
BLT_NWAY; }
4193 bool is_branch(
void)
const {
return type ==
BLT_2WAY && tail->
d.
t ==
mop_b; }
4194 bool is_simple_goto_block(
void)
const
4196 return get_reginsn_qty() == 1
4197 && tail->
opcode == m_goto
4200 bool is_simple_jcnd_block()
const
4204 && get_reginsn_qty() == 1
4205 && is_mcode_convertible_to_set(tail->
opcode);
4289 return strcmp(text.c_str(), r.text.c_str());
4293typedef qvector<hexwarn_t> hexwarns_t;
4326 func_t *pfn =
nullptr;
4331 ea_t start(
void)
const {
return (pfn !=
nullptr ? *pfn : ranges[0]).start_ea; }
4332 bool empty(
void)
const {
return pfn ==
nullptr && ranges.empty(); }
4333 void clear(
void) { pfn =
nullptr; ranges.clear(); }
4334 bool is_snippet(
void)
const {
return pfn ==
nullptr; }
4335 bool hexapi range_contains(ea_t ea)
const;
4336 bool is_fragmented(
void)
const
4338 int n_frags = ranges.size();
4339 if ( pfn !=
nullptr )
4340 n_frags += pfn->tailqty + 1;
4348 const rangevec_t *ranges =
nullptr;
4349 const range_t *rptr =
nullptr;
4351 bool set(
const rangevec_t &r);
4352 bool next_code(
void);
4353 ea_t current(
void)
const {
return cur; }
4360 func_item_iterator_t fii;
4361 bool func_items_done =
true;
4365 if ( mbr.
pfn !=
nullptr )
4367 ok = fii.set(mbr.
pfn);
4369 func_items_done =
false;
4371 if ( rii.set(mbr.
ranges) )
4375 bool next_code(
void)
4378 if ( !func_items_done )
4380 ok = fii.next_code();
4382 func_items_done =
true;
4385 ok = rii.next_code();
4388 ea_t current(
void)
const
4390 return func_items_done ? rii.current() : fii.current();
4397 const range_t *rptr =
nullptr;
4398 const range_t *rend =
nullptr;
4399 bool set(
const rangevec_t &r) { rptr = r.begin(); rend = r.end();
return rptr != rend; }
4400 bool next(
void) {
return ++rptr != rend; }
4401 const range_t &chunk(
void)
const {
return *rptr; }
4408 func_tail_iterator_t fii;
4409 bool is_snippet(
void)
const {
return rii.rptr !=
nullptr; }
4412 if ( mbr.is_snippet() )
4413 return rii.set(mbr.
ranges);
4415 return fii.set(mbr.
pfn);
4424 const range_t &chunk(
void)
const
4426 return is_snippet() ? rii.chunk() : fii.chunk();
4437 DECLARE_UNCOPYABLE(
mba_t)
4443#define MBA_PRCDEFS 0x00000001
4444#define MBA_NOFUNC 0x00000002
4445#define MBA_PATTERN 0x00000004
4446#define MBA_LOADED 0x00000008
4447#define MBA_RETFP 0x00000010
4448#define MBA_SPLINFO 0x00000020
4449#define MBA_PASSREGS 0x00000040
4450#define MBA_THUNK 0x00000080
4451#define MBA_CMNSTK 0x00000100
4454#define MBA_PREOPT 0x00000200
4455#define MBA_CMBBLK 0x00000400
4456#define MBA_ASRTOK 0x00000800
4457#define MBA_CALLS 0x00001000
4458#define MBA_ASRPROP 0x00002000
4459#define MBA_SAVRST 0x00004000
4460#define MBA_RETREF 0x00008000
4461#define MBA_GLBOPT 0x00010000
4462#define MBA_LVARS0 0x00040000
4463#define MBA_LVARS1 0x00080000
4464#define MBA_DELPAIRS 0x00100000
4465#define MBA_CHVARS 0x00200000
4468#define MBA_SHORT 0x00400000
4469#define MBA_COLGDL 0x00800000
4470#define MBA_INSGDL 0x01000000
4471#define MBA_NICE 0x02000000
4472#define MBA_REFINE 0x04000000
4473#define MBA_WINGR32 0x10000000
4474#define MBA_NUMADDR 0x20000000
4475#define MBA_VALNUM 0x40000000
4477#define MBA_INITIAL_FLAGS (MBA_INSGDL|MBA_NICE|MBA_CMBBLK|MBA_REFINE\
4478 |MBA_PRCDEFS|MBA_WINGR32|MBA_VALNUM)
4480#define MBA2_LVARNAMES_OK 0x00000001
4481#define MBA2_LVARS_RENAMED 0x00000002
4482#define MBA2_OVER_CHAINS 0x00000004
4483#define MBA2_VALRNG_DONE 0x00000008
4484#define MBA2_IS_CTR 0x00000010
4485#define MBA2_IS_DTR 0x00000020
4486#define MBA2_ARGIDX_OK 0x00000040
4487#define MBA2_NO_DUP_CALLS 0x00000080
4488#define MBA2_NO_DUP_LVARS 0x00000100
4489#define MBA2_UNDEF_RETVAR 0x00000200
4490#define MBA2_ARGIDX_SORTED 0x00000400
4492#define MBA2_CODE16_BIT 0x00000800
4493#define MBA2_STACK_RETVAL 0x00001000
4494#define MBA2_HAS_OUTLINES 0x00002000
4495#define MBA2_NO_FRAME 0x00004000
4497#define MBA2_DONT_VERIFY 0x80000000
4501#define MBA2_INITIAL_FLAGS (MBA2_LVARNAMES_OK|MBA2_LVARS_RENAMED)
4503#define MBA2_ALL_FLAGS 0x00007FFF
4505 bool precise_defeas(
void)
const {
return (flags &
MBA_PRCDEFS) != 0; }
4506 bool optimized(
void)
const {
return (flags &
MBA_GLBOPT) != 0; }
4507 bool short_display(
void)
const {
return (flags &
MBA_SHORT ) != 0; }
4508 bool show_reduction(
void)
const {
return (flags &
MBA_COLGDL) != 0; }
4509 bool graph_insns(
void)
const {
return (flags &
MBA_INSGDL) != 0; }
4510 bool loaded_gdl(
void)
const {
return (flags &
MBA_LOADED) != 0; }
4511 bool should_beautify(
void)
const {
return (flags &
MBA_NICE ) != 0; }
4512 bool rtype_refined(
void)
const {
return (flags &
MBA_RETREF) != 0; }
4513 bool may_refine_rettype(
void)
const {
return (flags &
MBA_REFINE) != 0; }
4514 bool use_wingraph32(
void)
const {
return (flags &
MBA_WINGR32) != 0; }
4515 bool display_numaddrs(
void)
const {
return (flags &
MBA_NUMADDR) != 0; }
4516 bool display_valnums(
void)
const {
return (flags &
MBA_VALNUM) != 0; }
4517 bool is_pattern(
void)
const {
return (flags &
MBA_PATTERN) != 0; }
4518 bool is_thunk(
void)
const {
return (flags &
MBA_THUNK) != 0; }
4519 bool saverest_done(
void)
const {
return (flags &
MBA_SAVRST) != 0; }
4520 bool callinfo_built(
void)
const {
return (flags &
MBA_CALLS) != 0; }
4521 bool really_alloc(
void)
const {
return (flags &
MBA_LVARS0) != 0; }
4522 bool lvars_allocated(
void)
const {
return (flags &
MBA_LVARS1) != 0; }
4523 bool chain_varnums_ok(
void)
const {
return (flags &
MBA_CHVARS) != 0; }
4524 bool returns_fpval(
void)
const {
return (flags &
MBA_RETFP) != 0; }
4525 bool has_passregs(
void)
const {
return (flags &
MBA_PASSREGS) != 0; }
4526 bool generated_asserts(
void)
const {
return (flags &
MBA_ASRTOK) != 0; }
4527 bool propagated_asserts(
void)
const {
return (flags &
MBA_ASRPROP) != 0; }
4528 bool deleted_pairs(
void)
const {
return (flags &
MBA_DELPAIRS) != 0; }
4529 bool common_stkvars_stkargs(
void)
const {
return (flags &
MBA_CMNSTK) != 0; }
4532 bool has_over_chains(
void)
const {
return (flags2 &
MBA2_OVER_CHAINS) != 0; }
4533 bool valranges_done(
void)
const {
return (flags2 &
MBA2_VALRNG_DONE) != 0; }
4534 bool argidx_ok(
void)
const {
return (flags2 &
MBA2_ARGIDX_OK) != 0; }
4536 bool code16_bit_removed(
void)
const {
return (flags2 &
MBA2_CODE16_BIT) != 0; }
4539 bool is_ctr(
void)
const {
return (flags2 &
MBA2_IS_CTR) != 0; }
4540 bool is_dtr(
void)
const {
return (flags2 &
MBA2_IS_DTR) != 0; }
4542 int get_mba_flags(
void)
const {
return flags; }
4543 int get_mba_flags2(
void)
const {
return flags2; }
4544 void set_mba_flags(
int f) { flags |= f; }
4545 void clr_mba_flags(
int f) { flags &= ~f; }
4546 void set_mba_flags2(
int f) { flags2 |= f; }
4547 void clr_mba_flags2(
int f) { flags2 &= ~f; }
4549 int calc_shins_flags(
void)
const
4551 int shins_flags = 0;
4552 if ( short_display() )
4554 if ( display_valnums() )
4556 if ( display_numaddrs() )
4603 sval_t stkoff_vd2ida(sval_t off)
const
4605 return off - tmpstk_size;
4608 sval_t stkoff_ida2vd(sval_t off)
const
4610 return off + tmpstk_size;
4612 sval_t argbase()
const
4614 return retsize + stacksize;
4616 static vdloc_t hexapi idaloc2vd(
const argloc_t &loc,
int width, sval_t spd);
4617 vdloc_t hexapi idaloc2vd(
const argloc_t &loc,
int width)
const;
4619 static argloc_t
hexapi vd2idaloc(
const vdloc_t &loc,
int width, sval_t spd);
4620 argloc_t
hexapi vd2idaloc(
const vdloc_t &loc,
int width)
const;
4622 bool is_stkarg(
const lvar_t &v)
const
4626 member_t *get_stkvar(sval_t vd_stkoff, uval_t *poff)
const;
4628 argloc_t get_ida_argloc(
const lvar_t &v)
const
4634 ea_t last_prolog_ea;
4635 ea_t first_epilog_ea;
4689 qstring error_strarg;
4697 mutable hexwarns_t notes;
4698 mutable uchar occurred_warns[32];
4700 bool write_to_const_detected(
void)
const
4704 bool bad_call_sp_detected(
void)
const
4708 bool regargs_is_not_aligned(
void)
const
4712 bool has_bad_sp(
void)
const
4721 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
4723 func_t *
hexapi get_curfunc() const;
4724 bool use_frame(
void)
const {
return get_curfunc() !=
nullptr; }
4725 bool range_contains(ea_t ea)
const {
return mbr.range_contains(map_fict_ea(ea)); }
4726 bool is_snippet(
void)
const {
return mbr.is_snippet(); }
4740 int hexapi optimize_local(
int locopt_bits);
4743#define LOCOPT_ALL 0x0001
4745#define LOCOPT_REFINE 0x0002
4746#define LOCOPT_REFINE2 0x0004
4764 int hexapi analyze_calls(
int acflags);
4767#define ACFL_LOCOPT 0x01
4768#define ACFL_BLKOPT 0x02
4769#define ACFL_GLBPROP 0x04
4770#define ACFL_GLBDEL 0x08
4771#define ACFL_GUESS 0x10
4786 void hexapi alloc_lvars(
void);
4791 void hexapi dump(
void)
const;
4792 AS_PRINTF(3, 0) void
hexapi vdump_mba(
bool _verify, const
char *title, va_list va) const;
4793 AS_PRINTF(3, 4)
void dump_mba(
bool _verify, const
char *title, ...)
const
4796 va_start(va, title);
4797 vdump_mba(_verify, title, va);
4812 void hexapi verify(
bool always)
const;
4818 void hexapi mark_chains_dirty(
void);
4822 mblock_t *get_mblock(
int n) {
return CONST_CAST(
mblock_t*)((CONST_CAST(
const mba_t *)(
this))->get_mblock(n)); }
4848#define CPBLK_FAST 0x0000
4849#define CPBLK_MINREF 0x0001
4850#define CPBLK_OPTJMP 0x0002
4856 bool hexapi remove_empty_and_unreachable_blocks(
void);
4862 bool hexapi combine_blocks(
void);
4905 const tinfo_t *rettype=
nullptr,
4906 const mcallargs_t *callargs=
nullptr,
4907 const mop_t *out=
nullptr);
4912 const lvar_t &arg(
int n)
const {
return CONST_CAST(
mba_t*)(
this)->arg(n); }
4934 ea_t
hexapi alloc_fict_ea(ea_t real_ea);
4940 ea_t
hexapi map_fict_ea(ea_t fict_ea)
const;
4945 const ivl_t &get_lvars_region(
void)
const;
4946 const ivl_t &get_shadow_region(
void)
const;
4947 const ivl_t &get_args_region(
void)
const;
4948 ivl_t get_stack_region(
void)
const;
4951 void hexapi serialize(bytevec_t &vout)
const;
4957 WARN_UNUSED_RESULT
static mba_t *
hexapi deserialize(
const uchar *bytes,
size_t nbytes);
4960 void hexapi save_snapshot(
const char *description);
4967 mreg_t hexapi alloc_kreg(
size_t size,
bool check_size=
true);
4994 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
5032 bool hexapi is_accessed_globally(
5038 access_type_t access_type,
5039 maymust_t maymust)
const;
5040 int get_ud_gc_idx(
gctype_t gctype)
const {
return (gctype << 1); }
5041 int get_du_gc_idx(
gctype_t gctype)
const {
return (gctype << 1)+1; }
5042 int get_ud_dirty_bit(
gctype_t gctype) {
return 1 << get_ud_gc_idx(gctype); }
5043 int get_du_dirty_bit(
gctype_t gctype) {
return 1 << get_du_gc_idx(gctype); }
5049 int bit = get_ud_dirty_bit(gctype);
5050 return (dirty & bit) != 0;
5056 int bit = get_du_dirty_bit(gctype);
5057 return (dirty & bit) != 0;
5059 int get_chain_stamp(
void)
const {
return chain_stamp; }
5069 {
return is_accessed_globally(list, b1, b2, m1, m2, WRITE_ACCESS, maymust); }
5073 {
return is_accessed_globally(list, b1, b2, m1, m2, READ_ACCESS, maymust); }
5085 ea_t dslot = BADADDR;
5087 ea_t severed_branch = BADADDR;
5089 bool is_likely_dslot =
false;
5095 bool ok()
const {
return ea < end; }
5096 bool has_dslot()
const {
return dslot != BADADDR; }
5097 bool dslot_with_xrefs()
const {
return dslot >= end; }
5099 bool is_severed_dslot()
const {
return severed_branch != BADADDR; }
5100 void start(
const range_t &rng)
5116 char ignore_micro = IM_NONE;
5131 const class qflow_chart_t &fc,
5132 const class bitset_t &reachable) = 0;
5193 minsn_t *
hexapi emit(mcode_t code,
int width, uval_t l, uval_t r, uval_t d,
int offsize);
5205 return emit(code, get_dtype_size(dtype), l, r, d, offsize);
5235 return is_insn(code) ? d :
nullptr;
5239 return is_insn(code) ? d :
nullptr;
5244 return is_insn() && d->opcode == code;
5254 return is_glbaddr() && a->g == ea;
5262inline vivl_t::vivl_t(
const chain_t &ch)
5263 :
voff_t(ch.key().type, ch.is_reg() ? ch.get_reg() : ch.get_stkoff()),
5283inline const ivl_t &mba_t::get_lvars_region(
void)
const
5288inline const ivl_t &mba_t::get_shadow_region(
void)
const
5293inline const ivl_t &mba_t::get_args_region(
void)
const
5298inline ivl_t mba_t::get_stack_region(
void)
const
5326#define OPF_REUSE 0x00
5327#define OPF_NEW_WINDOW 0x01
5328#define OPF_REUSE_ACTIVE 0x02
5330#define OPF_NO_WAIT 0x08
5333#define OPF_WINDOW_MGMT_MASK 0x07
5361#define VDRUN_NEWFILE 0x00000000
5362#define VDRUN_APPEND 0x00000001
5363#define VDRUN_ONLYNEW 0x00000002
5364#define VDRUN_SILENT 0x00000004
5365#define VDRUN_SENDIDB 0x00000008
5366#define VDRUN_MAYSTOP 0x00000010
5367#define VDRUN_CMDLINE 0x00000020
5368#define VDRUN_STATS 0x00000040
5369#define VDRUN_LUMINA 0x00000080
5392 qstring
hexapi desc(
void)
const;
5393 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
5404 qstring desc(
void)
const {
return hf.desc(); }
5408 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
5438#define GCO_STK 0x0000
5439#define GCO_REG 0x0001
5440#define GCO_USE 0x0002
5441#define GCO_DEF 0x0004
5442 bool is_reg(
void)
const {
return (flags &
GCO_REG) != 0; }
5443 bool is_use(
void)
const {
return (flags &
GCO_USE) != 0; }
5444 bool is_def(
void)
const {
return (flags &
GCO_DEF) != 0; }
5677 || (op > cot_last && op < cit_end);
5694 const tinfo_t &type,
5695 const citem_t *parent=
nullptr,
5696 bool *nice_stroff=
nullptr)
const;
5707 void hexapi assign(uint64 v,
int nbytes, type_sign_t sign);
5709 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
5718 lvar_t &getv(
void)
const {
return mba->
vars[idx]; }
5719 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
5738#define CV_FAST 0x0000
5739#define CV_PRUNE 0x0001
5740#define CV_PARENTS 0x0002
5741#define CV_POST 0x0004
5742#define CV_RESTART 0x0008
5743#define CV_INSNS 0x0010
5833 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
5849 bool hexapi recalc_parent_types(
void);
5872 bool hexapi calc_rvalue_type(tinfo_t *target,
const cexpr_t *e);
5910 ITP_INNER_LAST = ITP_BRACE1,
5933 bool operator < (
const treeloc_t &r)
const
5936 || (ea == r.ea && itp < r.itp);
5938 bool operator == (
const treeloc_t &r)
const
5940 return ea == r.ea && itp == r.itp;
5942 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
5963 citem_cmt_t(
const char *s) : qstring(s), used(false) {}
5967typedef std::map<treeloc_t, citem_cmt_t>
user_cmts_t;
5980 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
5984typedef std::map<citem_locator_t, int32> user_iflags_t;
5990typedef std::map<ea_t, intvec_t> user_unions_t;
6003 bit_bound_t(
int n=0,
int s=0) : nbits(n), sbits(s) {}
6020 mutable int index = -1;
6026 std::swap(ea, r.
ea);
6027 std::swap(op, r.
op);
6031 bool is_expr(
void)
const {
return op <= cot_last; }
6035 bool hexapi contains_label(
void)
const;
6042 {
return CONST_CAST(
citem_t*)((CONST_CAST(
const citem_t*)(
this))->find_parent_of(item)); }
6044 void print1(qstring *vout,
const cfunc_t *func)
const;
6049 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
6051DECLARE_TYPE_AS_MOVABLE(
citem_t);
6096#define EXFL_CPADONE 0x0001
6097#define EXFL_LVALUE 0x0002
6098#define EXFL_FPOP 0x0004
6099#define EXFL_ALONE 0x0008
6100#define EXFL_CSTR 0x0010
6101#define EXFL_PARTIAL 0x0020
6102#define EXFL_UNDEF 0x0040
6103#define EXFL_JUMPOUT 0x0080
6104#define EXFL_VFTABLE 0x0100
6105#define EXFL_ALL 0x01FF
6109 bool is_odd_lvalue(
void)
const {
return (exflags &
EXFL_LVALUE) != 0; }
6110 bool is_fpop(
void)
const {
return (exflags &
EXFL_FPOP) != 0; }
6111 bool is_cstr(
void)
const {
return (exflags &
EXFL_CSTR) != 0; }
6112 bool is_type_partial(
void)
const {
return (exflags &
EXFL_PARTIAL) != 0; }
6113 bool is_undef_val(
void)
const {
return (exflags &
EXFL_UNDEF) != 0; }
6114 bool is_jumpout(
void)
const {
return (exflags &
EXFL_JUMPOUT) != 0; }
6115 bool is_vftable(
void)
const {
return (exflags &
EXFL_VFTABLE) != 0; }
6120 void set_type_partial(
bool val =
true)
6125 exflags &= ~EXFL_PARTIAL;
6128 cexpr_t(
void) : x(nullptr), y(nullptr), z(nullptr), exflags(0) {}
6134 void swap(
cexpr_t &r) { qswap(*
this, r); }
6148 void hexapi cleanup(
void);
6155 void hexapi put_number(
cfunc_t *func, uint64
value,
int nbytes, type_sign_t sign=no_sign);
6160 void hexapi print1(qstring *vout,
const cfunc_t *func)
const;
6166 void hexapi calc_type(
bool recursive);
6184 bool hexapi contains_operator(
ctype_t needed_op,
int times=1)
const;
6196 bool is_nice_expr(
void)
const {
return !contains_comma_or_insn_or_label(); }
6217 int hexapi get_low_nbit_bound()
const;
6224 bool hexapi has_side_effects(
void)
const;
6235 QASSERT(50071, op ==
cot_num);
6236 return n->value(type);
6241 return op ==
cot_num && numval() == _v;
6246 return op ==
cot_num && int64(numval()) < 0;
6251 return op ==
cot_num && int64(numval()) >= 0;
6256 return op ==
cot_num && numval() != 0;
6269 if ( out !=
nullptr )
6276 bool hexapi maybe_ptr(
void)
const;
6281 if ( x->type.is_ptr_or_array() )
6283 if ( y->type.is_ptr_or_array() )
6311 cexpr_t *theother(
const cexpr_t *what) {
return what == x ? y : x; }
6318DECLARE_TYPE_AS_MOVABLE(
cexpr_t);
6325 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
6342 cif_t(
void) : ithen(nullptr), ielse(nullptr) {}
6346 DECLARE_COMPARISONS(
cif_t);
6347 ~cif_t(
void) { cleanup(); }
6355 cloop_t(
void) : body(
nullptr) {}
6369 DECLARE_COMPARISONS(
cfor_t);
6381 DECLARE_COMPARISONS(
cdo_t);
6396 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
6402 casm_t(ea_t ea) { push_back(ea); }
6404 DECLARE_COMPARISONS(
casm_t);
6406 bool one_insn(
void)
const {
return size() == 1; }
6407 void genasm(qstring *buf, ea_t ea)
const;
6447 void hexapi cleanup(
void);
6472 void hexapi print1(qstring *vout,
const cfunc_t *func)
const;
6476 bool hexapi is_ordinary_flow(
void)
const;
6508DECLARE_TYPE_AS_MOVABLE(
cinsn_t);
6510typedef qlist<cinsn_t> cinsn_list_t;
6523 void consume_cexpr(
cexpr_t *e)
6528 carg_t(
void) : is_vararg(false) {}
6529 DECLARE_COMPARISONS(
carg_t)
6531 return cexpr_t::compare(r);
6534DECLARE_TYPE_AS_MOVABLE(
carg_t);
6541#define CFL_FINAL 0x0001
6542#define CFL_HELPER 0x0002
6543#define CFL_NORET 0x0004
6545 carglist_t(
const tinfo_t &ftype,
int fl = 0) : functype(ftype), flags(fl) {}
6558 size_t size(
void)
const {
return values.size(); }
6559 const uint64 &
value(
int i)
const {
return values[i]; }
6561DECLARE_TYPE_AS_MOVABLE(
ccase_t);
6567 int find_value(uint64 v)
const;
6582 uval_t
value = BADADDR;
6583#define ANCHOR_INDEX 0x1FFFFFFF
6584#define ANCHOR_MASK 0xC0000000
6585#define ANCHOR_CITEM 0x00000000
6586#define ANCHOR_LVAR 0x40000000
6587#define ANCHOR_ITP 0x80000000
6588#define ANCHOR_BLKCMT 0x20000000
6589 int get_index(
void)
const {
return value & ANCHOR_INDEX; }
6591 bool is_valid_anchor(
void)
const {
return value != BADADDR; }
6592 bool is_citem_anchor(
void)
const {
return (
value & ANCHOR_MASK) ==
ANCHOR_CITEM; }
6593 bool is_lvar_anchor(
void)
const {
return (
value & ANCHOR_MASK) ==
ANCHOR_LVAR; }
6625 void verify(
const mba_t *mba)
const;
6634 member_t *
hexapi get_memptr(struc_t **p_sptr=
nullptr)
const;
6648 ea_t
hexapi get_ea(
void)
const;
6655 int hexapi get_label_num(
int gln_flags)
const;
6658#define GLN_CURRENT 0x01
6659#define GLN_GOTO_TARGET 0x02
6666 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
6705AS_PRINTF(3, 0)
cexpr_t *
hexapi vcreate_helper(
bool standalone, const tinfo_t &type, const
char *format, va_list va);
6708AS_PRINTF(3, 4) inline
cexpr_t *create_helper(
bool standalone, const tinfo_t &type, const
char *format, ...)
6711 va_start(va, format);
6712 cexpr_t *e = vcreate_helper(standalone, type, format, va);
6727AS_PRINTF(3, 0)
cexpr_t *
hexapi vcall_helper(const tinfo_t &rettype,
carglist_t *args, const
char *format, va_list va);
6730AS_PRINTF(3, 4) inline
cexpr_t *call_helper(
6731 const tinfo_t &rettype,
6733 const
char *format, ...)
6736 va_start(va, format);
6737 cexpr_t *e = vcall_helper(rettype, args, format, va);
6859typedef std::map<ea_t, cinsnptrvec_t> eamap_t;
6861typedef std::map<cinsn_t *, rangeset_t> boundaries_t;
6862#define INS_EPILOG ((cinsn_t *)1)
6883#define CIT_COLLAPSED 0x0001
6888#define CFS_BOUNDS 0x0001
6889#define CFS_TEXT 0x0002
6890#define CFS_LVARS_HIDDEN 0x0004
6891#define CFS_LOCKED 0x0008
6904 void release(
void) {
delete this; }
6905 HEXRAYS_MEMORY_ALLOCATION_FUNCS()
6909 void
hexapi build_c_tree(
void);
6920 void hexapi print_dcl(qstring *vout) const;
6929 bool hexapi get_func_type(tinfo_t *type) const;
6944 sval_t
hexapi get_stkoff_delta(
void);
6953 void hexapi remove_unused_labels(
void);
6979 bool hexapi has_orphan_cmts(
void) const;
6983 int hexapi del_orphan_cmts(
void);
6989 bool hexapi get_user_union_selection(ea_t ea, intvec_t *path);
6995 void hexapi set_user_union_selection(ea_t ea, const intvec_t &path);
7017 bool hexapi get_line_item(
7027 hexwarns_t &
hexapi get_warnings(
void);
7031 eamap_t &
hexapi get_eamap(
void);
7035 boundaries_t &
hexapi get_boundaries(
void);
7045 void hexapi refresh_func_ctext(
void);
7047 bool hexapi gather_derefs(const
ctree_item_t &ci, udt_type_data_t *udm=
nullptr) const;
7048 bool hexapi find_item_coords(const
citem_t *item,
int *px,
int *py);
7049 bool locked(
void)
const {
return (statebits &
CFS_LOCKED) != 0; }
7053 void hexapi cleanup(
void);
7056typedef qvector<cfuncptr_t> cfuncptrs_t;
7060#define DECOMP_NO_WAIT 0x0001
7061#define DECOMP_NO_CACHE 0x0002
7062#define DECOMP_NO_FRAME 0x0004
7063#define DECOMP_WARNINGS 0x0008
7064#define DECOMP_ALL_BLKS 0x0010
7065#define DECOMP_NO_HIDE 0x0020
7066#define DECOMP_NO_XREFS 0x0040
7085 int decomp_flags=0);
7102 return decompile(mbr, hf, decomp_flags);
7114 const rangevec_t &ranges,
7119 return decompile(mbr, hf, decomp_flags);
7134 const mlist_t *retlist=
nullptr,
7166inline void cif_t::cleanup(
void) {
delete ithen;
delete ielse; }
7167inline void cloop_t::cleanup(
void) {
delete body; }
7177 ((
cexpr_t*)
this)->print1(vout, func);
7179 ((
cinsn_t*)
this)->print1(vout, func);
7204 return CONST_CAST(
cexpr_t*)(
this)->get_1num_op(
7209inline citem_locator_t::citem_locator_t(
const citem_t *i)
7210 : ea(i != nullptr ? i->ea : BADADDR),
7211 op(i != nullptr ? i->op : cot_empty)
7223qstring
hexapi create_field_name(
const tinfo_t &type, uval_t offset=BADADDR);
7225const int64 HEXRAYS_API_MAGIC = 0x00DEC0DE00000003LL;
7302 hxe_resolve_stkaddrs,
7314 hxe_open_pseudocode=100,
7318 hxe_switch_pseudocode,
7323 hxe_refresh_pseudocode,
7328 hxe_close_pseudocode,
7365 hxe_populating_popup,
7370 lxe_lvar_name_changed,
7378 lxe_lvar_type_changed,
7385 lxe_lvar_cmt_changed,
7392 lxe_lvar_mapping_changed,
7413typedef ssize_t idaapi
hexrays_cb_t(
void *ud, hexrays_event_t event, va_list va);
7458 if (
lnnum < r.lnnum )
return -1;
7459 if (
lnnum > r.lnnum )
return 1;
7460 if (
x < r.x )
return -1;
7461 if (
x > r.x )
return 1;
7465 :
lnnum(_lnnum),
x(_x),
y(_y) {}
7475 history_item_t(ea_t _ea=BADADDR,
int _lnnum=-1,
int _x=0,
int _y=0)
7503#define VDUI_VISIBLE 0x0001
7504#define VDUI_VALID 0x0002
7520 bool hexapi set_locked(
bool v);
7814 bool operator!=(
const ui_stroff_op_t &r)
const {
return !(*
this == r); }
7817typedef qvector<ui_stroff_op_t> ui_stroff_ops_t;
7827 virtual bool idaapi
apply(
size_t opnum,
const intvec_t &path,
const tinfo_t &top_tif,
const char *spath) = 0;
7836 const qvector<tinfo_t> *udts,
7837 const ui_stroff_ops_t &ops,
7849typedef void *
hexdsp_t(
int code, ...);
7861 hx_user_numforms_begin,
7862 hx_user_numforms_end,
7863 hx_user_numforms_next,
7864 hx_user_numforms_prev,
7865 hx_user_numforms_first,
7866 hx_user_numforms_second,
7867 hx_user_numforms_find,
7868 hx_user_numforms_insert,
7869 hx_user_numforms_erase,
7870 hx_user_numforms_clear,
7871 hx_user_numforms_size,
7872 hx_user_numforms_free,
7873 hx_user_numforms_new,
7874 hx_lvar_mapping_begin,
7875 hx_lvar_mapping_end,
7876 hx_lvar_mapping_next,
7877 hx_lvar_mapping_prev,
7878 hx_lvar_mapping_first,
7879 hx_lvar_mapping_second,
7880 hx_lvar_mapping_find,
7881 hx_lvar_mapping_insert,
7882 hx_lvar_mapping_erase,
7883 hx_lvar_mapping_clear,
7884 hx_lvar_mapping_size,
7885 hx_lvar_mapping_free,
7886 hx_lvar_mapping_new,
7887 hx_udcall_map_begin,
7891 hx_udcall_map_first,
7892 hx_udcall_map_second,
7894 hx_udcall_map_insert,
7895 hx_udcall_map_erase,
7896 hx_udcall_map_clear,
7905 hx_user_cmts_second,
7907 hx_user_cmts_insert,
7913 hx_user_iflags_begin,
7915 hx_user_iflags_next,
7916 hx_user_iflags_prev,
7917 hx_user_iflags_first,
7918 hx_user_iflags_second,
7919 hx_user_iflags_find,
7920 hx_user_iflags_insert,
7921 hx_user_iflags_erase,
7922 hx_user_iflags_clear,
7923 hx_user_iflags_size,
7924 hx_user_iflags_free,
7926 hx_user_unions_begin,
7928 hx_user_unions_next,
7929 hx_user_unions_prev,
7930 hx_user_unions_first,
7931 hx_user_unions_second,
7932 hx_user_unions_find,
7933 hx_user_unions_insert,
7934 hx_user_unions_erase,
7935 hx_user_unions_clear,
7936 hx_user_unions_size,
7937 hx_user_unions_free,
7939 hx_user_labels_begin,
7941 hx_user_labels_next,
7942 hx_user_labels_prev,
7943 hx_user_labels_first,
7944 hx_user_labels_second,
7945 hx_user_labels_find,
7946 hx_user_labels_insert,
7947 hx_user_labels_erase,
7948 hx_user_labels_clear,
7949 hx_user_labels_size,
7950 hx_user_labels_free,
7965 hx_boundaries_begin,
7969 hx_boundaries_first,
7970 hx_boundaries_second,
7972 hx_boundaries_insert,
7973 hx_boundaries_erase,
7974 hx_boundaries_clear,
7978 hx_block_chains_begin,
7979 hx_block_chains_end,
7980 hx_block_chains_next,
7981 hx_block_chains_prev,
7982 hx_block_chains_get,
7983 hx_block_chains_find,
7984 hx_block_chains_insert,
7985 hx_block_chains_erase,
7986 hx_block_chains_clear,
7987 hx_block_chains_size,
7988 hx_block_chains_free,
7989 hx_block_chains_new,
7993 hx_valrng_t_compare,
7995 hx_valrng_t_set_cmp,
7996 hx_valrng_t_reduce_size,
7997 hx_valrng_t_intersect_with,
7998 hx_valrng_t_unite_with,
7999 hx_valrng_t_inverse,
8003 hx_valrng_t_cvt_to_single_value,
8004 hx_valrng_t_cvt_to_cmp,
8008 hx_install_optinsn_handler,
8009 hx_remove_optinsn_handler,
8010 hx_install_optblock_handler,
8011 hx_remove_optblock_handler,
8012 hx_must_mcode_close_block,
8013 hx_is_mcode_propagatable,
8014 hx_negate_mcode_relation,
8015 hx_swap_mcode_relation,
8016 hx_get_signed_mcode,
8017 hx_get_unsigned_mcode,
8018 hx_mcode_modifies_d,
8019 hx_operand_locator_t_compare,
8020 hx_vd_printer_t_print,
8021 hx_file_printer_t_print,
8022 hx_qstring_printer_t_print,
8028 hx_partial_type_num,
8030 hx_get_int_type_by_width_and_sign,
8040 hx_vdloc_t_is_aliasable,
8043 hx_lvar_locator_t_compare,
8044 hx_lvar_locator_t_dstr,
8046 hx_lvar_t_is_promoted_arg,
8047 hx_lvar_t_accepts_type,
8048 hx_lvar_t_set_lvar_type,
8049 hx_lvar_t_set_width,
8050 hx_lvar_t_append_list_,
8051 hx_lvars_t_find_stkvar,
8053 hx_lvars_t_find_lvar,
8054 hx_restore_user_lvar_settings,
8055 hx_save_user_lvar_settings,
8056 hx_modify_user_lvars,
8057 hx_restore_user_defined_calls,
8058 hx_save_user_defined_calls,
8060 hx_convert_to_user_call,
8061 hx_install_microcode_filter,
8062 hx_udc_filter_t_init,
8063 hx_udc_filter_t_apply,
8064 hx_bitset_t_bitset_t,
8073 hx_bitset_t_shift_down,
8075 hx_bitset_t_has_all,
8076 hx_bitset_t_has_any,
8082 hx_bitset_t_fill_with_ones,
8083 hx_bitset_t_has_common,
8084 hx_bitset_t_intersect,
8085 hx_bitset_t_is_subset_of,
8086 hx_bitset_t_compare,
8092 hx_ivlset_t_addmasked,
8095 hx_ivlset_t_has_common,
8099 hx_ivlset_t_has_common_,
8100 hx_ivlset_t_contains,
8101 hx_ivlset_t_includes,
8102 hx_ivlset_t_intersect,
8103 hx_ivlset_t_compare,
8111 hx_lvar_ref_t_compare,
8113 hx_stkvar_ref_t_compare,
8114 hx_stkvar_ref_t_get_stkvar,
8123 hx_mop_t_create_from_mlist,
8124 hx_mop_t_create_from_ivlset,
8125 hx_mop_t_create_from_vdloc,
8126 hx_mop_t_create_from_scattered_vdloc,
8127 hx_mop_t_create_from_insn,
8128 hx_mop_t_make_number,
8129 hx_mop_t_make_fpnum,
8130 hx_mop_t_make_reg_pair,
8131 hx_mop_t_make_helper,
8132 hx_mop_t_is_bit_reg,
8133 hx_mop_t_may_use_aliased_memory,
8135 hx_mop_t_is_sign_extended_from,
8136 hx_mop_t_is_zero_extended_from,
8137 hx_mop_t_equal_mops,
8138 hx_mop_t_lexcompare,
8139 hx_mop_t_for_all_ops,
8140 hx_mop_t_for_all_scattered_submops,
8141 hx_mop_t_is_constant,
8142 hx_mop_t_get_stkoff,
8143 hx_mop_t_make_low_half,
8144 hx_mop_t_make_high_half,
8145 hx_mop_t_make_first_half,
8146 hx_mop_t_make_second_half,
8148 hx_mop_t_change_size,
8149 hx_mop_t_preserve_side_effects,
8150 hx_mop_t_apply_ld_mcode,
8151 hx_mcallarg_t_print,
8153 hx_mcallarg_t_set_regarg,
8154 hx_mcallinfo_t_lexcompare,
8155 hx_mcallinfo_t_set_type,
8156 hx_mcallinfo_t_get_type,
8157 hx_mcallinfo_t_print,
8158 hx_mcallinfo_t_dstr,
8159 hx_mcases_t_compare,
8162 hx_vivl_t_extend_to_cover,
8163 hx_vivl_t_intersect,
8168 hx_chain_t_append_list_,
8169 hx_block_chains_t_get_chain,
8170 hx_block_chains_t_print,
8171 hx_block_chains_t_dstr,
8172 hx_graph_chains_t_for_all_chains,
8173 hx_graph_chains_t_release,
8180 hx_minsn_t_optimize_subtree,
8181 hx_minsn_t_for_all_ops,
8182 hx_minsn_t_for_all_insns,
8183 hx_minsn_t__make_nop,
8184 hx_minsn_t_equal_insns,
8185 hx_minsn_t_lexcompare,
8186 hx_minsn_t_is_noret_call,
8187 hx_minsn_t_is_helper,
8188 hx_minsn_t_find_call,
8189 hx_minsn_t_has_side_effects,
8190 hx_minsn_t_find_opcode,
8191 hx_minsn_t_find_ins_op,
8192 hx_minsn_t_find_num_op,
8193 hx_minsn_t_modifies_d,
8194 hx_minsn_t_is_between,
8195 hx_minsn_t_may_use_aliased_memory,
8201 hx_mblock_t_vdump_block,
8202 hx_mblock_t_insert_into_block,
8203 hx_mblock_t_remove_from_block,
8204 hx_mblock_t_for_all_insns,
8205 hx_mblock_t_for_all_ops,
8206 hx_mblock_t_for_all_uses,
8207 hx_mblock_t_optimize_insn,
8208 hx_mblock_t_optimize_block,
8209 hx_mblock_t_build_lists,
8210 hx_mblock_t_append_use_list,
8211 hx_mblock_t_append_def_list,
8212 hx_mblock_t_build_use_list,
8213 hx_mblock_t_build_def_list,
8214 hx_mblock_t_find_first_use,
8215 hx_mblock_t_find_redefinition,
8216 hx_mblock_t_is_rhs_redefined,
8217 hx_mblock_t_find_access,
8218 hx_mblock_t_get_valranges,
8222 hx_mba_t_optimize_local,
8223 hx_mba_t_build_graph,
8225 hx_mba_t_analyze_calls,
8226 hx_mba_t_optimize_global,
8227 hx_mba_t_alloc_lvars,
8232 hx_mba_t_mark_chains_dirty,
8233 hx_mba_t_insert_block,
8234 hx_mba_t_remove_block,
8235 hx_mba_t_remove_empty_and_unreachable_blocks,
8236 hx_mba_t_combine_blocks,
8237 hx_mba_t_for_all_ops,
8238 hx_mba_t_for_all_insns,
8239 hx_mba_t_for_all_topinsns,
8243 hx_mba_t_deserialize,
8244 hx_mbl_graph_t_is_accessed_globally,
8245 hx_mbl_graph_t_get_ud,
8246 hx_mbl_graph_t_get_du,
8251 hx_get_hexrays_version,
8253 hx_close_pseudocode,
8256 hx_hexrays_failure_t_desc,
8258 hx_gco_info_t_append_to_list,
8259 hx_get_current_operand,
8261 hx_negated_relation,
8262 hx_swapped_relation,
8268 hx_cnumber_t_assign,
8269 hx_cnumber_t_compare,
8270 hx_var_ref_t_compare,
8271 hx_ctree_visitor_t_apply_to,
8272 hx_ctree_visitor_t_apply_to_exprs,
8273 hx_ctree_parentee_t_recalc_parent_types,
8274 hx_cfunc_parentee_t_calc_rvalue_type,
8275 hx_citem_locator_t_compare,
8276 hx_citem_t_contains_expr,
8277 hx_citem_t_contains_label,
8278 hx_citem_t_find_parent_of,
8279 hx_citem_t_find_closest_addr,
8282 hx_cexpr_t_replace_by,
8284 hx_cexpr_t_put_number,
8286 hx_cexpr_t_calc_type,
8287 hx_cexpr_t_equal_effect,
8288 hx_cexpr_t_is_child_of,
8289 hx_cexpr_t_contains_operator,
8290 hx_cexpr_t_get_high_nbit_bound,
8291 hx_cexpr_t_get_low_nbit_bound,
8292 hx_cexpr_t_requires_lvalue,
8293 hx_cexpr_t_has_side_effects,
8298 hx_cwhile_t_compare,
8300 hx_creturn_t_compare,
8305 hx_cinsn_t_replace_by,
8307 hx_cinsn_t_new_insn,
8308 hx_cinsn_t_create_if,
8311 hx_cinsn_t_is_ordinary_flow,
8312 hx_cinsn_t_contains_insn,
8313 hx_cinsn_t_collect_free_breaks,
8314 hx_cinsn_t_collect_free_continues,
8315 hx_cblock_t_compare,
8316 hx_carglist_t_compare,
8318 hx_ccases_t_compare,
8319 hx_cswitch_t_compare,
8320 hx_ctree_item_t_get_memptr,
8321 hx_ctree_item_t_get_lvar,
8322 hx_ctree_item_t_get_ea,
8323 hx_ctree_item_t_get_label_num,
8331 hx_save_user_labels,
8333 hx_save_user_numforms,
8334 hx_save_user_iflags,
8335 hx_save_user_unions,
8336 hx_restore_user_labels,
8337 hx_restore_user_cmts,
8338 hx_restore_user_numforms,
8339 hx_restore_user_iflags,
8340 hx_restore_user_unions,
8341 hx_cfunc_t_build_c_tree,
8343 hx_cfunc_t_print_dcl,
8344 hx_cfunc_t_print_func,
8345 hx_cfunc_t_get_func_type,
8346 hx_cfunc_t_get_lvars,
8347 hx_cfunc_t_get_stkoff_delta,
8348 hx_cfunc_t_find_label,
8349 hx_cfunc_t_remove_unused_labels,
8350 hx_cfunc_t_get_user_cmt,
8351 hx_cfunc_t_set_user_cmt,
8352 hx_cfunc_t_get_user_iflags,
8353 hx_cfunc_t_set_user_iflags,
8354 hx_cfunc_t_has_orphan_cmts,
8355 hx_cfunc_t_del_orphan_cmts,
8356 hx_cfunc_t_get_user_union_selection,
8357 hx_cfunc_t_set_user_union_selection,
8358 hx_cfunc_t_get_line_item,
8359 hx_cfunc_t_get_warnings,
8360 hx_cfunc_t_get_eamap,
8361 hx_cfunc_t_get_boundaries,
8362 hx_cfunc_t_get_pseudocode,
8363 hx_cfunc_t_gather_derefs,
8364 hx_cfunc_t_find_item_coords,
8368 hx_mark_cfunc_dirty,
8369 hx_clear_cached_cfuncs,
8370 hx_has_cached_cfunc,
8372 hx_create_field_name,
8373 hx_install_hexrays_callback,
8374 hx_remove_hexrays_callback,
8375 hx_vdui_t_set_locked,
8376 hx_vdui_t_refresh_view,
8377 hx_vdui_t_refresh_ctext,
8378 hx_vdui_t_switch_to,
8379 hx_vdui_t_get_number,
8380 hx_vdui_t_get_current_label,
8382 hx_vdui_t_refresh_cpos,
8383 hx_vdui_t_get_current_item,
8384 hx_vdui_t_ui_rename_lvar,
8385 hx_vdui_t_rename_lvar,
8386 hx_vdui_t_ui_set_call_type,
8387 hx_vdui_t_ui_set_lvar_type,
8388 hx_vdui_t_set_lvar_type,
8389 hx_vdui_t_ui_edit_lvar_cmt,
8390 hx_vdui_t_set_lvar_cmt,
8391 hx_vdui_t_ui_map_lvar,
8392 hx_vdui_t_ui_unmap_lvar,
8394 hx_vdui_t_set_strmem_type,
8395 hx_vdui_t_rename_strmem,
8396 hx_vdui_t_set_global_type,
8397 hx_vdui_t_rename_global,
8398 hx_vdui_t_rename_label,
8399 hx_vdui_t_jump_enter,
8400 hx_vdui_t_ctree_to_disasm,
8401 hx_vdui_t_calc_cmt_type,
8403 hx_vdui_t_edit_func_cmt,
8404 hx_vdui_t_del_orphan_cmts,
8405 hx_vdui_t_set_num_radix,
8406 hx_vdui_t_set_num_enum,
8407 hx_vdui_t_set_num_stroff,
8408 hx_vdui_t_invert_sign,
8409 hx_vdui_t_invert_bits,
8410 hx_vdui_t_collapse_item,
8411 hx_vdui_t_collapse_lvars,
8412 hx_vdui_t_split_item,
8415 hx_vdui_t_set_noptr_lvar,
8416 hx_select_udt_by_offset,
8417 hx_mblock_t_get_valranges_,
8418 hx_cfunc_t_refresh_func_ctext,
8419 hx_checkout_hexrays_license,
8420 hx_mba_t_copy_block,
8421 hx_mblock_t_optimize_useless_jump,
8422 hx_mblock_t_get_reginsn_qty,
8423 hx_modify_user_lvar_info,
8424 hx_cdg_insn_iterator_t_next,
8425 hx_restore_user_labels2,
8426 hx_save_user_labels2,
8427 hx_mba_ranges_t_range_contains,
8428 hx_close_hexrays_waitbox,
8429 hx_mba_t_map_fict_ea,
8430 hx_mba_t_alloc_fict_ea,
8431 hx_mba_t_alloc_kreg,
8433 hx_mba_t_idaloc2vd_,
8434 hx_mba_t_vd2idaloc_,
8435 hx_bitset_t_fill_gaps,
8436 hx_cfunc_t_save_user_labels,
8437 hx_cfunc_t_save_user_cmts,
8438 hx_cfunc_t_save_user_numforms,
8439 hx_cfunc_t_save_user_iflags,
8440 hx_cfunc_t_save_user_unions,
8441 hx_minsn_t_set_combined,
8442 hx_mba_t_save_snapshot,
8444 hx_mba_t_set_maturity,
8447 hx_mba_t_create_helper_call,
8448 hx_lvar_t_append_list,
8449 hx_chain_t_append_list,
8450 hx_udc_filter_t_cleanup,
8451 hx_mba_t_get_curfunc,
8452 hx_mop_t__make_gvar,
8454 hx_cexpr_t_maybe_ptr,
8457typedef size_t iterator_word;
8467 return callui(ui_broadcast, HEXRAYS_API_MAGIC, &dummy, flags).i == (HEXRAYS_API_MAGIC >> 32);
8504 HEXDSP(hx_user_numforms_find, &p, map, &key);
8513 HEXDSP(hx_user_numforms_insert, &p, map, &key, &val);
8522 HEXDSP(hx_user_numforms_begin, &p, map);
8531 HEXDSP(hx_user_numforms_end, &p, map);
8539 HEXDSP(hx_user_numforms_next, &p);
8547 HEXDSP(hx_user_numforms_prev, &p);
8555 HEXDSP(hx_user_numforms_erase, map, &p);
8562 HEXDSP(hx_user_numforms_clear, map);
8569 return (
size_t)HEXDSP(hx_user_numforms_size, map);
8576 HEXDSP(hx_user_numforms_free, map);
8613 HEXDSP(hx_lvar_mapping_find, &p, map, &key);
8622 HEXDSP(hx_lvar_mapping_insert, &p, map, &key, &val);
8631 HEXDSP(hx_lvar_mapping_begin, &p, map);
8640 HEXDSP(hx_lvar_mapping_end, &p, map);
8648 HEXDSP(hx_lvar_mapping_next, &p);
8656 HEXDSP(hx_lvar_mapping_prev, &p);
8664 HEXDSP(hx_lvar_mapping_erase, map, &p);
8671 HEXDSP(hx_lvar_mapping_clear, map);
8678 return (
size_t)HEXDSP(hx_lvar_mapping_size, map);
8685 HEXDSP(hx_lvar_mapping_free, map);
8707 return *(ea_t *)HEXDSP(hx_udcall_map_first, &p);
8714 return *(
udcall_t *)HEXDSP(hx_udcall_map_second, &p);
8722 HEXDSP(hx_udcall_map_find, &p, map, &key);
8731 HEXDSP(hx_udcall_map_insert, &p, map, &key, &val);
8740 HEXDSP(hx_udcall_map_begin, &p, map);
8749 HEXDSP(hx_udcall_map_end, &p, map);
8757 HEXDSP(hx_udcall_map_next, &p);
8765 HEXDSP(hx_udcall_map_prev, &p);
8773 HEXDSP(hx_udcall_map_erase, map, &p);
8780 HEXDSP(hx_udcall_map_clear, map);
8787 return (
size_t)HEXDSP(hx_udcall_map_size, map);
8794 HEXDSP(hx_udcall_map_free, map);
8801 return (udcall_map_t *)HEXDSP(hx_udcall_map_new);
8816 return *(
treeloc_t *)HEXDSP(hx_user_cmts_first, &p);
8823 return *(
citem_cmt_t *)HEXDSP(hx_user_cmts_second, &p);
8831 HEXDSP(hx_user_cmts_find, &p, map, &key);
8840 HEXDSP(hx_user_cmts_insert, &p, map, &key, &val);
8849 HEXDSP(hx_user_cmts_begin, &p, map);
8858 HEXDSP(hx_user_cmts_end, &p, map);
8866 HEXDSP(hx_user_cmts_next, &p);
8874 HEXDSP(hx_user_cmts_prev, &p);
8882 HEXDSP(hx_user_cmts_erase, map, &p);
8889 HEXDSP(hx_user_cmts_clear, map);
8896 return (
size_t)HEXDSP(hx_user_cmts_size, map);
8903 HEXDSP(hx_user_cmts_free, map);
8932 return *(int32 *)HEXDSP(hx_user_iflags_second, &p);
8940 HEXDSP(hx_user_iflags_find, &p, map, &key);
8949 HEXDSP(hx_user_iflags_insert, &p, map, &key, &val);
8958 HEXDSP(hx_user_iflags_begin, &p, map);
8967 HEXDSP(hx_user_iflags_end, &p, map);
8975 HEXDSP(hx_user_iflags_next, &p);
8983 HEXDSP(hx_user_iflags_prev, &p);
8991 HEXDSP(hx_user_iflags_erase, map, &p);
8998 HEXDSP(hx_user_iflags_clear, map);
9005 return (
size_t)HEXDSP(hx_user_iflags_size, map);
9012 HEXDSP(hx_user_iflags_free, map);
9019 return (user_iflags_t *)HEXDSP(hx_user_iflags_new);
9034 return *(ea_t *)HEXDSP(hx_user_unions_first, &p);
9041 return *(intvec_t *)HEXDSP(hx_user_unions_second, &p);
9049 HEXDSP(hx_user_unions_find, &p, map, &key);
9058 HEXDSP(hx_user_unions_insert, &p, map, &key, &val);
9067 HEXDSP(hx_user_unions_begin, &p, map);
9076 HEXDSP(hx_user_unions_end, &p, map);
9084 HEXDSP(hx_user_unions_next, &p);
9092 HEXDSP(hx_user_unions_prev, &p);
9100 HEXDSP(hx_user_unions_erase, map, &p);
9107 HEXDSP(hx_user_unions_clear, map);
9114 return (
size_t)HEXDSP(hx_user_unions_size, map);
9121 HEXDSP(hx_user_unions_free, map);
9128 return (user_unions_t *)HEXDSP(hx_user_unions_new);
9143 return *(
int *)HEXDSP(hx_user_labels_first, &p);
9150 return *(qstring *)HEXDSP(hx_user_labels_second, &p);
9158 HEXDSP(hx_user_labels_find, &p, map, &key);
9167 HEXDSP(hx_user_labels_insert, &p, map, &key, &val);
9176 HEXDSP(hx_user_labels_begin, &p, map);
9185 HEXDSP(hx_user_labels_end, &p, map);
9193 HEXDSP(hx_user_labels_next, &p);
9201 HEXDSP(hx_user_labels_prev, &p);
9209 HEXDSP(hx_user_labels_erase, map, &p);
9216 HEXDSP(hx_user_labels_clear, map);
9223 return (
size_t)HEXDSP(hx_user_labels_size, map);
9230 HEXDSP(hx_user_labels_free, map);
9252 return *(ea_t *)HEXDSP(hx_eamap_first, &p);
9267 HEXDSP(hx_eamap_find, &p, map, &key);
9276 HEXDSP(hx_eamap_insert, &p, map, &key, &val);
9285 HEXDSP(hx_eamap_begin, &p, map);
9294 HEXDSP(hx_eamap_end, &p, map);
9302 HEXDSP(hx_eamap_next, &p);
9310 HEXDSP(hx_eamap_prev, &p);
9318 HEXDSP(hx_eamap_erase, map, &p);
9325 HEXDSP(hx_eamap_clear, map);
9332 return (
size_t)HEXDSP(hx_eamap_size, map);
9339 HEXDSP(hx_eamap_free, map);
9346 return (eamap_t *)HEXDSP(hx_eamap_new);
9361 return *(
cinsn_t * *)HEXDSP(hx_boundaries_first, &p);
9368 return *(rangeset_t *)HEXDSP(hx_boundaries_second, &p);
9376 HEXDSP(hx_boundaries_find, &p, map, &key);
9385 HEXDSP(hx_boundaries_insert, &p, map, &key, &val);
9394 HEXDSP(hx_boundaries_begin, &p, map);
9403 HEXDSP(hx_boundaries_end, &p, map);
9411 HEXDSP(hx_boundaries_next, &p);
9419 HEXDSP(hx_boundaries_prev, &p);
9427 HEXDSP(hx_boundaries_erase, map, &p);
9434 HEXDSP(hx_boundaries_clear, map);
9441 return (
size_t)HEXDSP(hx_boundaries_size, map);
9448 HEXDSP(hx_boundaries_free, map);
9455 return (boundaries_t *)HEXDSP(hx_boundaries_new);
9470 return *(
chain_t *)HEXDSP(hx_block_chains_get, &p);
9478 HEXDSP(hx_block_chains_find, &p, set, &val);
9487 HEXDSP(hx_block_chains_insert, &p, set, &val);
9496 HEXDSP(hx_block_chains_begin, &p, set);
9505 HEXDSP(hx_block_chains_end, &p, set);
9513 HEXDSP(hx_block_chains_next, &p);
9521 HEXDSP(hx_block_chains_prev, &p);
9529 HEXDSP(hx_block_chains_erase, set, &p);
9536 HEXDSP(hx_block_chains_clear, set);
9543 return (
size_t)HEXDSP(hx_block_chains_size, set);
9550 HEXDSP(hx_block_chains_free, set);
9561inline void *hexrays_alloc(
size_t size)
9563 return HEXDSP(hx_hexrays_alloc, size);
9567inline void hexrays_free(
void *ptr)
9569 HEXDSP(hx_hexrays_free, ptr);
9573inline void valrng_t::clear(
void)
9575 HEXDSP(hx_valrng_t_clear,
this);
9579inline void valrng_t::copy(
const valrng_t &r)
9581 HEXDSP(hx_valrng_t_copy,
this, &r);
9587 return *(
valrng_t *)HEXDSP(hx_valrng_t_assign,
this, &r);
9591inline int valrng_t::compare(
const valrng_t &r)
const
9593 return (
int)(size_t)HEXDSP(hx_valrng_t_compare,
this, &r);
9597inline void valrng_t::set_eq(uvlr_t v)
9599 HEXDSP(hx_valrng_t_set_eq,
this, v);
9603inline void valrng_t::set_cmp(cmpop_t cmp, uvlr_t _value)
9605 HEXDSP(hx_valrng_t_set_cmp,
this, cmp, _value);
9609inline bool valrng_t::reduce_size(
int new_size)
9611 return (uchar)(size_t)HEXDSP(hx_valrng_t_reduce_size,
this, new_size) != 0;
9615inline bool valrng_t::intersect_with(
const valrng_t &r)
9617 return (uchar)(size_t)HEXDSP(hx_valrng_t_intersect_with,
this, &r) != 0;
9621inline bool valrng_t::unite_with(
const valrng_t &r)
9623 return (uchar)(size_t)HEXDSP(hx_valrng_t_unite_with,
this, &r) != 0;
9627inline void valrng_t::inverse(
void)
9629 HEXDSP(hx_valrng_t_inverse,
this);
9633inline bool valrng_t::has(uvlr_t v)
const
9635 return (uchar)(size_t)HEXDSP(hx_valrng_t_has,
this, v) != 0;
9639inline void valrng_t::print(qstring *vout)
const
9641 HEXDSP(hx_valrng_t_print,
this, vout);
9645inline const char *valrng_t::dstr(
void)
const
9647 return (
const char *)HEXDSP(hx_valrng_t_dstr,
this);
9651inline bool valrng_t::cvt_to_single_value(uvlr_t *v)
const
9653 return (uchar)(size_t)HEXDSP(hx_valrng_t_cvt_to_single_value,
this, v) != 0;
9657inline bool valrng_t::cvt_to_cmp(cmpop_t *cmp, uvlr_t *val,
bool strict)
const
9659 return (uchar)(size_t)HEXDSP(hx_valrng_t_cvt_to_cmp,
this, cmp, val, strict) != 0;
9666 HEXDSP(hx_get_merror_desc, &retval, out, code, mba);
9673 return (uchar)(size_t)HEXDSP(hx_must_mcode_close_block, mcode, including_calls) != 0;
9679 return (uchar)(size_t)HEXDSP(hx_is_mcode_propagatable, mcode) != 0;
9683inline THREAD_SAFE mcode_t negate_mcode_relation(mcode_t code)
9685 return (mcode_t)(size_t)HEXDSP(hx_negate_mcode_relation, code);
9689inline THREAD_SAFE mcode_t swap_mcode_relation(mcode_t code)
9691 return (mcode_t)(size_t)HEXDSP(hx_swap_mcode_relation, code);
9695inline THREAD_SAFE mcode_t get_signed_mcode(mcode_t code)
9697 return (mcode_t)(size_t)HEXDSP(hx_get_signed_mcode, code);
9701inline THREAD_SAFE mcode_t get_unsigned_mcode(mcode_t code)
9703 return (mcode_t)(size_t)HEXDSP(hx_get_unsigned_mcode, code);
9707inline THREAD_SAFE
bool mcode_modifies_d(mcode_t mcode)
9709 return (uchar)(size_t)HEXDSP(hx_mcode_modifies_d, mcode) != 0;
9715 return (
int)(size_t)HEXDSP(hx_operand_locator_t_compare,
this, &r);
9719inline AS_PRINTF(3, 4) int
vd_printer_t::print(
int indent, const
char *format, ...)
9722 va_start(va, format);
9723 int retval = (int)(
size_t)HEXDSP(hx_vd_printer_t_print,
this, indent, format, va);
9729inline AS_PRINTF(3, 4) int
file_printer_t::print(
int indent, const
char *format, ...)
9732 va_start(va, format);
9733 int retval = (int)(
size_t)HEXDSP(hx_file_printer_t_print,
this, indent, format, va);
9739inline AS_PRINTF(3, 4) int
qstring_printer_t::print(
int indent, const
char *format, ...)
9742 va_start(va, format);
9743 int retval = (int)(
size_t)HEXDSP(hx_qstring_printer_t_print,
this, indent, format, va);
9749inline const char *
dstr(
const tinfo_t *tif)
9751 return (
const char *)HEXDSP(hx_dstr, tif);
9757 return (uchar)(size_t)HEXDSP(hx_is_type_correct, ptr) != 0;
9763 return (uchar)(size_t)HEXDSP(hx_is_small_udt, &tif) != 0;
9769 return (uchar)(size_t)HEXDSP(hx_is_nonbool_type, &type) != 0;
9775 return (uchar)(size_t)HEXDSP(hx_is_bool_type, &type) != 0;
9781 return (
int)(size_t)HEXDSP(hx_partial_type_num, &type);
9788 HEXDSP(hx_get_float_type, &retval, width);
9796 HEXDSP(hx_get_int_type_by_width_and_sign, &retval, srcwidth, sign);
9804 HEXDSP(hx_get_unk_type, &retval, size);
9812 HEXDSP(hx_dummy_ptrtype, &retval, ptrsize, isfp);
9819 return (uchar)(size_t)HEXDSP(hx_get_member_type, mptr, type) != 0;
9826 HEXDSP(hx_make_pointer, &retval, &type);
9834 HEXDSP(hx_create_typedef, &retval, name);
9841 return (uchar)(size_t)HEXDSP(hx_get_type,
id, tif, guess) != 0;
9847 return (uchar)(size_t)HEXDSP(hx_set_type,
id, &tif, source, force) != 0;
9851inline const char *vdloc_t::dstr(
int width)
const
9853 return (
const char *)HEXDSP(hx_vdloc_t_dstr,
this, width);
9857inline int vdloc_t::compare(
const vdloc_t &r)
const
9859 return (
int)(size_t)HEXDSP(hx_vdloc_t_compare,
this, &r);
9863inline bool vdloc_t::is_aliasable(
const mba_t *mb,
int size)
const
9865 return (uchar)(size_t)HEXDSP(hx_vdloc_t_is_aliasable,
this, mb, size) != 0;
9871 HEXDSP(hx_print_vdloc, vout, &loc, nbytes);
9877 return (uchar)(size_t)HEXDSP(hx_arglocs_overlap, &loc1, w1, &loc2, w2) != 0;
9883 return (
int)(size_t)HEXDSP(hx_lvar_locator_t_compare,
this, &r);
9887inline const char *lvar_locator_t::dstr(
void)
const
9889 return (
const char *)HEXDSP(hx_lvar_locator_t_dstr,
this);
9893inline const char *lvar_t::dstr(
void)
const
9895 return (
const char *)HEXDSP(hx_lvar_t_dstr,
this);
9901 return (uchar)(size_t)HEXDSP(hx_lvar_t_is_promoted_arg,
this) != 0;
9907 return (uchar)(size_t)HEXDSP(hx_lvar_t_accepts_type,
this, &t, may_change_thisarg) != 0;
9913 return (uchar)(size_t)HEXDSP(hx_lvar_t_set_lvar_type,
this, &t, may_fail) != 0;
9919 return (uchar)(size_t)HEXDSP(hx_lvar_t_set_width,
this, w, svw_flags) != 0;
9925 HEXDSP(hx_lvar_t_append_list,
this, mba, lst, pad_if_scattered);
9931 return (
int)(size_t)HEXDSP(hx_lvars_t_find_stkvar,
this, spoff, width);
9937 return (
lvar_t *)HEXDSP(hx_lvars_t_find,
this, &ll);
9943 return (
int)(size_t)HEXDSP(hx_lvars_t_find_lvar,
this, &location, width, defblk);
9949 return (uchar)(size_t)HEXDSP(hx_restore_user_lvar_settings, lvinf, func_ea) != 0;
9955 HEXDSP(hx_save_user_lvar_settings, func_ea, &lvinf);
9961 return (uchar)(size_t)HEXDSP(hx_modify_user_lvars, entry_ea, &mlv) != 0;
9967 return (uchar)(size_t)HEXDSP(hx_modify_user_lvar_info, func_ea, mli_flags, &info) != 0;
9973 return (uchar)(size_t)HEXDSP(hx_locate_lvar, out, func_ea, varname) != 0;
9979 return (uchar)(size_t)HEXDSP(hx_restore_user_defined_calls, udcalls, func_ea) != 0;
9985 HEXDSP(hx_save_user_defined_calls, func_ea, &udcalls);
9991 return (uchar)(size_t)HEXDSP(hx_parse_user_call, udc, decl, silent) != 0;
9997 return (
merror_t)(size_t)HEXDSP(hx_convert_to_user_call, &udc, &cdg);
10003 auto hrdsp = HEXDSP;
10004 return hrdsp !=
nullptr && (uchar)(
size_t)hrdsp(hx_install_microcode_filter, filter, install) != 0;
10010 HEXDSP(hx_udc_filter_t_cleanup,
this);
10014inline bool udc_filter_t::init(
const char *decl)
10016 return (uchar)(size_t)HEXDSP(hx_udc_filter_t_init,
this, decl) != 0;
10022 return (
merror_t)(size_t)HEXDSP(hx_udc_filter_t_apply,
this, &cdg);
10026inline bitset_t::bitset_t(
const bitset_t &m)
10028 HEXDSP(hx_bitset_t_bitset_t,
this, &m);
10034 return *(
bitset_t *)HEXDSP(hx_bitset_t_copy,
this, &m);
10038inline bool bitset_t::add(
int bit)
10040 return (uchar)(size_t)HEXDSP(hx_bitset_t_add,
this, bit) != 0;
10044inline bool bitset_t::add(
int bit,
int width)
10046 return (uchar)(size_t)HEXDSP(hx_bitset_t_add_,
this, bit, width) != 0;
10050inline bool bitset_t::add(
const bitset_t &ml)
10052 return (uchar)(size_t)HEXDSP(hx_bitset_t_add__,
this, &ml) != 0;
10056inline bool bitset_t::sub(
int bit)
10058 return (uchar)(size_t)HEXDSP(hx_bitset_t_sub,
this, bit) != 0;
10062inline bool bitset_t::sub(
int bit,
int width)
10064 return (uchar)(size_t)HEXDSP(hx_bitset_t_sub_,
this, bit, width) != 0;
10068inline bool bitset_t::sub(
const bitset_t &ml)
10070 return (uchar)(size_t)HEXDSP(hx_bitset_t_sub__,
this, &ml) != 0;
10074inline bool bitset_t::cut_at(
int maxbit)
10076 return (uchar)(size_t)HEXDSP(hx_bitset_t_cut_at,
this, maxbit) != 0;
10080inline void bitset_t::shift_down(
int shift)
10082 HEXDSP(hx_bitset_t_shift_down,
this, shift);
10086inline bool bitset_t::has(
int bit)
const
10088 return (uchar)(size_t)HEXDSP(hx_bitset_t_has,
this, bit) != 0;
10092inline bool bitset_t::has_all(
int bit,
int width)
const
10094 return (uchar)(size_t)HEXDSP(hx_bitset_t_has_all,
this, bit, width) != 0;
10098inline bool bitset_t::has_any(
int bit,
int width)
const
10100 return (uchar)(size_t)HEXDSP(hx_bitset_t_has_any,
this, bit, width) != 0;
10104inline const char *bitset_t::dstr(
void)
const
10106 return (
const char *)HEXDSP(hx_bitset_t_dstr,
this);
10110inline bool bitset_t::empty(
void)
const
10112 return (uchar)(size_t)HEXDSP(hx_bitset_t_empty,
this) != 0;
10116inline int bitset_t::count(
void)
const
10118 return (
int)(size_t)HEXDSP(hx_bitset_t_count,
this);
10122inline int bitset_t::count(
int bit)
const
10124 return (
int)(size_t)HEXDSP(hx_bitset_t_count_,
this, bit);
10128inline int bitset_t::last(
void)
const
10130 return (
int)(size_t)HEXDSP(hx_bitset_t_last,
this);
10134inline void bitset_t::fill_with_ones(
int maxbit)
10136 HEXDSP(hx_bitset_t_fill_with_ones,
this, maxbit);
10140inline bool bitset_t::fill_gaps(
int total_nbits)
10142 return (uchar)(size_t)HEXDSP(hx_bitset_t_fill_gaps,
this, total_nbits) != 0;
10146inline bool bitset_t::has_common(
const bitset_t &ml)
const
10148 return (uchar)(size_t)HEXDSP(hx_bitset_t_has_common,
this, &ml) != 0;
10152inline bool bitset_t::intersect(
const bitset_t &ml)
10154 return (uchar)(size_t)HEXDSP(hx_bitset_t_intersect,
this, &ml) != 0;
10158inline bool bitset_t::is_subset_of(
const bitset_t &ml)
const
10160 return (uchar)(size_t)HEXDSP(hx_bitset_t_is_subset_of,
this, &ml) != 0;
10164inline int bitset_t::compare(
const bitset_t &r)
const
10166 return (
int)(size_t)HEXDSP(hx_bitset_t_compare,
this, &r);
10170inline int bitset_t::goup(
int reg)
const
10172 return (
int)(size_t)HEXDSP(hx_bitset_t_goup,
this, reg);
10176inline const char *ivl_t::dstr(
void)
const
10178 return (
const char *)HEXDSP(hx_ivl_t_dstr,
this);
10182inline int ivl_t::compare(
const ivl_t &r)
const
10184 return (
int)(size_t)HEXDSP(hx_ivl_t_compare,
this, &r);
10188inline bool ivlset_t::add(
const ivl_t &ivl)
10190 return (uchar)(size_t)HEXDSP(hx_ivlset_t_add,
this, &ivl) != 0;
10194inline bool ivlset_t::add(
const ivlset_t &ivs)
10196 return (uchar)(size_t)HEXDSP(hx_ivlset_t_add_,
this, &ivs) != 0;
10200inline bool ivlset_t::addmasked(
const ivlset_t &ivs,
const ivl_t &mask)
10202 return (uchar)(size_t)HEXDSP(hx_ivlset_t_addmasked,
this, &ivs, &mask) != 0;
10206inline bool ivlset_t::sub(
const ivl_t &ivl)
10208 return (uchar)(size_t)HEXDSP(hx_ivlset_t_sub,
this, &ivl) != 0;
10212inline bool ivlset_t::sub(
const ivlset_t &ivs)
10214 return (uchar)(size_t)HEXDSP(hx_ivlset_t_sub_,
this, &ivs) != 0;
10218inline bool ivlset_t::has_common(
const ivl_t &ivl,
bool strict)
const
10220 return (uchar)(size_t)HEXDSP(hx_ivlset_t_has_common,
this, &ivl, strict) != 0;
10224inline void ivlset_t::print(qstring *vout)
const
10226 HEXDSP(hx_ivlset_t_print,
this, vout);
10230inline const char *ivlset_t::dstr(
void)
const
10232 return (
const char *)HEXDSP(hx_ivlset_t_dstr,
this);
10236inline asize_t ivlset_t::count(
void)
const
10239 HEXDSP(hx_ivlset_t_count, &retval,
this);
10244inline bool ivlset_t::has_common(
const ivlset_t &ivs)
const
10246 return (uchar)(size_t)HEXDSP(hx_ivlset_t_has_common_,
this, &ivs) != 0;
10250inline bool ivlset_t::contains(uval_t off)
const
10252 return (uchar)(size_t)HEXDSP(hx_ivlset_t_contains,
this, off) != 0;
10256inline bool ivlset_t::includes(
const ivlset_t &ivs)
const
10258 return (uchar)(size_t)HEXDSP(hx_ivlset_t_includes,
this, &ivs) != 0;
10262inline bool ivlset_t::intersect(
const ivlset_t &ivs)
10264 return (uchar)(size_t)HEXDSP(hx_ivlset_t_intersect,
this, &ivs) != 0;
10268inline int ivlset_t::compare(
const ivlset_t &r)
const
10270 return (
int)(size_t)HEXDSP(hx_ivlset_t_compare,
this, &r);
10274inline void rlist_t::print(qstring *vout)
const
10276 HEXDSP(hx_rlist_t_print,
this, vout);
10280inline const char *rlist_t::dstr(
void)
const
10282 return (
const char *)HEXDSP(hx_rlist_t_dstr,
this);
10286inline bool mlist_t::addmem(ea_t ea, asize_t size)
10288 return (uchar)(size_t)HEXDSP(hx_mlist_t_addmem,
this, ea, size) != 0;
10292inline void mlist_t::print(qstring *vout)
const
10294 HEXDSP(hx_mlist_t_print,
this, vout);
10298inline const char *mlist_t::dstr(
void)
const
10300 return (
const char *)HEXDSP(hx_mlist_t_dstr,
this);
10304inline int mlist_t::compare(
const mlist_t &r)
const
10306 return (
int)(size_t)HEXDSP(hx_mlist_t_compare,
this, &r);
10312 return *(
const mlist_t *)HEXDSP(hx_get_temp_regs);
10318 return (uchar)(size_t)HEXDSP(hx_is_kreg, r) != 0;
10324 return (
mreg_t)(size_t)HEXDSP(hx_reg2mreg, reg);
10330 return (
int)(size_t)HEXDSP(hx_mreg2reg, reg, width);
10336 return (
int)(size_t)HEXDSP(hx_get_mreg_name, out, reg, width, ud);
10342 HEXDSP(hx_install_optinsn_handler, opt);
10348 return (uchar)(size_t)HEXDSP(hx_remove_optinsn_handler, opt) != 0;
10354 HEXDSP(hx_install_optblock_handler, opt);
10360 auto hrdsp = HEXDSP;
10361 return hrdsp !=
nullptr && (uchar)(
size_t)hrdsp(hx_remove_optblock_handler, opt) != 0;
10365inline int lvar_ref_t::compare(
const lvar_ref_t &r)
const
10367 return (
int)(size_t)HEXDSP(hx_lvar_ref_t_compare,
this, &r);
10373 return *(
lvar_t *)HEXDSP(hx_lvar_ref_t_var,
this);
10377inline int stkvar_ref_t::compare(
const stkvar_ref_t &r)
const
10379 return (
int)(size_t)HEXDSP(hx_stkvar_ref_t_compare,
this, &r);
10385 return (member_t *)HEXDSP(hx_stkvar_ref_t_get_stkvar,
this, p_off);
10389inline void fnumber_t::print(qstring *vout)
const
10391 HEXDSP(hx_fnumber_t_print,
this, vout);
10395inline const char *fnumber_t::dstr(
void)
const
10397 return (
const char *)HEXDSP(hx_fnumber_t_dstr,
this);
10401inline void mop_t::copy(
const mop_t &rop)
10403 HEXDSP(hx_mop_t_copy,
this, &rop);
10407inline mop_t &mop_t::assign(
const mop_t &rop)
10409 return *(
mop_t *)HEXDSP(hx_mop_t_assign,
this, &rop);
10413inline void mop_t::swap(
mop_t &rop)
10415 HEXDSP(hx_mop_t_swap,
this, &rop);
10419inline void mop_t::erase(
void)
10421 HEXDSP(hx_mop_t_erase,
this);
10425inline void mop_t::print(qstring *vout,
int shins_flags)
const
10427 HEXDSP(hx_mop_t_print,
this, vout, shins_flags);
10431inline const char *mop_t::dstr(
void)
const
10433 return (
const char *)HEXDSP(hx_mop_t_dstr,
this);
10439 return (uchar)(size_t)HEXDSP(hx_mop_t_create_from_mlist,
this, mba, &lst, fullsize) != 0;
10445 return (uchar)(size_t)HEXDSP(hx_mop_t_create_from_ivlset,
this, mba, &ivs, fullsize) != 0;
10451 HEXDSP(hx_mop_t_create_from_vdloc,
this, mba, &loc, _size);
10457 HEXDSP(hx_mop_t_create_from_scattered_vdloc,
this, mba, name, &type, &loc);
10463 HEXDSP(hx_mop_t_create_from_insn,
this, m);
10469 HEXDSP(hx_mop_t_make_number,
this, _value, _size, _ea, opnum);
10475 return (uchar)(size_t)HEXDSP(hx_mop_t_make_fpnum,
this, bytes, _size) != 0;
10481 HEXDSP(hx_mop_t__make_gvar,
this, ea);
10487 HEXDSP(hx_mop_t_make_gvar,
this, ea);
10493 HEXDSP(hx_mop_t_make_reg_pair,
this, loreg, hireg, halfsize);
10499 HEXDSP(hx_mop_t_make_helper,
this, name);
10505 return (uchar)(size_t)HEXDSP(hx_mop_t_is_bit_reg, reg) != 0;
10511 return (uchar)(size_t)HEXDSP(hx_mop_t_may_use_aliased_memory,
this) != 0;
10517 return (uchar)(size_t)HEXDSP(hx_mop_t_is01,
this) != 0;
10523 return (uchar)(size_t)HEXDSP(hx_mop_t_is_sign_extended_from,
this, nbytes) != 0;
10529 return (uchar)(size_t)HEXDSP(hx_mop_t_is_zero_extended_from,
this, nbytes) != 0;
10535 return (uchar)(size_t)HEXDSP(hx_mop_t_equal_mops,
this, &rop, eqflags) != 0;
10539inline int mop_t::lexcompare(
const mop_t &rop)
const
10541 return (
int)(size_t)HEXDSP(hx_mop_t_lexcompare,
this, &rop);
10547 return (
int)(size_t)HEXDSP(hx_mop_t_for_all_ops,
this, &mv, type, is_target);
10553 return (
int)(size_t)HEXDSP(hx_mop_t_for_all_scattered_submops,
this, &sv);
10559 return (uchar)(size_t)HEXDSP(hx_mop_t_is_constant,
this, out, is_signed) != 0;
10565 return (uchar)(size_t)HEXDSP(hx_mop_t_get_stkoff,
this, p_off) != 0;
10571 return (uchar)(size_t)HEXDSP(hx_mop_t_make_low_half,
this, width) != 0;
10577 return (uchar)(size_t)HEXDSP(hx_mop_t_make_high_half,
this, width) != 0;
10583 return (uchar)(size_t)HEXDSP(hx_mop_t_make_first_half,
this, width) != 0;
10589 return (uchar)(size_t)HEXDSP(hx_mop_t_make_second_half,
this, width) != 0;
10595 return (uchar)(size_t)HEXDSP(hx_mop_t_shift_mop,
this, offset) != 0;
10601 return (uchar)(size_t)HEXDSP(hx_mop_t_change_size,
this, nsize, sideff) != 0;
10607 return (uchar)(size_t)HEXDSP(hx_mop_t_preserve_side_effects,
this, blk, top, moved_calls) != 0;
10613 HEXDSP(hx_mop_t_apply_ld_mcode,
this, mcode, ea, newsize);
10617inline void mcallarg_t::print(qstring *vout,
int shins_flags)
const
10619 HEXDSP(hx_mcallarg_t_print,
this, vout, shins_flags);
10623inline const char *mcallarg_t::dstr(
void)
const
10625 return (
const char *)HEXDSP(hx_mcallarg_t_dstr,
this);
10629inline void mcallarg_t::set_regarg(
mreg_t mr,
int sz,
const tinfo_t &tif)
10631 HEXDSP(hx_mcallarg_t_set_regarg,
this, mr, sz, &tif);
10635inline int mcallinfo_t::lexcompare(
const mcallinfo_t &f)
const
10637 return (
int)(size_t)HEXDSP(hx_mcallinfo_t_lexcompare,
this, &f);
10641inline bool mcallinfo_t::set_type(
const tinfo_t &type)
10643 return (uchar)(size_t)HEXDSP(hx_mcallinfo_t_set_type,
this, &type) != 0;
10647inline tinfo_t mcallinfo_t::get_type(
void)
const
10650 HEXDSP(hx_mcallinfo_t_get_type, &retval,
this);
10655inline void mcallinfo_t::print(qstring *vout,
int size,
int shins_flags)
const
10657 HEXDSP(hx_mcallinfo_t_print,
this, vout, size, shins_flags);
10661inline const char *mcallinfo_t::dstr(
void)
const
10663 return (
const char *)HEXDSP(hx_mcallinfo_t_dstr,
this);
10667inline int mcases_t::compare(
const mcases_t &r)
const
10669 return (
int)(size_t)HEXDSP(hx_mcases_t_compare,
this, &r);
10673inline void mcases_t::print(qstring *vout)
const
10675 HEXDSP(hx_mcases_t_print,
this, vout);
10679inline const char *mcases_t::dstr(
void)
const
10681 return (
const char *)HEXDSP(hx_mcases_t_dstr,
this);
10687 return (uchar)(size_t)HEXDSP(hx_vivl_t_extend_to_cover,
this, &r) != 0;
10694 HEXDSP(hx_vivl_t_intersect, &retval,
this, &r);
10699inline void vivl_t::print(qstring *vout)
const
10701 HEXDSP(hx_vivl_t_print,
this, vout);
10705inline const char *vivl_t::dstr(
void)
const
10707 return (
const char *)HEXDSP(hx_vivl_t_dstr,
this);
10711inline void chain_t::print(qstring *vout)
const
10713 HEXDSP(hx_chain_t_print,
this, vout);
10717inline const char *chain_t::dstr(
void)
const
10719 return (
const char *)HEXDSP(hx_chain_t_dstr,
this);
10725 HEXDSP(hx_chain_t_append_list,
this, mba, list);
10731 return (
const chain_t *)HEXDSP(hx_block_chains_t_get_chain,
this, &ch);
10735inline void block_chains_t::print(qstring *vout)
const
10737 HEXDSP(hx_block_chains_t_print,
this, vout);
10741inline const char *block_chains_t::dstr(
void)
const
10743 return (
const char *)HEXDSP(hx_block_chains_t_dstr,
this);
10749 return (
int)(size_t)HEXDSP(hx_graph_chains_t_for_all_chains,
this, &cv, gca_flags);
10755 HEXDSP(hx_graph_chains_t_release,
this);
10759inline void minsn_t::init(ea_t _ea)
10761 HEXDSP(hx_minsn_t_init,
this, _ea);
10765inline void minsn_t::copy(
const minsn_t &m)
10767 HEXDSP(hx_minsn_t_copy,
this, &m);
10771inline void minsn_t::set_combined(
void)
10773 HEXDSP(hx_minsn_t_set_combined,
this);
10779 HEXDSP(hx_minsn_t_swap,
this, &m);
10785 HEXDSP(hx_minsn_t_print,
this, vout, shins_flags);
10791 return (
const char *)HEXDSP(hx_minsn_t_dstr,
this);
10797 HEXDSP(hx_minsn_t_setaddr,
this, new_ea);
10803 return (
int)(size_t)HEXDSP(hx_minsn_t_optimize_subtree,
this, blk, top, parent, converted_call, optflags);
10809 return (
int)(size_t)HEXDSP(hx_minsn_t_for_all_ops,
this, &mv);
10815 return (
int)(size_t)HEXDSP(hx_minsn_t_for_all_insns,
this, &mv);
10821 HEXDSP(hx_minsn_t__make_nop,
this);
10827 return (uchar)(size_t)HEXDSP(hx_minsn_t_equal_insns,
this, &m, eqflags) != 0;
10831inline int minsn_t::lexcompare(
const minsn_t &ri)
const
10833 return (
int)(size_t)HEXDSP(hx_minsn_t_lexcompare,
this, &ri);
10839 return (uchar)(size_t)HEXDSP(hx_minsn_t_is_noret_call,
this, flags) != 0;
10845 return (uchar)(size_t)HEXDSP(hx_minsn_t_is_helper,
this, name) != 0;
10851 return (
minsn_t *)HEXDSP(hx_minsn_t_find_call,
this, with_helpers);
10857 return (uchar)(size_t)HEXDSP(hx_minsn_t_has_side_effects,
this, include_ldx_and_divs) != 0;
10863 return (
minsn_t *)HEXDSP(hx_minsn_t_find_opcode,
this, mcode);
10869 return (
const minsn_t *)HEXDSP(hx_minsn_t_find_ins_op,
this, other, op);
10875 return (
const mop_t *)HEXDSP(hx_minsn_t_find_num_op,
this, other);
10881 return (uchar)(size_t)HEXDSP(hx_minsn_t_modifies_d,
this) != 0;
10887 return (uchar)(size_t)HEXDSP(hx_minsn_t_is_between,
this, m1, m2) != 0;
10893 return (uchar)(size_t)HEXDSP(hx_minsn_t_may_use_aliased_memory,
this) != 0;
10899 return (
const minsn_t *)HEXDSP(hx_getf_reginsn, ins);
10905 return (
const minsn_t *)HEXDSP(hx_getb_reginsn, ins);
10909inline void mblock_t::init(
void)
10911 HEXDSP(hx_mblock_t_init,
this);
10917 HEXDSP(hx_mblock_t_print,
this, &vp);
10923 HEXDSP(hx_mblock_t_dump,
this);
10927inline AS_PRINTF(2, 0) void
mblock_t::vdump_block(const
char *title, va_list va)
const
10929 HEXDSP(hx_mblock_t_vdump_block,
this, title, va);
10935 return (
minsn_t *)HEXDSP(hx_mblock_t_insert_into_block,
this, nm, om);
10941 return (
minsn_t *)HEXDSP(hx_mblock_t_remove_from_block,
this, m);
10947 return (
int)(size_t)HEXDSP(hx_mblock_t_for_all_insns,
this, &mv);
10953 return (
int)(size_t)HEXDSP(hx_mblock_t_for_all_ops,
this, &mv);
10959 return (
int)(size_t)HEXDSP(hx_mblock_t_for_all_uses,
this, list, i1, i2, &mmv);
10965 return (
int)(size_t)HEXDSP(hx_mblock_t_optimize_insn,
this, m, optflags);
10971 return (
int)(size_t)HEXDSP(hx_mblock_t_optimize_block,
this);
10977 return (
int)(size_t)HEXDSP(hx_mblock_t_build_lists,
this, kill_deads);
10983 return (
int)(size_t)HEXDSP(hx_mblock_t_optimize_useless_jump,
this);
10989 HEXDSP(hx_mblock_t_append_use_list,
this, list, &op, maymust, &mask);
10995 HEXDSP(hx_mblock_t_append_def_list,
this, list, &op, maymust);
11002 HEXDSP(hx_mblock_t_build_use_list, &retval,
this, &ins, maymust);
11010 HEXDSP(hx_mblock_t_build_def_list, &retval,
this, &ins, maymust);
11017 return (
const minsn_t *)HEXDSP(hx_mblock_t_find_first_use,
this, list, i1, i2, maymust);
11023 return (
const minsn_t *)HEXDSP(hx_mblock_t_find_redefinition,
this, &list, i1, i2, maymust);
11029 return (uchar)(size_t)HEXDSP(hx_mblock_t_is_rhs_redefined,
this, ins, i1, i2) != 0;
11035 return (
minsn_t *)HEXDSP(hx_mblock_t_find_access,
this, &op, parent, mend, fdflags);
11041 return (uchar)(size_t)HEXDSP(hx_mblock_t_get_valranges,
this, res, &vivl, vrflags) != 0;
11047 return (uchar)(size_t)HEXDSP(hx_mblock_t_get_valranges_,
this, res, &vivl, m, vrflags) != 0;
11053 return (
size_t)HEXDSP(hx_mblock_t_get_reginsn_qty,
this);
11057inline bool mba_ranges_t::range_contains(ea_t ea)
const
11059 return (uchar)(size_t)HEXDSP(hx_mba_ranges_t_range_contains,
this, ea) != 0;
11063inline vdloc_t mba_t::idaloc2vd(
const argloc_t &loc,
int width, sval_t spd)
11066 HEXDSP(hx_mba_t_idaloc2vd, &retval, &loc, width, spd);
11071inline vdloc_t mba_t::idaloc2vd(
const argloc_t &loc,
int width)
const
11074 HEXDSP(hx_mba_t_idaloc2vd_, &retval,
this, &loc, width);
11079inline argloc_t mba_t::vd2idaloc(
const vdloc_t &loc,
int width, sval_t spd)
11082 HEXDSP(hx_mba_t_vd2idaloc, &retval, &loc, width, spd);
11087inline argloc_t mba_t::vd2idaloc(
const vdloc_t &loc,
int width)
const
11090 HEXDSP(hx_mba_t_vd2idaloc_, &retval,
this, &loc, width);
11095inline void mba_t::term(
void)
11097 HEXDSP(hx_mba_t_term,
this);
11101inline func_t *mba_t::get_curfunc(
void)
const
11103 return (func_t *)HEXDSP(hx_mba_t_get_curfunc,
this);
11109 return (uchar)(size_t)HEXDSP(hx_mba_t_set_maturity,
this, mat) != 0;
11115 return (
int)(size_t)HEXDSP(hx_mba_t_optimize_local,
this, locopt_bits);
11121 return (
merror_t)(size_t)HEXDSP(hx_mba_t_build_graph,
this);
11127 return (
mbl_graph_t *)HEXDSP(hx_mba_t_get_graph,
this);
11133 return (
int)(size_t)HEXDSP(hx_mba_t_analyze_calls,
this, acflags);
11139 return (
merror_t)(size_t)HEXDSP(hx_mba_t_optimize_global,
this);
11145 HEXDSP(hx_mba_t_alloc_lvars,
this);
11151 HEXDSP(hx_mba_t_dump,
this);
11155inline AS_PRINTF(3, 0) void
mba_t::vdump_mba(
bool _verify, const
char *title, va_list va)
const
11157 HEXDSP(hx_mba_t_vdump_mba,
this, _verify, title, va);
11163 HEXDSP(hx_mba_t_print,
this, &vp);
11169 HEXDSP(hx_mba_t_verify,
this, always);
11175 HEXDSP(hx_mba_t_mark_chains_dirty,
this);
11181 return (
mblock_t *)HEXDSP(hx_mba_t_insert_block,
this, bblk);
11187 return (uchar)(size_t)HEXDSP(hx_mba_t_remove_block,
this, blk) != 0;
11193 return (
mblock_t *)HEXDSP(hx_mba_t_copy_block,
this, blk, new_serial, cpblk_flags);
11199 return (uchar)(size_t)HEXDSP(hx_mba_t_remove_empty_and_unreachable_blocks,
this) != 0;
11205 return (uchar)(size_t)HEXDSP(hx_mba_t_combine_blocks,
this) != 0;
11211 return (
int)(size_t)HEXDSP(hx_mba_t_for_all_ops,
this, &mv);
11217 return (
int)(size_t)HEXDSP(hx_mba_t_for_all_insns,
this, &mv);
11223 return (
int)(size_t)HEXDSP(hx_mba_t_for_all_topinsns,
this, &mv);
11229 return (
mop_t *)HEXDSP(hx_mba_t_find_mop,
this, ctx, ea, is_dest, &list);
11235 return (
minsn_t *)HEXDSP(hx_mba_t_create_helper_call,
this, ea, helper, rettype, callargs, out);
11241 return *(
lvar_t *)HEXDSP(hx_mba_t_arg,
this, n);
11248 HEXDSP(hx_mba_t_alloc_fict_ea, &retval,
this, real_ea);
11256 HEXDSP(hx_mba_t_map_fict_ea, &retval,
this, fict_ea);
11263 HEXDSP(hx_mba_t_serialize,
this, &vout);
11269 return (
mba_t *)HEXDSP(hx_mba_t_deserialize, bytes, nbytes);
11275 HEXDSP(hx_mba_t_save_snapshot,
this, description);
11281 return (
mreg_t)(size_t)HEXDSP(hx_mba_t_alloc_kreg,
this, size, check_size);
11287 HEXDSP(hx_mba_t_free_kreg,
this, reg, size);
11291inline 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
11293 return (uchar)(size_t)HEXDSP(hx_mbl_graph_t_is_accessed_globally,
this, &list, b1, b2, m1, m2, access_type, maymust) != 0;
11299 return (
graph_chains_t *)HEXDSP(hx_mbl_graph_t_get_ud,
this, gctype);
11305 return (
graph_chains_t *)HEXDSP(hx_mbl_graph_t_get_du,
this, gctype);
11309inline merror_t cdg_insn_iterator_t::next(insn_t *ins)
11311 return (
merror_t)(size_t)HEXDSP(hx_cdg_insn_iterator_t_next,
this, ins);
11317 return (
minsn_t *)HEXDSP(hx_codegen_t_emit,
this, code, width, l, r, d, offsize);
11323 return (
minsn_t *)HEXDSP(hx_codegen_t_emit_,
this, code, l, r, d);
11329 return (
const char *)HEXDSP(hx_get_hexrays_version);
11335 return (uchar)(size_t)HEXDSP(hx_checkout_hexrays_license, silent) != 0;
11341 return (
vdui_t *)HEXDSP(hx_open_pseudocode, ea, flags);
11347 return (uchar)(size_t)HEXDSP(hx_close_pseudocode, f) != 0;
11353 return (
vdui_t *)HEXDSP(hx_get_widget_vdui, f);
11359 return (uchar)(size_t)HEXDSP(hx_decompile_many, outfile, funcaddrs, flags) != 0;
11363inline qstring hexrays_failure_t::desc(
void)
const
11366 HEXDSP(hx_hexrays_failure_t_desc, &retval,
this);
11373 HEXDSP(hx_send_database, &err, silent);
11379 return (uchar)(size_t)HEXDSP(hx_gco_info_t_append_to_list,
this, list, mba) != 0;
11385 return (uchar)(size_t)HEXDSP(hx_get_current_operand, out) != 0;
11389inline void remitem(
const citem_t *e)
11391 HEXDSP(hx_remitem, e);
11397 return (
ctype_t)(size_t)HEXDSP(hx_negated_relation, op);
11403 return (
ctype_t)(size_t)HEXDSP(hx_swapped_relation, op);
11409 return (type_sign_t)(size_t)HEXDSP(hx_get_op_signness, op);
11415 return (
ctype_t)(size_t)HEXDSP(hx_asgop, cop);
11421 return (
ctype_t)(size_t)HEXDSP(hx_asgop_revert, cop);
11427 HEXDSP(hx_cnumber_t_print,
this, vout, &type, parent, nice_stroff);
11434 HEXDSP(hx_cnumber_t_value, &retval,
this, &type);
11441 HEXDSP(hx_cnumber_t_assign,
this, v, nbytes, sign);
11445inline int cnumber_t::compare(
const cnumber_t &r)
const
11447 return (
int)(size_t)HEXDSP(hx_cnumber_t_compare,
this, &r);
11451inline int var_ref_t::compare(
const var_ref_t &r)
const
11453 return (
int)(size_t)HEXDSP(hx_var_ref_t_compare,
this, &r);
11459 return (
int)(size_t)HEXDSP(hx_ctree_visitor_t_apply_to,
this, item, parent);
11465 return (
int)(size_t)HEXDSP(hx_ctree_visitor_t_apply_to_exprs,
this, item, parent);
11471 return (uchar)(size_t)HEXDSP(hx_ctree_parentee_t_recalc_parent_types,
this) != 0;
11477 return (uchar)(size_t)HEXDSP(hx_cfunc_parentee_t_calc_rvalue_type,
this, target, e) != 0;
11483 return (
int)(size_t)HEXDSP(hx_citem_locator_t_compare,
this, &r);
11489 return (uchar)(size_t)HEXDSP(hx_citem_t_contains_expr,
this, e) != 0;
11495 return (uchar)(size_t)HEXDSP(hx_citem_t_contains_label,
this) != 0;
11501 return (
const citem_t *)HEXDSP(hx_citem_t_find_parent_of,
this, sitem);
11505inline citem_t *citem_t::find_closest_addr(ea_t _ea)
11507 return (
citem_t *)HEXDSP(hx_citem_t_find_closest_addr,
this, _ea);
11513 return *(
cexpr_t *)HEXDSP(hx_cexpr_t_assign,
this, &r);
11517inline int cexpr_t::compare(
const cexpr_t &r)
const
11519 return (
int)(size_t)HEXDSP(hx_cexpr_t_compare,
this, &r);
11525 HEXDSP(hx_cexpr_t_replace_by,
this, r);
11531 HEXDSP(hx_cexpr_t_cleanup,
this);
11537 HEXDSP(hx_cexpr_t_put_number,
this, func, value, nbytes, sign);
11543 HEXDSP(hx_cexpr_t_print1,
this, vout, func);
11549 HEXDSP(hx_cexpr_t_calc_type,
this, recursive);
11555 return (uchar)(size_t)HEXDSP(hx_cexpr_t_equal_effect,
this, &r) != 0;
11561 return (uchar)(size_t)HEXDSP(hx_cexpr_t_is_child_of,
this, parent) != 0;
11567 return (uchar)(size_t)HEXDSP(hx_cexpr_t_contains_operator,
this, needed_op, times) != 0;
11574 HEXDSP(hx_cexpr_t_get_high_nbit_bound, &retval,
this);
11581 return (
int)(size_t)HEXDSP(hx_cexpr_t_get_low_nbit_bound,
this);
11587 return (uchar)(size_t)HEXDSP(hx_cexpr_t_requires_lvalue,
this, child) != 0;
11593 return (uchar)(size_t)HEXDSP(hx_cexpr_t_has_side_effects,
this) != 0;
11599 return (uchar)(size_t)HEXDSP(hx_cexpr_t_maybe_ptr,
this) != 0;
11605 return *(
cif_t *)HEXDSP(hx_cif_t_assign,
this, &r);
11609inline int cif_t::compare(
const cif_t &r)
const
11611 return (
int)(size_t)HEXDSP(hx_cif_t_compare,
this, &r);
11617 return *(
cloop_t *)HEXDSP(hx_cloop_t_assign,
this, &r);
11621inline int cfor_t::compare(
const cfor_t &r)
const
11623 return (
int)(size_t)HEXDSP(hx_cfor_t_compare,
this, &r);
11627inline int cwhile_t::compare(
const cwhile_t &r)
const
11629 return (
int)(size_t)HEXDSP(hx_cwhile_t_compare,
this, &r);
11633inline int cdo_t::compare(
const cdo_t &r)
const
11635 return (
int)(size_t)HEXDSP(hx_cdo_t_compare,
this, &r);
11639inline int creturn_t::compare(
const creturn_t &r)
const
11641 return (
int)(size_t)HEXDSP(hx_creturn_t_compare,
this, &r);
11645inline int cgoto_t::compare(
const cgoto_t &r)
const
11647 return (
int)(size_t)HEXDSP(hx_cgoto_t_compare,
this, &r);
11651inline int casm_t::compare(
const casm_t &r)
const
11653 return (
int)(size_t)HEXDSP(hx_casm_t_compare,
this, &r);
11659 return *(
cinsn_t *)HEXDSP(hx_cinsn_t_assign,
this, &r);
11663inline int cinsn_t::compare(
const cinsn_t &r)
const
11665 return (
int)(size_t)HEXDSP(hx_cinsn_t_compare,
this, &r);
11671 HEXDSP(hx_cinsn_t_replace_by,
this, r);
11677 HEXDSP(hx_cinsn_t_cleanup,
this);
11683 return *(
cinsn_t *)HEXDSP(hx_cinsn_t_new_insn,
this, insn_ea);
11689 return *(
cif_t *)HEXDSP(hx_cinsn_t_create_if,
this, cnd);
11695 HEXDSP(hx_cinsn_t_print,
this, indent, &vp, use_curly);
11701 HEXDSP(hx_cinsn_t_print1,
this, vout, func);
11707 return (uchar)(size_t)HEXDSP(hx_cinsn_t_is_ordinary_flow,
this) != 0;
11713 return (uchar)(size_t)HEXDSP(hx_cinsn_t_contains_insn,
this, type, times) != 0;
11719 return (uchar)(size_t)HEXDSP(hx_cinsn_t_collect_free_breaks,
this, breaks) != 0;
11725 return (uchar)(size_t)HEXDSP(hx_cinsn_t_collect_free_continues,
this, continues) != 0;
11729inline int cblock_t::compare(
const cblock_t &r)
const
11731 return (
int)(size_t)HEXDSP(hx_cblock_t_compare,
this, &r);
11735inline int carglist_t::compare(
const carglist_t &r)
const
11737 return (
int)(size_t)HEXDSP(hx_carglist_t_compare,
this, &r);
11741inline int ccase_t::compare(
const ccase_t &r)
const
11743 return (
int)(size_t)HEXDSP(hx_ccase_t_compare,
this, &r);
11747inline int ccases_t::compare(
const ccases_t &r)
const
11749 return (
int)(size_t)HEXDSP(hx_ccases_t_compare,
this, &r);
11753inline int cswitch_t::compare(
const cswitch_t &r)
const
11755 return (
int)(size_t)HEXDSP(hx_cswitch_t_compare,
this, &r);
11761 return (member_t *)HEXDSP(hx_ctree_item_t_get_memptr,
this, p_sptr);
11767 return (
lvar_t *)HEXDSP(hx_ctree_item_t_get_lvar,
this);
11774 HEXDSP(hx_ctree_item_t_get_ea, &retval,
this);
11781 return (
int)(size_t)HEXDSP(hx_ctree_item_t_get_label_num,
this, gln_flags);
11787 return (
cexpr_t *)HEXDSP(hx_lnot, e);
11793 return (
cinsn_t *)HEXDSP(hx_new_block);
11797inline AS_PRINTF(3, 0)
cexpr_t *vcreate_helper(
bool standalone, const tinfo_t &type, const
char *format, va_list va)
11799 return (
cexpr_t *)HEXDSP(hx_vcreate_helper, standalone, &type, format, va);
11803inline AS_PRINTF(3, 0)
cexpr_t *vcall_helper(const tinfo_t &rettype,
carglist_t *args, const
char *format, va_list va)
11805 return (
cexpr_t *)HEXDSP(hx_vcall_helper, &rettype, args, format, va);
11811 return (
cexpr_t *)HEXDSP(hx_make_num, n, func, ea, opnum, sign, size);
11817 return (
cexpr_t *)HEXDSP(hx_make_ref, e);
11823 return (
cexpr_t *)HEXDSP(hx_dereference, e, ptrsize, is_flt);
11829 HEXDSP(hx_save_user_labels, func_ea, user_labels);
11833inline void save_user_labels2(ea_t func_ea,
const user_labels_t *user_labels,
const cfunc_t *func)
11835 HEXDSP(hx_save_user_labels2, func_ea, user_labels, func);
11841 HEXDSP(hx_save_user_cmts, func_ea, user_cmts);
11847 HEXDSP(hx_save_user_numforms, func_ea, numforms);
11853 HEXDSP(hx_save_user_iflags, func_ea, iflags);
11859 HEXDSP(hx_save_user_unions, func_ea, unions);
11865 return (
user_labels_t *)HEXDSP(hx_restore_user_labels, func_ea);
11871 return (
user_labels_t *)HEXDSP(hx_restore_user_labels2, func_ea, func);
11877 return (
user_cmts_t *)HEXDSP(hx_restore_user_cmts, func_ea);
11889 return (user_iflags_t *)HEXDSP(hx_restore_user_iflags, func_ea);
11895 return (user_unions_t *)HEXDSP(hx_restore_user_unions, func_ea);
11901 HEXDSP(hx_cfunc_t_build_c_tree,
this);
11907 HEXDSP(hx_cfunc_t_verify,
this, aul, even_without_debugger);
11913 HEXDSP(hx_cfunc_t_print_dcl,
this, vout);
11919 HEXDSP(hx_cfunc_t_print_func,
this, &vp);
11925 return (uchar)(size_t)HEXDSP(hx_cfunc_t_get_func_type,
this, type) != 0;
11931 return (
lvars_t *)HEXDSP(hx_cfunc_t_get_lvars,
this);
11938 HEXDSP(hx_cfunc_t_get_stkoff_delta, &retval,
this);
11945 return (
citem_t *)HEXDSP(hx_cfunc_t_find_label,
this, label);
11951 HEXDSP(hx_cfunc_t_remove_unused_labels,
this);
11957 return (
const char *)HEXDSP(hx_cfunc_t_get_user_cmt,
this, &loc, rt);
11963 HEXDSP(hx_cfunc_t_set_user_cmt,
this, &loc, cmt);
11969 return (int32)(size_t)HEXDSP(hx_cfunc_t_get_user_iflags,
this, &loc);
11975 HEXDSP(hx_cfunc_t_set_user_iflags,
this, &loc, iflags);
11981 return (uchar)(size_t)HEXDSP(hx_cfunc_t_has_orphan_cmts,
this) != 0;
11987 return (
int)(size_t)HEXDSP(hx_cfunc_t_del_orphan_cmts,
this);
11993 return (uchar)(size_t)HEXDSP(hx_cfunc_t_get_user_union_selection,
this, ea, path) != 0;
11999 HEXDSP(hx_cfunc_t_set_user_union_selection,
this, ea, &path);
12005 HEXDSP(hx_cfunc_t_save_user_labels,
this);
12011 HEXDSP(hx_cfunc_t_save_user_cmts,
this);
12017 HEXDSP(hx_cfunc_t_save_user_numforms,
this);
12023 HEXDSP(hx_cfunc_t_save_user_iflags,
this);
12029 HEXDSP(hx_cfunc_t_save_user_unions,
this);
12035 return (uchar)(size_t)HEXDSP(hx_cfunc_t_get_line_item,
this, line, x, is_ctree_line, phead, pitem, ptail) != 0;
12041 return *(hexwarns_t *)HEXDSP(hx_cfunc_t_get_warnings,
this);
12047 return *(eamap_t *)HEXDSP(hx_cfunc_t_get_eamap,
this);
12053 return *(boundaries_t *)HEXDSP(hx_cfunc_t_get_boundaries,
this);
12059 return *(
const strvec_t *)HEXDSP(hx_cfunc_t_get_pseudocode,
this);
12065 HEXDSP(hx_cfunc_t_refresh_func_ctext,
this);
12069inline bool cfunc_t::gather_derefs(
const ctree_item_t &ci, udt_type_data_t *udm)
const
12071 return (uchar)(size_t)HEXDSP(hx_cfunc_t_gather_derefs,
this, &ci, udm) != 0;
12075inline bool cfunc_t::find_item_coords(
const citem_t *item,
int *px,
int *py)
12077 return (uchar)(size_t)HEXDSP(hx_cfunc_t_find_item_coords,
this, item, px, py) != 0;
12081inline void cfunc_t::cleanup(
void)
12083 HEXDSP(hx_cfunc_t_cleanup,
this);
12089 HEXDSP(hx_close_hexrays_waitbox);
12095 return cfuncptr_t((
cfunc_t *)HEXDSP(hx_decompile, &mbr, hf, decomp_flags));
12101 return (
mba_t *)HEXDSP(hx_gen_microcode, &mbr, hf, retlist, decomp_flags, reqmat);
12107 return cfuncptr_t((
cfunc_t *)HEXDSP(hx_create_cfunc, mba));
12113 return (uchar)(size_t)HEXDSP(hx_mark_cfunc_dirty, ea, close_views) != 0;
12119 HEXDSP(hx_clear_cached_cfuncs);
12125 return (uchar)(size_t)HEXDSP(hx_has_cached_cfunc, ea) != 0;
12129inline const char *get_ctype_name(
ctype_t op)
12131 return (
const char *)HEXDSP(hx_get_ctype_name, op);
12135inline qstring create_field_name(
const tinfo_t &type, uval_t offset)
12138 HEXDSP(hx_create_field_name, &retval, &type, offset);
12145 return (uchar)(size_t)HEXDSP(hx_install_hexrays_callback, callback, ud) != 0;
12151 auto hrdsp = HEXDSP;
12152 return hrdsp ==
nullptr ? 0 : (int)(
size_t)hrdsp(hx_remove_hexrays_callback, callback, ud);
12156inline bool vdui_t::set_locked(
bool v)
12158 return (uchar)(size_t)HEXDSP(hx_vdui_t_set_locked,
this, v) != 0;
12164 HEXDSP(hx_vdui_t_refresh_view,
this, redo_mba);
12170 HEXDSP(hx_vdui_t_refresh_ctext,
this, activate);
12176 HEXDSP(hx_vdui_t_switch_to,
this, &f, activate);
12182 return (
cnumber_t *)HEXDSP(hx_vdui_t_get_number,
this);
12188 return (
int)(size_t)HEXDSP(hx_vdui_t_get_current_label,
this);
12194 HEXDSP(hx_vdui_t_clear,
this);
12200 return (uchar)(size_t)HEXDSP(hx_vdui_t_refresh_cpos,
this, idv) != 0;
12206 return (uchar)(size_t)HEXDSP(hx_vdui_t_get_current_item,
this, idv) != 0;
12212 return (uchar)(size_t)HEXDSP(hx_vdui_t_ui_rename_lvar,
this, v) != 0;
12218 return (uchar)(size_t)HEXDSP(hx_vdui_t_rename_lvar,
this, v, name, is_user_name) != 0;
12224 return (uchar)(size_t)HEXDSP(hx_vdui_t_ui_set_call_type,
this, e) != 0;
12230 return (uchar)(size_t)HEXDSP(hx_vdui_t_ui_set_lvar_type,
this, v) != 0;
12236 return (uchar)(size_t)HEXDSP(hx_vdui_t_set_lvar_type,
this, v, &type) != 0;
12242 return (uchar)(size_t)HEXDSP(hx_vdui_t_set_noptr_lvar,
this, v) != 0;
12248 return (uchar)(size_t)HEXDSP(hx_vdui_t_ui_edit_lvar_cmt,
this, v) != 0;
12254 return (uchar)(size_t)HEXDSP(hx_vdui_t_set_lvar_cmt,
this, v, cmt) != 0;
12260 return (uchar)(size_t)HEXDSP(hx_vdui_t_ui_map_lvar,
this, v) != 0;
12266 return (uchar)(size_t)HEXDSP(hx_vdui_t_ui_unmap_lvar,
this, v) != 0;
12272 return (uchar)(size_t)HEXDSP(hx_vdui_t_map_lvar,
this, from, to) != 0;
12278 return (uchar)(size_t)HEXDSP(hx_vdui_t_set_strmem_type,
this, sptr, mptr) != 0;
12284 return (uchar)(size_t)HEXDSP(hx_vdui_t_rename_strmem,
this, sptr, mptr) != 0;
12290 return (uchar)(size_t)HEXDSP(hx_vdui_t_set_global_type,
this, ea) != 0;
12296 return (uchar)(size_t)HEXDSP(hx_vdui_t_rename_global,
this, ea) != 0;
12302 return (uchar)(size_t)HEXDSP(hx_vdui_t_rename_label,
this, label) != 0;
12308 return (uchar)(size_t)HEXDSP(hx_vdui_t_jump_enter,
this, idv, omflags) != 0;
12314 return (uchar)(size_t)HEXDSP(hx_vdui_t_ctree_to_disasm,
this) != 0;
12320 return (
cmt_type_t)(size_t)HEXDSP(hx_vdui_t_calc_cmt_type,
this, lnnum, cmttype);
12326 return (uchar)(size_t)HEXDSP(hx_vdui_t_edit_cmt,
this, &loc) != 0;
12332 return (uchar)(size_t)HEXDSP(hx_vdui_t_edit_func_cmt,
this) != 0;
12338 return (uchar)(size_t)HEXDSP(hx_vdui_t_del_orphan_cmts,
this) != 0;
12344 return (uchar)(size_t)HEXDSP(hx_vdui_t_set_num_radix,
this, base) != 0;
12350 return (uchar)(size_t)HEXDSP(hx_vdui_t_set_num_enum,
this) != 0;
12356 return (uchar)(size_t)HEXDSP(hx_vdui_t_set_num_stroff,
this) != 0;
12362 return (uchar)(size_t)HEXDSP(hx_vdui_t_invert_sign,
this) != 0;
12368 return (uchar)(size_t)HEXDSP(hx_vdui_t_invert_bits,
this) != 0;
12374 return (uchar)(size_t)HEXDSP(hx_vdui_t_collapse_item,
this, hide) != 0;
12380 return (uchar)(size_t)HEXDSP(hx_vdui_t_collapse_lvars,
this, hide) != 0;
12386 return (uchar)(size_t)HEXDSP(hx_vdui_t_split_item,
this, split) != 0;
12392 return (
int)(size_t)HEXDSP(hx_select_udt_by_offset, udts, &ops, &applicator);
12396#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(void)
Unlock the chains.
void acquire(void)
Lock the chains.
int for_all_chains(chain_visitor_t &cv, int gca_flags)
Visit all chains.
bool is_locked(void) const
Are the chains locked? It is a good idea to lock the chains before using them.
Definition of a local variable (register or stack) #var #lvar.
bool has_nice_name(void) const
Does the variable have a nice name?
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_notarg(void) const
Is a local variable? (local variable cannot be an input argument)
bool typed(void) const
Has the variable a type?
bool is_spoiled_var(void) const
Is spoiled var? (meaningful only during lvar allocation)
bool is_overlapped_var(void) const
Is overlapped variable?
bool is_mapdst_var(void) const
Other variable(s) map to this var?
bool has_common_bit(const vdloc_t &loc, asize_t width2) const
Does the variable overlap with the specified location?
bool used(void) const
Is the variable used in the code?
bool is_partialy_typed(void) const
Variable type should be handled as a partial one.
bool mreg_done(void) const
Have corresponding microregs been replaced by references to this variable?
bool has_common(const lvar_t &v) const
Do variables overlap?
bool is_arg_var(void) const
Is the function argument?
qstring name
variable name.
bool set_width(int w, int svw_flags=0)
Change the variable width.
bool has_regname(void) const
Has a register name? (like _RAX)
bool is_used_byref(void) const
Was the address of the variable taken?
bool has_user_type(void) const
Has user-defined type?
bool is_dummy_arg(void) const
Is a dummy argument (added to fill a hole in the argument list)
const tinfo_t & type(void) const
Get variable type.
bool accepts_type(const tinfo_t &t, bool may_change_thisarg=false)
Check if the variable accept the specified type.
bool is_noptr_var(void) const
Variable type should not be a pointer.
bool is_fake_var(void) const
Is fake return variable?
bool has_user_name(void) const
Has user-defined name?
bool is_automapped(void) const
Was the variable automatically mapped to another variable?
bool is_decl_unused(void) const
Was declared as __unused by the user? See CVAR_UNUSED.
bool is_promoted_arg(void) const
Is the promoted function argument?
bool is_floating_var(void) const
Used by a fpu insn?
bool is_shared(void) const
Is lvar mapped to several chains.
bool is_thisarg(void) const
Is 'this' argument of a C++ member function?
bool is_result_var(void) const
Is the function result?
bool is_unknown_width(void) const
Do we know the width of the variable?
bool is_forced_var(void) const
Is a forced variable?
bool has_user_info(void) const
Has any user-defined information?
int width
variable size in bytes
bool in_asm(void) const
Is variable used in an instruction translated into __asm?
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.
mreg_t alloc_kreg(size_t size, bool check_size=true)
Allocate a kernel register.
int pfn_flags
copy of func_t::flags
mblock_t ** natural
natural order of blocks
mblock_t * blocks
double linked list of blocks
sval_t minstkref
The lowest stack location whose address was taken.
ivlset_t aliased_memory
aliased_memory+restricted_memory=ALLMEM
ea_t map_fict_ea(ea_t fict_ea) const
Resolve a fictional address.
mbl_graph_t * get_graph(void)
Get control graph.
ea_t alloc_fict_ea(ea_t real_ea)
Allocate a fictional address.
ivl_t aliased_vars
Aliased stkvar locations.
sval_t stacksize
The maximal size of the function stack including bytes allocated for outgoing call arguments (up to r...
ivl_t aliased_args
Aliased stkarg locations.
mlist_t spoiled_list
MBA_SPLINFO && !final_type: info in vd format.
sval_t frregs
size of saved registers range in the stack frame
int for_all_topinsns(minsn_visitor_t &mv)
Visit all top level instructions.
sval_t minargref
The lowest stack argument location whose address was taken This location and locations above it can b...
lvars_t vars
local variables
reginfovec_t idb_spoiled
MBA_SPLINFO && final_type: info in ida format.
sval_t frsize
size of local stkvars range in the stack frame
ivl_with_name_t std_ivls[6]
we treat memory as consisting of 6 parts see memreg_index_t
int retvaridx
index of variable holding the return value -1 means none
int fti_flags
FTI_... constants for the current function.
sval_t fullsize
Full stack size including incoming args.
void alloc_lvars(void)
Allocate local variables.
mba_maturity_t maturity
current maturity level
int optimize_local(int locopt_bits)
Optimize each basic block locally.
void free_kreg(mreg_t reg, size_t size)
Free a kernel register.
mba_maturity_t reqmat
required maturity level
sval_t fpd
frame pointer delta
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.
merror_t optimize_global(void)
Optimize microcode globally.
const ivl_t & get_std_region(memreg_index_t idx) const
Get information about various memory regions.
sval_t tmpstk_size
size of the temporary stack part (which dynamically changes with push/pops)
bool remove_block(mblock_t *blk)
Delete a block.
tinfo_t idb_type
function type as retrieved from the database
bool final_type
is the function type final? (specified by the user)
sval_t spd_adjust
If sp>0, the max positive sp value.
ea_t error_ea
during microcode generation holds ins.ea
int qty
number of basic blocks
int shadow_args
size of shadow argument area
bool combine_blocks(void)
Combine blocks.
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.
void dump(void) const
Dump microcode to a file.
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.
int retsize
size of return address in the stack frame
netnode deprecated_idb_node
netnode with additional decompiler info.
int analyze_calls(int acflags)
Analyze calls and determine calling conventions.
void mark_chains_dirty(void)
Mark the microcode use-def chains dirty.
cm_t cc
calling convention
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.
merror_t build_graph(void)
Build control flow graph.
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
sval_t inargoff
offset of the first stack argument; after fix_scattered_movs() INARGOFF may be less than STACKSIZE
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.
ea_t minstkref_ea
address with lowest minstkref (for debugging)
bool remove_empty_and_unreachable_blocks(void)
Delete all empty and unreachable blocks.
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
int optimize_useless_jump(void)
Remove a jump at the end of the block if it is useless.
int optimize_block(void)
Optimize a basic 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.
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.
size_t get_reginsn_qty(void) const
Calculate number of regular instructions in the block.
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
mlist_t dead_at_start
data that is dead at the block entry
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(void) 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 npred(void) const
Get number of block predecessors.
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.
void dump(void) const
Dump block info.
int for_all_uses(mlist_t *list, minsn_t *i1, minsn_t *i2, mlist_mop_visitor_t &mmv)
Visit all operands that use LIST.
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
int flags
combination of Call properties... bits
int call_spd
sp value at call insn
mlist_t return_regs
list of values returned by the function
cm_t cc
calling convention
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
int stkargs_top
first offset past stack arguments
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 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?
bool may_use_aliased_memory(void) const
Is it possible for the instruction to use aliased memory?
funcrole_t get_role(void) 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 _make_nop(void)
Convert instruction to nop.
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(void) const
Does the instruction modify its 'd' operand? Some instructions (e.g.
const char * dstr(void) const
Get displayable text without tags in a static buffer.
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.
mop_t d
destination operand
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.
bool is_unknown_call(void) const
Is an unknown call? Unknown calls are calls without the argument list (mcallinfo_t).
const minsn_t * find_opcode(mcode_t mcode) const
Find a (sub)insruction with the specified opcode.
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...
mcode_t opcode
instruction opcode
int iprops
combination of instruction property bits bits
Address of an operand (mop_l, mop_v, mop_S, mop_r)
A microinstruction operand.
bool is01(void) const
Are the possible values of the operand only 0 and 1? This function returns true for 0/1 constants,...
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.
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?
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.
bool is_cc(void) const
Is a condition code?
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.
bool is_insn(void) const
Is a sub-instruction?
uint16 valnum
Value number.
bool may_use_aliased_memory(void) const
Is it possible for the operand to use aliased memory?
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.
bool is_arglist(void) const
Is a list of arguments?
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 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.
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_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?
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.
bool is_scattered(void) const
Is a scattered operand?
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.
bool is_kreg(void) const
Is a kernel register?
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 is_reg(void) const
Is a register operand? See also get_mreg_name()
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
virtual merror_t apply(codegen_t &cdg) override
generate microcode for an instruction
void cleanup(void)
Cleanup the filter This function properly clears type information associated to this filter.
Iterator class for user_cmts_t.
Iterator class for user_labels_t.
User defined label names.
tinfo_t dummy_ptrtype(int ptrsize, bool isfp)
Generate a dummy pointer type.
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.
#define CVAR_FLOAT
used in a fpu insn
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
#define CVAR_THISARG
'this' argument of c++ member functions
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.
#define CHF_REPLACED
chain operands have been replaced?
#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
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
#define CVAR_NAME
has nice name?
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.
bool get_type(uval_t id, tinfo_t *tif, type_source_t guess)
Get a global type.
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 get_member_type(const member_t *mptr, tinfo_t *type)
Get type of a structure field.
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.
@ 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 CHF_OVER
overlapped chain
#define CVAR_SHARED
variable is mapped to several chains
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 CHF_FAKE
fake chain created by widen_chains()
#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.
const char * get_hexrays_version(void)
Get decompiler version.
#define EXFL_CPADONE
pointer arithmetic correction done
#define CVAR_INASM
variable is used in instructions translated into __asm {...}
bool set_type(uval_t id, const tinfo_t &tif, type_source_t source, bool force=false)
Set a global type.
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 ULV_PRECISE_DEFEA
Use precise defea's for lvar locations.
#define IPROP_SPLIT4
into 4 bytes
cinsn_t * new_block(void)
Create a new block-statement.
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.
#define CV_RESTART
restart enumeration at the top expr (apply_to_exprs)
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.
#define CV_PRUNE
this bit is set by visit...() to prune the walk
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.
#define LVINF_UNUSED
unused argument, corresponds to CVAR_UNUSED
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.
bool is_type_correct(const type_t *ptr)
Verify a type string.
cexpr_t * lnot(cexpr_t *e)
Logically negate the specified expression.
#define NF_VALID
internal bit: stroff or enum is valid for enums: this bit is set immediately for stroffs: this bit is...
#define ANCHOR_CITEM
c-tree item
int partial_type_num(const tinfo_t &type)
Calculate number of partial subtypes.
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?
#define CVAR_UTYPE
user-defined type
qvector< citem_t * > ctree_items_t
Vector of parents.
bool is_small_udt(const tinfo_t &tif)
Is a small structure or union?
ea_t const & user_unions_first(user_unions_iterator_t p)
Get reference to the current map key.
THREAD_SAFE bool is_inplace_def(const tinfo_t &type)
Is struct/union/enum definition (not declaration)?
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.
#define CHF_INITED
is chain initialized? (valid only after lvar allocation)
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.
const mlist_t & get_temp_regs(void)
Get list of temporary registers.
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
#define CVAR_FORCED
variable was created by an explicit request otherwise we could reuse an existing var
#define IPROP_WILDMATCH
match multiple insns
cfuncptr_t decompile_func(func_t *pfn, hexrays_failure_t *hf, int decomp_flags=0)
Decompile a function.
void block_chains_free(block_chains_t *set)
Delete block_chains_t instance.
#define CVAR_UNUSED
user-defined __unused attribute meaningful only if: is_arg_var() && !mba->final_type
#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.
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)
#define VDUI_VISIBLE
is visible?
#define LVINF_KEEP
preserve saved user settings regardless of vars for example, if a var loses all its user-defined attr...
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.
#define CVAR_MAPDST
other variables are mapped to this var
const mopt_t mop_sc
scattered
#define NF_NEGATE
The user asked to negate the constant.
#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.
input_device_t
Type of the input device.
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?
type_source_t
Type source (where the type information comes from)
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
#define CVAR_USED
is used in the code?
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)
#define EXFL_CSTR
string literal
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.
void clear_cached_cfuncs(void)
Flush all cached decompilation results.
const mopt_t mop_fn
floating point constant
bool is_bool_type(const tinfo_t &type)
Is a boolean type?
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
#define EXFL_FPOP
floating point operation
bool is_nonbool_type(const tinfo_t &type)
Is definitely a non-boolean type?
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.
#define SHINS_VALNUM
display value numbers
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
#define EXFL_LVALUE
expression is lvalue even if it doesn't look like it
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.
tinfo_t get_int_type_by_width_and_sign(int srcwidth, type_sign_t sign)
Create a type info by width and sign.
eamap_iterator_t eamap_end(const eamap_t *map)
Get iterator pointing to the end of eamap_t.
#define CVAR_OVER
overlapping variable
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 LVINF_FORCE
force allocation of a new variable.
#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 else: value of a condition code register (like mr_cc)
#define NF_NEGDONE
temporary internal bit: negation has been performed
#define IPROP_SPLIT
the instruction has been split:
#define CHF_PASSTHRU
pass-thru chain, must use the input variable to the block
ctype_t negated_relation(ctype_t op)
Negate a comparison operator. For example, cot_sge becomes cot_slt.
#define EXFL_UNDEF
expression uses undefined value
#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
#define CVAR_FAKE
fake variable (return var or va_list)
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 LVINF_NOMAP
forbid automatic mapping of the variable
#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.
THREAD_SAFE bool is_ptr_or_array(type_t t)
Is a pointer or array type?
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.
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.
#define EXFL_VFTABLE
is ptr to vftable (used for cot_memptr, cot_memref)
#define CV_PARENTS
maintain parent information
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.
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.
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.
void user_unions_free(user_unions_t *map)
Delete user_unions_t instance.
#define NF_BINVDONE
temporary internal bit: inverting bits is done
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
tinfo_t create_typedef(const char *name)
Create a reference to a named type.
#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_snippet(const rangevec_t &ranges, hexrays_failure_t *hf, int decomp_flags=0)
Decompile a snippet.
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.
#define CVAR_RESULT
function result variable
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.
#define CV_POST
call the leave...() functions
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
#define CVAR_ARG
function argument
#define CVAR_TYPE
the type is defined?
#define SHINS_NUMADDR
display definition addresses for numbers
#define CVAR_AUTOMAP
variable was automatically mapped
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 EXFL_PARTIAL
type of the expression is considered partial
#define EXFL_JUMPOUT
jump out-of-function
#define IPROP_SPLIT2
into 2 bytes
bool op_uses_x(ctype_t op)
Does operator use the 'x' field of cexpr_t?
const char * dstr(const tinfo_t *tif)
Print the specified type info.
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 NF_BITNOT
The user asked to invert bits of the constant.
#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.
tinfo_t get_unk_type(int size)
Create a partial type info by width.
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.
#define SHINS_SHORT
do not display use-def chains and other attrs
#define VDUI_VALID
is valid?
qvector< cinsn_t * > cinsnptrvec_t
Vector of pointers to statements.
#define CVAR_PARTIAL
variable type is partialy defined
#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)
#define CVAR_MREG
corresponding mregs were replaced?
cfuncptr_t decompile(const mba_ranges_t &mbr, hexrays_failure_t *hf, int decomp_flags=0)
Decompile a snippet or a function.
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.
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.
#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.
#define CVAR_NOWD
width is unknown
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 close_hexrays_waitbox(void)
Close the waitbox displayed by the decompiler.
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 CVAR_SPOILED
internal flag, do not use: spoiled var
#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?
#define CVAR_DUMMY
dummy argument (added to fill a hole in the argument list)
#define CVAR_NOTARG
variable cannot be an input argument
user_labels_iterator_t user_labels_prev(user_labels_iterator_t p)
Move to the previous element.
mba_t * gen_microcode(const mba_ranges_t &mbr, hexrays_failure_t *hf, const mlist_t *retlist=nullptr, int decomp_flags=0, mba_maturity_t reqmat=MMAT_GLBOPT3)
Generate microcode of an arbitrary code snippet.
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.
#define CVAR_NOPTR
variable cannot be a pointer (user choice)
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
@ 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 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.
#define MLI_NAME
apply lvar name
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 CVAR_UNAME
user-defined name
#define MBA_VALNUM
display value numbers
#define LVINF_NOPTR
variable type should not be a pointer
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
bool is_binary(ctype_t op)
Is binary operator?
#define GCO_DEF
is destination operand?
#define CHF_TERM
terminating chain; the variable does not survive across the block
#define OPROP_UDT
a struct or union
ivlset_tpl< ivl_t, uval_t > uval_ivl_ivlset_t
Set of address intervals.
tinfo_t get_float_type(int width)
Get a type of a floating point value with the specified width.
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.
#define CV_INSNS
visit only statements, prune all expressions do not use before the final ctree maturity because expre...
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)
bool is_vararg
is a vararg (matches ...)
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(void) const
Get expression sign.
int ptrsize
memory access size (used for cot_ptr, cot_memptr)
uint32 exflags
Expression attributes
bool contains_comma(int times=1) const
Does the expression contain a comma operator?
bool contains_insn_or_label(void) const
Does the expression contain an embedded statement operator or a label?
bool like_boolean(void) const
Does the expression look like a boolean expression? In other words, its possible values are only 0 an...
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_zero_const(void) const
Check if the expression is a zero.
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.
bool cpadone(void) const
Pointer arithmetic correction done for this expression?
void print1(qstring *vout, const cfunc_t *func) const
Print expression into one line.
bool is_type_signed(void) const
Is expression signed?
const cexpr_t * find_op(ctype_t _op) const
Find the child with the specified operator.
bool is_nice_cond(void) const
Is nice condition?.
char * string
utf8 string constant, user representation (used for cot_str)
cinsn_t * insn
an embedded statement, they are prohibited at the final maturity stage (CMAT_FINAL)
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 is_nice_expr(void) const
Is nice expression? Nice expressions do not contain comma operators, embedded statements,...
bit_bound_t get_high_nbit_bound(void) const
Get max number of bits that can really be used by the expression.
bool is_type_unsigned(void) const
Is expression unsigned?
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?
const cexpr_t * find_num_op(void) const
Find the operand with a numeric value.
char * helper
helper name (used for cot_helper)
var_ref_t v
used for cot_var
cexpr_t * get_ptr_or_array(void)
Find pointer or array child.
void put_number(cfunc_t *func, uint64 value, int nbytes, type_sign_t sign=no_sign)
Assign a number to the expression.
bool maybe_ptr(void) const
May the expression be a pointer?
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 is_non_negative_const(void) const
Check if the expression is a non-negative number.
uint64 numval(void) const
Get numeric value of the expression.
bool contains_operator(ctype_t needed_op, int times=1) const
Check if the expression contains the specified operator.
const cexpr_t * find_ptr_or_array(bool remove_eqsize_casts) const
Find the pointer operand.
uint32 m
member offset (used for cot_memptr, cot_memref) for unions, the member number
bool is_negative_const(void) const
Check if the expression is a negative number.
bool has_side_effects(void) const
Check if the expression has side effects.
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.
bool is_non_zero_const(void) const
Check if the expression is a non-zero number.
int refwidth
how many bytes are accessed? (-1: none)
void cleanup(void)
Cleanup the expression.
bool get_const_value(uint64 *out) const
Get expression value.
bool is_aliasable(void) const
Check if the expression if aliasable.
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.
const char * get_user_cmt(const treeloc_t &loc, cmt_retrieval_type_t rt) const
Retrieve a user defined comment.
strvec_t sv
decompilation output: function text. use get_pseudocode
void print_func(vc_printer_t &vp) const
Print function text.
void build_c_tree(void)
Generate the function body.
boundaries_t & get_boundaries(void)
Get pointer to map of instruction boundaries.
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
bool has_orphan_cmts(void) const
Check if there are orphan comments.
void set_user_iflags(const citem_locator_t &loc, int32 iflags)
Set citem iflags.
void save_user_labels(void) const
Save user-defined labels into the database.
int hdrlines
number of lines in the declaration area
void save_user_cmts(void) const
Save user-defined comments into the database.
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_numforms(void) const
Save user-defined number formats into the database.
intvec_t & argidx
list of arguments (indexes into vars)
eamap_t & get_eamap(void)
Get pointer to ea->insn map.
boundaries_t * boundaries
map of instruction boundaries. use get_boundaries
int statebits
current cfunc_t state.
int del_orphan_cmts(void)
Delete all orphan comments.
const strvec_t & get_pseudocode(void)
Get pointer to decompilation output: the pseudocode.
citem_t * find_label(int label)
Find the label.
user_labels_t * user_labels
user-defined labels.
bool get_user_union_selection(ea_t ea, intvec_t *path)
Retrieve a user defined union field selection.
sval_t get_stkoff_delta(void)
Get stack offset delta.
void save_user_iflags(void) const
Save user-defined iflags into the database.
ctree_items_t treeitems
vector of ctree items
hexwarns_t & get_warnings(void)
Get information about decompilation warnings.
mba_t * mba
underlying microcode
void set_user_cmt(const treeloc_t &loc, const char *cmt)
Set a user defined comment.
lvars_t * get_lvars(void)
Get vector of local variables.
ea_t entry_ea
function entry address
cinsn_t body
function body, must be a block
void verify(allow_unused_labels_t aul, bool even_without_debugger) const
Verify the ctree.
void refresh_func_ctext(void)
Refresh ctext after a ctree modification.
bool get_func_type(tinfo_t *type) const
Get the function type.
void remove_unused_labels(void)
Remove unused labels.
int32 get_user_iflags(const citem_locator_t &loc) const
Retrieve citem iflags.
void save_user_unions(void) const
Save user-defined union field selections into the database.
int label_num
Target label number.
block_chains_t * parent
parent of the current chain
cinsn_t * ielse
Else-branch of the if-statement. May be nullptr.
cinsn_t * ithen
Then-branch of the if-statement.
cdo_t * cdo
details of do-statement
bool contains_free_continue(void) const
Check if the statement has free continue statements.
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.
bool contains_free_break(void) const
Check if the statement has free break statements.
void replace_by(cinsn_t *r)
Replace the statement.
void cleanup(void)
Cleanup the statement.
bool collect_free_breaks(cinsnptrvec_t *breaks)
Collect free break statements.
bool contains_insn(ctype_t type, int times=1) const
Check if the statement contains a statement of the specified type.
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
bool is_ordinary_flow(void) const
Check if the statement passes execution to the next statement.
void zero(void)
Overwrite with zeroes without cleaning memory or deleting children.
bool used
the comment has been retrieved?
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(void) const
Is an expression?
void print1(qstring *vout, const cfunc_t *func) const
Print item into one line.
int label_num
label number.
bool contains_label(void) const
Does the item contain a label?
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.
lvar_t * l
VDI_LVAR: Local variable.
cinsn_t * i
VDI_EXPR: Statement.
int get_label_num(int gln_flags) const
Get label number of the current item.
bool is_citem(void) const
Is the current item is a ctree item?
cursor_item_type_t citype
Item type.
cfunc_t * f
VDI_FUNC: Function.
treeloc_t loc
VDI_TAIL: Line tail.
cexpr_t * e
VDI_EXPR: Expression.
lvar_t * get_lvar(void) const
Get pointer to local variable.
ea_t get_ea(void) const
Get address of the current 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(void)
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.
virtual int visit_insn(cinsn_t *)
Visit a statement.
parents_t parents
Vector of parents of the current item.
ctree_visitor_t(int _flags)
Constructor.
cexpr_t * parent_expr(void)
Get parent of the current item as an expression.
void clr_prune(void)
Do not prune children. This is an internal function, no need to call it.
int apply_to(citem_t *item, citem_t *parent)
Traverse ctree.
void prune_now(void)
Prune children.
bool is_postorder(void) const
Should the leave...() functions be called?
bool only_insns(void) const
Should all expressions be automatically pruned?
bool must_restart(void) const
Should the traversal restart?
void set_restart(void)
Restart the travesal. Meaningful only in apply_to_exprs()
cinsn_t * parent_insn(void)
Get parent of the current item as a statement.
bool must_prune(void) const
Should the traversal skip the children of the current item?
bool maintain_parents(void) const
Should the parent information by maintained?
int cv_flags
Ctree visitor property bits
virtual int leave_insn(cinsn_t *)
Visit a statement after having visited its children.
void clr_restart(void)
Do not restart. This is an internal function, no need to call it.
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_reg1(void) const
Is variable located on one register?
bool is_scattered(void) const
Is variable scattered?
mreg_t get_reg1(void) const
Get the register number of the variable.
bool is_reg2(void) const
Is variable located on two registers?
ea_t defea
Definition address.
mreg_t get_reg2(void) const
Get the number of the second register (works only for ALOC_REG2 lvars)
bool is_reg_var(void) const
Is variable located on register(s)?
vdloc_t location
Variable location.
sval_t get_stkoff(void) const
Get offset of the varialbe in the stack frame.
const scattered_aloc_t & get_scattered(void) const
Get information about scattered variable.
bool is_stk_var(void) const
Is variable located on the stack?
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.
sval_t off
offset from the beginning of the variable
lvar_t & var(void) const
Retrieve the referenced variable.
Saved user settings for local variables: name, type, comment.
ssize_t size
Type size (if not initialized then -1)
int flags
saved user lvar info property bits
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.
char lastchar
internal: last printed character
virtual bool oneliner(void) const newapi
Are we generating one-line text representation?
const cfunc_t * func
cfunc_t to generate text for
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 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 invert_bits(void)
Bitwise negate a number.
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 rename_strmem(struc_t *sptr, member_t *mptr)
Rename structure field.
bool ui_map_lvar(lvar_t *v)
Map a local variable to another.
bool visible(void) const
Is the pseudocode window visible? if not, it might be invisible or destroyed.
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...
bool ui_set_lvar_type(lvar_t *v)
Set local variable type.
bool in_ctree(void) const
Is the current item a statement?
bool ui_rename_lvar(lvar_t *v)
Rename local variable.
ctree_item_t item
Current ctree item.
bool set_num_enum(void)
Convert number to symbolic constant.
ctext_position_t cpos
Current ctext position.
int get_current_label(void)
Get current label.
bool locked(void) const
Does the pseudocode window contain valid code? We lock windows before modifying them,...
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 del_orphan_cmts(void)
Delete all orphan comments.
bool ctree_to_disasm(void)
Jump to disassembly.
bool invert_sign(void)
Negate a number.
void switch_to(cfuncptr_t f, bool activate)
Display the specified pseudocode.
bool set_num_stroff(void)
Convert number to structure field offset.
void clear(void)
Clear the pseudocode window.
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 valid(void) const
Does the pseudocode window contain valid code? It can become invalid if the function type gets change...
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 ui_edit_lvar_cmt(lvar_t *v)
Set local variable comment.
ctree_item_t tail
Tail ctree item on the current line (for indented comments)
bool edit_func_cmt(void)
Edit a function comment.
cnumber_t * get_number(void)
Get current number.
bool ui_unmap_lvar(lvar_t *v)
Unmap a local variable.
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