18 if (analysis->
limit) {
99 analysis->
diff_thbb = RZ_ANALYSIS_THRESHOLDBB;
100 analysis->
diff_thfcn = RZ_ANALYSIS_THRESHOLDFCN;
130 RZ_LOG_ERROR(
"analysis plugin '%s' failed to terminate.\n",
p->name);
147 ht_up_free(
a->ht_addr_fun);
148 ht_pp_free(
a->ht_name_fun);
161 ht_up_free(
a->ht_xrefs_from);
162 ht_up_free(
a->ht_xrefs_to);
163 ht_up_free(
a->type_links);
171 free(
a->last_disasm_reg);
174 ht_pp_free(
a->ht_global_var);
192 rz_list_foreach (analysis->
plugins, it,
h) {
193 if (!
h || !
h->name || strcmp(
h->name,
name)) {
199 RZ_LOG_ERROR(
"analysis plugin '%s' failed to initialize.\n",
h->name);
203 if (analysis->
il_vm) {
261 if (!analysis || !analysis->
cpu) {
264 if ((analysis->
bits !=
bits) && !strcmp(analysis->
cpu,
"arm")) {
265 return (analysis->
bits == 16 &&
bits == 32) || (analysis->
bits == 32 &&
bits == 16);
305 return analysis->
bits;
308 return r > 0 ?
r : analysis->
bits;
383 rz_list_foreach (fcni->
bbs, iter2, bbi) {
395 return analysis->
fcns;
463 #define K_NORET_ADDR(x) sdb_fmt("addr.%" PFMT64x ".noreturn", x)
464 #define K_NORET_FUNC(x) sdb_fmt("func.%s.noreturn", x)
467 const char *tmp_name =
NULL;
469 char *fnl_name =
NULL;
488 tmp_name = fcn ? fcn->
name : fi->
name;
494 fnl_name =
strdup(tmp_name);
500 RZ_LOG_ERROR(
"Cannot find prototype for: %s\n", tmp_name);
503 RZ_LOG_ERROR(
"Cannot find prototype for: %s\n", tmp_name);
517 const char *fcnname =
NULL;
518 if (!strncmp(
expr,
"0x", 2)) {
563 ut8 bbuf[0x10] = { 0 };
575 recurse_addr =
op.ptr;
577 recurse_addr =
op.jump;
584 recurse_addr =
op.ptr;
588 recurse_addr =
op.jump;
634 if (!strncmp(
k,
"func.", 5) && strstr(
k,
".noreturn")) {
636 char *
d = strchr(
s,
'.');
643 if (!strncmp(
k,
"addr.", 5)) {
648 char *ptr = strstr(
off,
".noreturn");
663 b->analysis = analysis;
681 rz_list_foreach (l,
iter, kw) {
696 rz_list_foreach (analysis->
imports, it, eimp) {
697 if (!strcmp(eimp, imp)) {
711 rz_list_foreach (analysis->
imports, it, eimp) {
712 if (!strcmp(eimp, imp)) {
RZ_API RZ_OWN char * rz_analysis_function_name_guess(RzTypeDB *typedb, RZ_NONNULL char *name)
Checks if varions function name variations present in the database.
RZ_API RzAnalysisFunction * rz_analysis_get_function_at(RzAnalysis *analysis, ut64 addr)
RZ_API void rz_analysis_function_free(void *_fcn)
static bool rz_analysis_noreturn_at_name(RzAnalysis *analysis, const char *name)
RZ_API bool rz_analysis_noreturn_at_addr(RzAnalysis *analysis, ut64 addr)
RZ_API RzList * rz_analysis_noreturn_functions(RzAnalysis *analysis)
RZ_API void rz_analysis_unset_limits(RzAnalysis *analysis)
static void meta_count_for(RzEvent *ev, int type, void *user, void *data)
RZ_API void rz_analysis_set_cpu(RzAnalysis *analysis, const char *cpu)
RZ_API int rz_analysis_add(RzAnalysis *analysis, RzAnalysisPlugin *p)
static void rz_meta_item_free(void *_item)
RZ_API ut8 * rz_analysis_mask(RzAnalysis *analysis, ut32 size, const ut8 *data, ut64 at)
static bool is_arm_thumb_hack(RzAnalysis *analysis, int bits)
static bool analysis_set_os(RzAnalysis *analysis, const char *os)
RZ_API RzAnalysis * rz_analysis_free(RzAnalysis *a)
RZ_API bool rz_analysis_set_triplet(RzAnalysis *analysis, const char *os, const char *arch, int bits)
RZ_API RzList * rz_analysis_preludes(RzAnalysis *analysis)
RZ_API void rz_analysis_add_import(RzAnalysis *analysis, const char *imp)
void rz_analysis_hint_storage_fini(RzAnalysis *a)
static void global_kv_free(HtPPKv *kv)
RZ_API void rz_analysis_bind(RzAnalysis *analysis, RzAnalysisBind *b)
RZ_API bool rz_analysis_is_prelude(RzAnalysis *analysis, const ut8 *data, int len)
RZ_API void rz_analysis_purge_imports(RzAnalysis *analysis)
static void meta_unset_for(RzEvent *ev, int type, void *user, void *data)
RZ_API bool rz_analysis_set_bits(RzAnalysis *analysis, int bits)
RZ_API RzAnalysis * rz_analysis_new(void)
static bool rz_analysis_is_noreturn(RzAnalysis *analysis, const char *name)
RZ_API void rz_analysis_trace_bb(RzAnalysis *analysis, ut64 addr)
RZ_API void rz_analysis_purge(RzAnalysis *analysis)
RZ_API int rz_analysis_archinfo(RzAnalysis *analysis, int query)
RZ_API int rz_analysis_get_address_bits(RzAnalysis *analysis)
The actual size of an address in bits.
RZ_API RzAnalysisOp * rz_analysis_op_hexstr(RzAnalysis *analysis, ut64 addr, const char *str)
RZ_API bool rz_analysis_noreturn_add(RzAnalysis *analysis, const char *name, ut64 addr)
RZ_API void rz_analysis_set_limits(RzAnalysis *analysis, ut64 from, ut64 to)
RZ_API bool rz_analysis_set_reg_profile(RzAnalysis *analysis)
static void rz_meta_item_fini(RzAnalysisMetaItem *item)
static RzAnalysisPlugin * analysis_static_plugins[]
RZ_API bool rz_analysis_noreturn_drop(RzAnalysis *analysis, const char *expr)
RZ_API RzList * rz_analysis_get_fcns(RzAnalysis *analysis)
RZ_API void rz_analysis_remove_import(RzAnalysis *analysis, const char *imp)
RZ_API int rz_analysis_set_big_endian(RzAnalysis *analysis, int bigend)
RZ_API bool rz_analysis_use(RzAnalysis *analysis, const char *name)
void rz_analysis_hint_storage_init(RzAnalysis *a)
RZ_API bool rz_analysis_op_is_eob(RzAnalysisOp *op)
RZ_API char * rz_analysis_get_reg_profile(RzAnalysis *analysis)
RZ_LIB_VERSION(rz_analysis)
RZ_API bool rz_analysis_noreturn_at(RzAnalysis *analysis, ut64 addr)
void __block_free_rb(RBNode *node, void *user)
RZ_API bool rz_analysis_set_os(RzAnalysis *analysis, const char *os)
static bool noreturn_recurse(RzAnalysis *analysis, ut64 addr)
RZ_API void plugin_fini(RzAnalysis *analysis)
RZ_API void rz_analysis_il_vm_cleanup(RzAnalysis *analysis)
RZ_API bool rz_analysis_il_vm_setup(RzAnalysis *analysis)
int bits(struct state *s, int need)
#define RZ_ANALYSIS_STATIC_PLUGINS
static RzNumCalcValue expr(RzNum *, RzNumCalc *, int)
RZ_API void rz_analysis_esil_free(RzAnalysisEsil *esil)
RZ_DEPRECATE RZ_API RzAnalysisFunction * rz_analysis_get_fcn_in(RzAnalysis *analysis, ut64 addr, int type)
RZ_API void rz_hash_free(RzHash *rh)
RZ_API RzHash * rz_hash_new(void)
RZ_API RzAnalysisHint * rz_analysis_hint_get(RzAnalysis *a, ut64 addr)
RZ_API void rz_analysis_hint_clear(RzAnalysis *a)
RZ_API void Ht_() free(HtName_(Ht) *ht)
return memset(p, 0, total)
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
RZ_API void rz_list_delete(RZ_NONNULL RzList *list, RZ_NONNULL RzListIter *iter)
Removes an entry in the list by using the RzListIter pointer.
RZ_API RZ_BORROW RzListIter * rz_list_push(RZ_NONNULL RzList *list, void *item)
Alias for rz_list_append.
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.
RZ_API void rz_list_purge(RZ_NONNULL RzList *list)
Empties the list without freeing the list pointer.
void * malloc(size_t size)
void * calloc(size_t number, size_t size)
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
RZ_API void ls_free(SdbList *list)
#define ls_foreach(list, it, pos)
RZ_API Sdb * sdb_ns(Sdb *s, const char *name, int create)
RZ_API bool sdb_bool_get(Sdb *db, const char *str, ut32 *cas)
RZ_API int sdb_bool_set(Sdb *db, const char *str, bool v, ut32 cas)
RZ_API void rz_analysis_op_free(void *op)
RZ_API bool rz_analysis_op_fini(RzAnalysisOp *op)
RZ_API RzAnalysisOp * rz_analysis_op_new(void)
RZ_API void rz_analysis_op_init(RzAnalysisOp *op)
RZ_API int rz_analysis_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *data, int len, RzAnalysisOpMask mask)
RZ_API bool rz_reg_set_profile_string(RZ_NONNULL RzReg *reg, RZ_NONNULL const char *profile_str)
Parses a register profile string and sets up all registers accordingly in reg.
RZ_API void rz_reg_free(RzReg *reg)
RZ_API RzReg * rz_reg_new(void)
#define RZ_ANALYSIS_ARCHINFO_ALIGN
#define RZ_ANALYSIS_ESIL_GOTO_LIMIT
@ RZ_ANALYSIS_CPP_ABI_ITANIUM
#define RZ_ANALYSIS_ARCHINFO_MAX_OP_SIZE
@ RZ_ANALYSIS_OP_MASK_BASIC
@ RZ_ANALYSIS_OP_MASK_VAL
#define RZ_ANALYSIS_OP_TYPE_MASK
#define RZ_ANALYSIS_ARCHINFO_MIN_OP_SIZE
@ RZ_ANALYSIS_OP_TYPE_ICALL
@ RZ_ANALYSIS_OP_TYPE_JMP
@ RZ_ANALYSIS_OP_TYPE_UJMP
@ RZ_ANALYSIS_OP_TYPE_IJMP
@ RZ_ANALYSIS_OP_TYPE_TRAP
@ RZ_ANALYSIS_OP_TYPE_CCALL
@ RZ_ANALYSIS_OP_TYPE_CALL
@ RZ_ANALYSIS_OP_TYPE_IRJMP
@ RZ_ANALYSIS_OP_TYPE_RJMP
@ RZ_ANALYSIS_OP_TYPE_CJMP
@ RZ_ANALYSIS_OP_TYPE_UCALL
@ RZ_ANALYSIS_OP_TYPE_RET
@ RZ_ANALYSIS_OP_TYPE_RCALL
@ RZ_ANALYSIS_OP_TYPE_IRCALL
#define rz_return_val_if_fail(expr, val)
RZ_API RzEventCallbackHandle rz_event_hook(RzEvent *ev, int type, RzEventCallback cb, void *user)
#define rz_flag_bind_init(x)
RZ_API int rz_hex_str2bin(const char *in, ut8 *out)
Convert an input string in into the binary form in out.
RZ_API void rz_interval_tree_init(RzIntervalTree *tree, RzIntervalNodeFree free)
RZ_API void rz_interval_tree_fini(RzIntervalTree *tree)
#define rz_io_bind_init(x)
#define RZ_LOG_ERROR(fmtstr,...)
RZ_API ut64 rz_num_math(RzNum *num, const char *str)
RZ_API RZ_OWN char * rz_path_system(RZ_NULLABLE const char *path)
Return the full system path of the given subpath path.
RZ_API void rz_rbtree_free(RZ_NULLABLE RBNode *root, RBNodeFree freefn, void *user)
RZ_API void rz_spaces_fini(RzSpaces *sp)
RZ_API bool rz_spaces_init(RzSpaces *sp, const char *name)
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API const char * rz_str_trim_head_ro(const char *str)
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 void rz_str_constpool_fini(RzStrConstPool *pool)
RZ_API bool rz_str_constpool_init(RzStrConstPool *pool)
#define container_of(ptr, type, member)
RZ_API Sdb * sdb_new0(void)
RZ_API bool sdb_free(Sdb *s)
RZ_API void sdb_reset(Sdb *s)
RZ_API int sdb_unset(Sdb *s, const char *key, ut32 cas)
RZ_API SdbList * sdb_foreach_list(Sdb *s, bool sorted)
static char * sdbkv_key(const SdbKv *kv)
RZ_API void set_u_free(SetU *s)
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr from
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr socklen_t static fromlen const void const struct sockaddr to
RzAnalysisRegProfGetCallback get_reg_profile
int(* address_bits)(RzAnalysis *analysis, int bits)
RzList *(* preludes)(RzAnalysis *analysis)
ut8 *(* analysis_mask)(RzAnalysis *analysis, int size, const ut8 *data, ut64 at)
int(* archinfo)(RzAnalysis *analysis, int query)
RzPlatformTarget * arch_target
struct rz_analysis_plugin_t * cur
RzPlatformTargetIndex * platform_target
RzAnalysisILVM * il_vm
user-faced VM, NEVER use this for any analysis passes!
struct rz_space_event_t::@311::@313 unset
struct rz_space_event_t::@311::@312 count
union rz_space_event_t::@311 data
RZ_API RzSyscall * rz_syscall_new(void)
Creates a new RzSyscall type.
RZ_API void rz_syscall_free(RzSyscall *s)
Frees an RzSyscall type.
RZ_API bool rz_type_func_is_noreturn(RzTypeDB *typedb, RZ_NONNULL const char *name)
Checks if the RzCallable type is defined as "noreturn".
RZ_API bool rz_type_func_exist(RzTypeDB *typedb, RZ_NONNULL const char *name)
Checks if the RzCallable type exists in the database given the name.
RZ_API RZ_OWN RzList * rz_type_noreturn_function_names(RzTypeDB *typedb)
Returns the list of all noreturn function type names.
RZ_API void rz_type_db_set_address_bits(RzTypeDB *typedb, int addr_bits)
Set the RzType target adress size.
RZ_API void rz_type_db_reload(RzTypeDB *typedb, const char *types_dir)
Re-initializes the types database for current target.
RZ_API void rz_type_db_set_os(RzTypeDB *typedb, const char *os)
Set the RzType target architecture operating system.
RZ_API void rz_type_db_set_bits(RzTypeDB *typedb, int bits)
Set the RzType target architecture bits.
RZ_API void rz_type_db_free(RzTypeDB *typedb)
Frees the instance of the RzTypeDB.
RZ_API void rz_type_db_purge(RzTypeDB *typedb)
Purges the instance of the RzTypeDB.
RZ_API void rz_type_db_set_endian(RzTypeDB *typedb, bool big_endian)
Set the RzType target architecture CPU.
RZ_API RzTypeDB * rz_type_db_new()
Creates a new instance of the RzTypeDB.
RZ_API void rz_type_db_set_cpu(RzTypeDB *typedb, const char *cpu)
Set the RzType target architecture CPU.
RZ_API void rz_analysis_var_global_free(RzAnalysisVarGlobal *glob)
Free the global variable instance.
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
RZ_API bool rz_analysis_xrefs_init(RzAnalysis *analysis)