Remove unused RAnalFunction Members (#16521)

* Remove unused RAnalFunction Members
* Kill more code
* Reintroduce temporary nargs=4
This commit is contained in:
Florian Märkl 2020-04-12 14:17:45 +02:00 committed by GitHub
parent 00a30c943a
commit 082fb723df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 36 deletions

View File

@ -58,10 +58,6 @@ R_API RAnalFunction *r_anal_function_new(RAnal *anal) {
return NULL;
}
fcn->anal = anal;
/* Function qualifier: static/volatile/inline/naked/virtual */
fcn->fmod = R_ANAL_FQUALIFIER_NONE;
/* Function calling convention: cdecl/stdcall/fastcall/etc */
/* Function attributes: weak/noreturn/format/etc */
fcn->addr = UT64_MAX;
fcn->cc = r_str_constpool_get (&anal->constpool, r_anal_cc_default (anal));
fcn->bits = anal->bits;
@ -97,11 +93,9 @@ R_API void r_anal_function_free(void *_fcn) {
}
free (fcn->name);
free (fcn->attr);
fcn->bbs = NULL;
free (fcn->fingerprint);
r_anal_diff_free (fcn->diff);
free (fcn->args);
free (fcn);
}

View File

@ -1829,9 +1829,6 @@ static int core_anal_graph_nodes(RCore *core, RAnalFunction *fcn, int opts, PJ *
sdb_set (DB, "name", fcn->name, 0);
sdb_set (DB, "ename", ename, 0);
free (ename);
if (fcn->nargs > 0) {
sdb_num_set (DB, "nargs", fcn->nargs, 0);
}
sdb_num_set (DB, "size", r_anal_function_linear_size (fcn), 0);
if (fcn->maxstack > 0) {
sdb_num_set (DB, "stack", fcn->maxstack, 0);
@ -1857,9 +1854,6 @@ static int core_anal_graph_nodes(RCore *core, RAnalFunction *fcn, int opts, PJ *
pj_kn (pj, "size", r_anal_function_linear_size (fcn));
pj_ki (pj, "stack", fcn->maxstack);
pj_ks (pj, "type", r_anal_fcntype_tostring (fcn->type));
if (fcn->dsc) {
pj_ks (pj, "signature", fcn->dsc);
}
pj_k (pj, "blocks");
pj_a (pj);
}

View File

@ -162,8 +162,6 @@ R_API void r_core_print_func_args(RCore *core) {
if (op->type == R_ANAL_OP_TYPE_CALL) {
RAnalFunction *fcn;
RAnalFuncArg *arg;
int i;
int nargs = 0;
bool onstack = false;
const char *fcn_name = NULL;
ut64 pcv = op->jump;
@ -193,19 +191,18 @@ R_API void r_core_print_func_args(RCore *core) {
argcnt++;
}
} else {
if (fcn) {
nargs = fcn->nargs;
}
if (nargs > 0) {
int nargs = 4; // TODO: use a correct value here when available
//if (nargs > 0) {
int i;
for (i = 0; i < nargs; i++) {
ut64 v = r_debug_arg_get (core->dbg, R_ANAL_CC_TYPE_STDCALL, i);
print_arg_str (i, "", color);
r_cons_printf ("0x%08" PFMT64x, v);
r_cons_newline ();
}
} else {
print_arg_str (0, "void", color);
}
//} else {
// print_arg_str (0, "void", color);
//}
}
}
r_anal_op_fini (op);

View File

@ -242,39 +242,25 @@ typedef struct r_anal_fcn_meta_t {
int numcallrefs; // number of calls
} RAnalFcnMeta;
/* Store various function information,
* variables, arguments, refs and even
* description */
typedef struct r_anal_function_t {
char* name;
char* dsc; // For producing nice listings
char *name;
int bits; // ((> bits 0) (set-bits bits))
int type;
/*item_list *rets; // Type of return value */
char *rets;
short fmod; // static, inline or volatile?
const char *cc; // calling convention, should come from RAnal.constpool
char* attr; // __attribute__(()) list
ut64 addr;
ut64 rb_max_addr; // maximum of meta.min + _size - 1 in the subtree, for fcn interval tree
int stack; //stack frame size
int maxstack;
int ninstr;
int nargs; // Function arguments counter
int depth;
bool folded;
bool is_pure;
bool has_changed; // true if function may have changed since last anaysis TODO: set this attribute where necessary
bool bp_frame;
bool is_noreturn; // true if function does not return
RAnalType *args; // list of arguments
ut8 *fingerprint; // TODO: make is fuzzy and smarter
size_t fingerprint_size;
RAnalDiff *diff;
//RList *locals; // list of local labels -> moved to anal->sdb_fcns
RList *bbs; // TODO: should be RPVector
RAnalFcnMeta meta;
RBNode addr_rb;
RList *imports; // maybe bound to class?
struct r_anal_t *anal; // this function is associated with this instance
} RAnalFunction;