9 #define VTABLE_BUFF_SIZE 10
11 #define VTABLE_READ_ADDR_FUNC(fname, read_fname, sz) \
12 static bool fname(RzAnalysis *analysis, ut64 addr, ut64 *buf) { \
14 if (!analysis->iob.read_at(analysis->iob.io, addr, tmp, sz)) { \
17 *buf = read_fname(tmp); \
38 return (
ut64)vtable->methods.len *
context->word_size;
51 context->read_addr = analysis->
big_endian ? vtable_read_addr_be8 : vtable_read_addr_le8;
54 context->read_addr = analysis->
big_endian ? vtable_read_addr_be16 : vtable_read_addr_le16;
57 context->read_addr = analysis->
big_endian ? vtable_read_addr_be32 : vtable_read_addr_le32;
60 context->read_addr = analysis->
big_endian ? vtable_read_addr_be64 : vtable_read_addr_le64;
78 if (!
context->read_addr(
context->analysis, curAddress, &curAddressValue)) {
84 *
value = curAddressValue;
93 return !strcmp(
section->name,
".rodata") ||
94 !strcmp(
section->name,
".rdata") ||
95 !strcmp(
section->name,
".data.rel.ro") ||
96 !strcmp(
section->name,
".data.rel.ro.local") ||
107 return !strcmp(
section->name,
".data.rel.ro") ||
108 !strcmp(
section->name,
".data.rel.ro.local") ||
114 if (!curAddress || curAddress ==
UT64_MAX) {
140 if (!curAddress || curAddress ==
UT64_MAX) {
148 if (rz_list_empty(xrefs)) {
152 rz_list_foreach (xrefs, xrefIter, xref) {
190 RVTableInfo *vtable =
calloc(1,
sizeof(RVTableInfo));
195 vtable->saddr =
addr;
199 RVTableMethodInfo meth;
201 meth.vtable_offset =
addr - vtable->saddr;
210 if (!rz_list_empty(ll)) {
251 ut64 ss = endAddress - startAddress;
255 while (startAddress <= endAddress) {
269 startAddress +=
size;
274 startAddress +=
context->word_size;
280 if (rz_list_empty(vtables)) {
292 const char *noMethodName =
"No Name found";
293 RVTableMethodInfo *curMethod;
306 rz_list_foreach (vtables, vtableIter, table) {
308 pj_kN(pj,
"offset", table->saddr);
309 pj_ka(pj,
"methods");
314 pj_kN(pj,
"offset", curMethod->addr);
325 rz_list_foreach (vtables, vtableIter, table) {
342 rz_list_foreach (vtables, vtableIter, table) {
343 ut64 vtableStartAddress = table->saddr;
349 vtableStartAddress +=
context.word_size;
static int analop(RzAnalysis *a, RzAnalysisOp *op, ut64 addr, const ut8 *buf, int len, RzAnalysisOpMask mask)
RzList * sections(RzBinFile *bf)
RZ_API void rz_cons_newline(void)
RZ_API void rz_cons_break_pop(void)
RZ_API void rz_cons_break_push(RzConsBreak cb, void *user)
RZ_API int rz_cons_printf(const char *format,...)
RZ_API bool rz_cons_is_breaked(void)
RZ_API void rz_cons_println(const char *str)
RZ_DEPRECATE RZ_API RzAnalysisFunction * rz_analysis_get_fcn_in(RzAnalysis *analysis, ut64 addr, int type)
RZ_API void Ht_() free(HtName_(Ht) *ht)
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
void * calloc(size_t number, size_t size)
RZ_API bool rz_analysis_op_fini(RzAnalysisOp *op)
RZ_API int rz_analysis_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *data, int len, RzAnalysisOpMask mask)
static int is_arm(RzBinPEObj *bin)
@ RZ_ANALYSIS_CPP_ABI_ITANIUM
@ RZ_ANALYSIS_CPP_ABI_MSVC
@ RZ_ANALYSIS_OP_MASK_BASIC
@ RZ_ANALYSIS_OP_TYPE_MOV
@ RZ_ANALYSIS_OP_TYPE_LEA
#define rz_return_val_if_reached(val)
static ut64 rz_read_be64(const void *src)
static ut16 rz_read_le16(const void *src)
static ut32 rz_read_le32(const void *src)
static ut8 rz_read_le8(const void *src)
static ut64 rz_read_le64(const void *src)
static ut8 rz_read_be8(const void *src)
static ut32 rz_read_be32(const void *src)
static ut16 rz_read_be16(const void *src)
void(* RzListFree)(void *ptr)
RZ_API PJ * pj_ka(PJ *j, const char *k)
RZ_API PJ * pj_end(PJ *j)
RZ_API const char * pj_string(PJ *pj)
RZ_API void pj_free(PJ *j)
RZ_API PJ * pj_ks(PJ *j, const char *k, const char *v)
RZ_API PJ * pj_kN(PJ *j, const char *k, st64 n)
RZ_API bool rz_str_startswith(RZ_NONNULL const char *str, RZ_NONNULL const char *needle)
Checks if a string starts with a specifc sequence of characters (case sensitive)
RZ_API bool rz_str_endswith(RZ_NONNULL const char *str, RZ_NONNULL const char *needle)
Checks if a string ends with a specifc sequence of characters (case sensitive)
RzOutputMode
Enum to describe the way data are printed.
RZ_API void * rz_vector_push(RzVector *vec, void *x)
#define rz_vector_foreach(vec, it)
RZ_API void rz_vector_clear(RzVector *vec)
RZ_API void rz_vector_init(RzVector *vec, size_t elem_size, RzVectorFree free, void *free_user)
struct rz_analysis_plugin_t * cur
RzBinGetSections get_sections
RzIOIsValidOff is_valid_offset
static bool vtable_addr_in_text_section(RVTableContext *context, ut64 curAddress)
RZ_API void rz_analysis_list_vtables(RzAnalysis *analysis, RzOutputMode mode)
static bool section_can_contain_rtti(RzBinSection *section)
static bool vtable_is_addr_vtable_start_msvc(RVTableContext *context, ut64 curAddress)
static bool vtable_section_can_contain_vtables(RzBinSection *section)
static bool vtable_is_addr_vtable_start(RVTableContext *context, RzBinSection *section, ut64 curAddress)
RZ_API ut64 rz_analysis_vtable_info_get_size(RVTableContext *context, RVTableInfo *vtable)
RZ_API void rz_analysis_vtable_info_free(RVTableInfo *vtable)
static bool vtable_is_value_in_text_section(RVTableContext *context, ut64 curAddress, ut64 *value)
static bool vtable_is_addr_vtable_start_itanium(RVTableContext *context, RzBinSection *section, ut64 curAddress)
RZ_API RVTableInfo * rz_analysis_vtable_parse_at(RVTableContext *context, ut64 addr)
#define VTABLE_READ_ADDR_FUNC(fname, read_fname, sz)
RZ_API RzList * rz_analysis_vtable_search(RVTableContext *context)
RZ_API bool rz_analysis_vtable_begin(RzAnalysis *analysis, RVTableContext *context)
if(dbg->bits==RZ_SYS_BITS_64)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
RZ_API RzList * rz_analysis_xrefs_get_to(RzAnalysis *analysis, ut64 addr)