Use analysis_get_function_in() wherever possible (#2157)
This commit is contained in:
parent
4f9fe46b34
commit
cdb4832cc8
1 changed files with 61 additions and 71 deletions
|
|
@ -430,6 +430,37 @@ static const char *help_msg_as[] = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Helper to get function in \p offset
|
||||||
|
*
|
||||||
|
* Case of overlapped functions is treated as an error
|
||||||
|
* if \p offset is not an entry point.
|
||||||
|
*/
|
||||||
|
static RzAnalysisFunction *analysis_get_function_in(RzAnalysis *analysis, ut64 offset) {
|
||||||
|
RzAnalysisFunction *fcn = rz_analysis_get_function_at(analysis, offset);
|
||||||
|
if (fcn) {
|
||||||
|
return fcn;
|
||||||
|
}
|
||||||
|
RzList *list = rz_analysis_get_functions_in(analysis, offset);
|
||||||
|
if (rz_list_empty(list)) {
|
||||||
|
RZ_LOG_ERROR("No function found in 0x%08" PFMT64x ".\n", offset);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
if (rz_list_length(list) > 1) {
|
||||||
|
RZ_LOG_ERROR("Multiple overlapping functions found at 0x%08" PFMT64x ". "
|
||||||
|
"Re-run this command at the entrypoint of one of them to disambiguate.\n",
|
||||||
|
offset);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
fcn = rz_list_first(list);
|
||||||
|
if (!fcn) {
|
||||||
|
rz_warn_if_reached();
|
||||||
|
}
|
||||||
|
exit:
|
||||||
|
rz_list_free(list);
|
||||||
|
return fcn;
|
||||||
|
}
|
||||||
|
|
||||||
static int cmpaddr(const void *_a, const void *_b) {
|
static int cmpaddr(const void *_a, const void *_b) {
|
||||||
const RzAnalysisFunction *a = _a, *b = _b;
|
const RzAnalysisFunction *a = _a, *b = _b;
|
||||||
return (a->addr > b->addr) ? 1 : (a->addr < b->addr) ? -1
|
return (a->addr > b->addr) ? 1 : (a->addr < b->addr) ? -1
|
||||||
|
|
@ -6349,12 +6380,10 @@ RZ_IPI int rz_cmd_analysis(void *data, const char *input) {
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_blocks_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) {
|
RZ_IPI RzCmdStatus rz_analysis_function_blocks_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) {
|
||||||
ut64 addr = argc > 1 ? rz_num_math(core->num, argv[1]) : core->offset;
|
ut64 addr = argc > 1 ? rz_num_math(core->num, argv[1]) : core->offset;
|
||||||
RzList *l = rz_analysis_get_functions_in(core->analysis, addr);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, addr);
|
||||||
if (rz_list_empty(l)) {
|
if (!fcn) {
|
||||||
eprintf("No functions at 0x%" PFMT64x, addr);
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
RzAnalysisFunction *fcn = rz_list_first(l);
|
|
||||||
rz_core_analysis_bbs_info_print(core, fcn, state);
|
rz_core_analysis_bbs_info_print(core, fcn, state);
|
||||||
return RZ_CMD_STATUS_OK;
|
return RZ_CMD_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -6373,9 +6402,8 @@ RZ_IPI RzCmdStatus rz_analysis_function_blocks_del_handler(RzCore *core, int arg
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_blocks_del_all_handler(RzCore *core, int argc, const char **argv) {
|
RZ_IPI RzCmdStatus rz_analysis_function_blocks_del_all_handler(RzCore *core, int argc, const char **argv) {
|
||||||
ut64 addr = argc > 1 ? rz_num_math(core->num, argv[1]) : core->offset;
|
ut64 addr = argc > 1 ? rz_num_math(core->num, argv[1]) : core->offset;
|
||||||
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, addr, -1);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, addr);
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
eprintf("Cannot find function\n");
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
while (!rz_list_empty(fcn->bbs)) {
|
while (!rz_list_empty(fcn->bbs)) {
|
||||||
|
|
@ -6399,24 +6427,20 @@ RZ_IPI RzCmdStatus rz_analysis_function_blocks_edge_handler(RzCore *core, int ar
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_returns_handler(RzCore *core, int argc, const char **argv) {
|
RZ_IPI RzCmdStatus rz_analysis_function_returns_handler(RzCore *core, int argc, const char **argv) {
|
||||||
ut64 addr = argc > 1 ? rz_num_math(core->num, argv[1]) : core->offset;
|
ut64 addr = argc > 1 ? rz_num_math(core->num, argv[1]) : core->offset;
|
||||||
RzList *l = rz_analysis_get_functions_in(core->analysis, addr);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, addr);
|
||||||
if (rz_list_empty(l)) {
|
if (!fcn) {
|
||||||
eprintf("No functions at 0x%" PFMT64x, addr);
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
RzAnalysisFunction *fcn = rz_list_first(l);
|
|
||||||
rz_core_analysis_fcn_returns(core, fcn);
|
rz_core_analysis_fcn_returns(core, fcn);
|
||||||
return RZ_CMD_STATUS_OK;
|
return RZ_CMD_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_blocks_asciiart_handler(RzCore *core, int argc, const char **argv) {
|
RZ_IPI RzCmdStatus rz_analysis_function_blocks_asciiart_handler(RzCore *core, int argc, const char **argv) {
|
||||||
ut64 addr = argc > 1 ? rz_num_math(core->num, argv[1]) : core->offset;
|
ut64 addr = argc > 1 ? rz_num_math(core->num, argv[1]) : core->offset;
|
||||||
RzList *l = rz_analysis_get_functions_in(core->analysis, addr);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, addr);
|
||||||
if (rz_list_empty(l)) {
|
if (!fcn) {
|
||||||
eprintf("No functions at 0x%" PFMT64x, addr);
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
RzAnalysisFunction *fcn = rz_list_first(l);
|
|
||||||
rz_core_analysis_bbs_asciiart(core, fcn);
|
rz_core_analysis_bbs_asciiart(core, fcn);
|
||||||
return RZ_CMD_STATUS_OK;
|
return RZ_CMD_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -6473,9 +6497,9 @@ RZ_IPI RzCmdStatus rz_analysis_function_blocks_color_handler(RzCore *core, int a
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_setbits_handler(RzCore *core, int argc, const char **argv) {
|
RZ_IPI RzCmdStatus rz_analysis_function_setbits_handler(RzCore *core, int argc, const char **argv) {
|
||||||
int bits = atoi(argv[1]);
|
int bits = atoi(argv[1]);
|
||||||
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, 0);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, core->offset);
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
eprintf("No function at 0x%" PFMT64x "\n", core->offset);
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
RzListIter *iter;
|
RzListIter *iter;
|
||||||
RzAnalysisBlock *bb;
|
RzAnalysisBlock *bb;
|
||||||
|
|
@ -6488,9 +6512,8 @@ RZ_IPI RzCmdStatus rz_analysis_function_setbits_handler(RzCore *core, int argc,
|
||||||
}
|
}
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_signature_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode) {
|
RZ_IPI RzCmdStatus rz_analysis_function_signature_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode) {
|
||||||
RzAnalysisFunction *f = rz_analysis_get_fcn_in(core->analysis, core->offset, -1);
|
RzAnalysisFunction *f = analysis_get_function_in(core->analysis, core->offset);
|
||||||
if (!f) {
|
if (!f) {
|
||||||
eprintf("Cannot find function in 0x%08" PFMT64x "\n", core->offset);
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6525,9 +6548,8 @@ RZ_IPI RzCmdStatus rz_analysis_function_signature_editor_handler(RzCore *core, i
|
||||||
}
|
}
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_signature_type_handler(RzCore *core, int argc, const char **argv) {
|
RZ_IPI RzCmdStatus rz_analysis_function_signature_type_handler(RzCore *core, int argc, const char **argv) {
|
||||||
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, -1);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, core->offset);
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
eprintf("Cannot find function in 0x%08" PFMT64x "\n", core->offset);
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
char *error_msg = NULL;
|
char *error_msg = NULL;
|
||||||
|
|
@ -6564,9 +6586,8 @@ static void xref_list_print_to_json(RZ_UNUSED RzCore *core, RzList *list, PJ *pj
|
||||||
}
|
}
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_xrefs_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) {
|
RZ_IPI RzCmdStatus rz_analysis_function_xrefs_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) {
|
||||||
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, -1);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, core->offset);
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
eprintf("Cannot find function in 0x%08" PFMT64x "\n", core->offset);
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6620,9 +6641,8 @@ exit:
|
||||||
}
|
}
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_stacksz_handler(RzCore *core, int argc, const char **argv) {
|
RZ_IPI RzCmdStatus rz_analysis_function_stacksz_handler(RzCore *core, int argc, const char **argv) {
|
||||||
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, -1);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, core->offset);
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
eprintf("Cannot find function in 0x%08" PFMT64x "\n", core->offset);
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6631,9 +6651,8 @@ RZ_IPI RzCmdStatus rz_analysis_function_stacksz_handler(RzCore *core, int argc,
|
||||||
}
|
}
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_address_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode) {
|
RZ_IPI RzCmdStatus rz_analysis_function_address_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode) {
|
||||||
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, -1);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, core->offset);
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
eprintf("Cannot find function in 0x%08" PFMT64x "\n", core->offset);
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6672,9 +6691,8 @@ RZ_IPI RzCmdStatus rz_analysis_function_until_handler(RzCore *core, int argc, co
|
||||||
}
|
}
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_vars_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode) {
|
RZ_IPI RzCmdStatus rz_analysis_function_vars_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode) {
|
||||||
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, -1);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, core->offset);
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
eprintf("Cannot find function in 0x%08" PFMT64x "\n", core->offset);
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6721,9 +6739,8 @@ RZ_IPI RzCmdStatus rz_analysis_function_vars_handler(RzCore *core, int argc, con
|
||||||
}
|
}
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_vars_dis_refs_handler(RzCore *core, int argc, const char **argv) {
|
RZ_IPI RzCmdStatus rz_analysis_function_vars_dis_refs_handler(RzCore *core, int argc, const char **argv) {
|
||||||
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, -1);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, core->offset);
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
eprintf("Cannot find function in 0x%08" PFMT64x "\n", core->offset);
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6757,9 +6774,8 @@ RZ_IPI RzCmdStatus rz_analysis_function_vars_dis_refs_handler(RzCore *core, int
|
||||||
}
|
}
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_vars_del_handler(RzCore *core, int argc, const char **argv) {
|
RZ_IPI RzCmdStatus rz_analysis_function_vars_del_handler(RzCore *core, int argc, const char **argv) {
|
||||||
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, -1);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, core->offset);
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
eprintf("Cannot find function in 0x%08" PFMT64x "\n", core->offset);
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6770,9 +6786,8 @@ RZ_IPI RzCmdStatus rz_analysis_function_vars_del_handler(RzCore *core, int argc,
|
||||||
}
|
}
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_vars_detect_handler(RzCore *core, int argc, const char **argv) {
|
RZ_IPI RzCmdStatus rz_analysis_function_vars_detect_handler(RzCore *core, int argc, const char **argv) {
|
||||||
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, -1);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, core->offset);
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
eprintf("Cannot find function in 0x%08" PFMT64x "\n", core->offset);
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6782,9 +6797,8 @@ RZ_IPI RzCmdStatus rz_analysis_function_vars_detect_handler(RzCore *core, int ar
|
||||||
}
|
}
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_vars_display_handler(RzCore *core, int argc, const char **argv) {
|
RZ_IPI RzCmdStatus rz_analysis_function_vars_display_handler(RzCore *core, int argc, const char **argv) {
|
||||||
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, -1);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, core->offset);
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
eprintf("Cannot find function in 0x%08" PFMT64x "\n", core->offset);
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6824,7 +6838,10 @@ static int delta_cmp2(const void *a, const void *b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_vars_stackframe_handler(RzCore *core, int argc, const char **argv) {
|
RZ_IPI RzCmdStatus rz_analysis_function_vars_stackframe_handler(RzCore *core, int argc, const char **argv) {
|
||||||
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, -1);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, core->offset);
|
||||||
|
if (!fcn) {
|
||||||
|
return RZ_CMD_STATUS_ERROR;
|
||||||
|
}
|
||||||
RzListIter *iter;
|
RzListIter *iter;
|
||||||
RzAnalysisVar *p;
|
RzAnalysisVar *p;
|
||||||
RzList *list = rz_analysis_var_all_list(core->analysis, fcn);
|
RzList *list = rz_analysis_var_all_list(core->analysis, fcn);
|
||||||
|
|
@ -6862,9 +6879,8 @@ RZ_IPI RzCmdStatus rz_analysis_function_vars_rename_handler(RzCore *core, int ar
|
||||||
}
|
}
|
||||||
|
|
||||||
static RzCmdStatus analysis_function_vars_accesses(RzCore *core, int access_type, const char *varname) {
|
static RzCmdStatus analysis_function_vars_accesses(RzCore *core, int access_type, const char *varname) {
|
||||||
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, -1);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, core->offset);
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
eprintf("Cannot find function in 0x%08" PFMT64x "\n", core->offset);
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6896,9 +6912,8 @@ RZ_IPI RzCmdStatus rz_analysis_function_vars_writes_handler(RzCore *core, int ar
|
||||||
}
|
}
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_vars_type_handler(RzCore *core, int argc, const char **argv) {
|
RZ_IPI RzCmdStatus rz_analysis_function_vars_type_handler(RzCore *core, int argc, const char **argv) {
|
||||||
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, -1);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, core->offset);
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
eprintf("Cannot find function in 0x%08" PFMT64x "\n", core->offset);
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6919,9 +6934,8 @@ RZ_IPI RzCmdStatus rz_analysis_function_vars_type_handler(RzCore *core, int argc
|
||||||
}
|
}
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_args_and_vars_xrefs_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode, bool use_args, bool use_vars) {
|
RZ_IPI RzCmdStatus rz_analysis_function_args_and_vars_xrefs_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode, bool use_args, bool use_vars) {
|
||||||
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, -1);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, core->offset);
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
eprintf("Cannot find function in 0x%08" PFMT64x "\n", core->offset);
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
PJ *pj = NULL;
|
PJ *pj = NULL;
|
||||||
|
|
@ -6987,26 +7001,6 @@ static RzCmdStatus analysis_function_vars_kind_list(RzCore *core, RzAnalysisFunc
|
||||||
return RZ_CMD_STATUS_OK;
|
return RZ_CMD_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static RzAnalysisFunction *analysis_get_function_in(RzAnalysis *analysis, ut64 offset) {
|
|
||||||
RzAnalysisFunction *fcn = NULL;
|
|
||||||
RzList *list = rz_analysis_get_functions_in(analysis, offset);
|
|
||||||
if (rz_list_empty(list)) {
|
|
||||||
RZ_LOG_ERROR("No function found\n");
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
if (rz_list_length(list) > 1) {
|
|
||||||
RZ_LOG_ERROR("Multiple functions found\n");
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
fcn = rz_list_first(list);
|
|
||||||
if (!fcn) {
|
|
||||||
RZ_LOG_ERROR("No function found\n");
|
|
||||||
}
|
|
||||||
exit:
|
|
||||||
rz_list_free(list);
|
|
||||||
return fcn;
|
|
||||||
}
|
|
||||||
|
|
||||||
static RzCmdStatus analysis_function_vars_del(RzCore *core, RzAnalysisVarKind kind, const char *varname) {
|
static RzCmdStatus analysis_function_vars_del(RzCore *core, RzAnalysisVarKind kind, const char *varname) {
|
||||||
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, core->offset);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, core->offset);
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
|
|
@ -7026,9 +7020,8 @@ static RzCmdStatus analysis_function_vars_del_all(RzCore *core, RzAnalysisVarKin
|
||||||
}
|
}
|
||||||
|
|
||||||
static RzCmdStatus analysis_function_vars_getsetref(RzCore *core, int delta, ut64 addr, RzAnalysisVarKind kind, RzAnalysisVarAccessType access_type) {
|
static RzCmdStatus analysis_function_vars_getsetref(RzCore *core, int delta, ut64 addr, RzAnalysisVarKind kind, RzAnalysisVarAccessType access_type) {
|
||||||
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, -1);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, core->offset);
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
eprintf("Cannot find function in 0x%08" PFMT64x "\n", core->offset);
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7051,9 +7044,8 @@ static RzCmdStatus analysis_function_vars_getsetref(RzCore *core, int delta, ut6
|
||||||
/// --------- Base pointer based variable handlers -------------
|
/// --------- Base pointer based variable handlers -------------
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_vars_bp_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode) {
|
RZ_IPI RzCmdStatus rz_analysis_function_vars_bp_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode) {
|
||||||
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, -1);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, core->offset);
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
eprintf("Cannot find function in 0x%08" PFMT64x "\n", core->offset);
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7100,9 +7092,8 @@ RZ_IPI RzCmdStatus rz_analysis_function_vars_bp_setref_handler(RzCore *core, int
|
||||||
/// --------- Register-based variable handlers -------------
|
/// --------- Register-based variable handlers -------------
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_vars_regs_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode) {
|
RZ_IPI RzCmdStatus rz_analysis_function_vars_regs_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode) {
|
||||||
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, -1);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, core->offset);
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
eprintf("Cannot find function in 0x%08" PFMT64x "\n", core->offset);
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7164,9 +7155,8 @@ RZ_IPI RzCmdStatus rz_analysis_function_vars_regs_setref_handler(RzCore *core, i
|
||||||
/// --------- Stack-based variable handlers -------------
|
/// --------- Stack-based variable handlers -------------
|
||||||
|
|
||||||
RZ_IPI RzCmdStatus rz_analysis_function_vars_sp_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode) {
|
RZ_IPI RzCmdStatus rz_analysis_function_vars_sp_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode) {
|
||||||
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, -1);
|
RzAnalysisFunction *fcn = analysis_get_function_in(core->analysis, core->offset);
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
eprintf("Cannot find function in 0x%08" PFMT64x "\n", core->offset);
|
|
||||||
return RZ_CMD_STATUS_ERROR;
|
return RZ_CMD_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue