Skip to content

Commit

Permalink
Remove fcnstore (Fix radareorg#9611)
Browse files Browse the repository at this point in the history
  • Loading branch information
thestr4ng3r committed Mar 16, 2018
1 parent a3eaa10 commit 50739e6
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 179 deletions.
2 changes: 1 addition & 1 deletion libr/anal/Makefile
Expand Up @@ -28,7 +28,7 @@ include ${STATIC_ANAL_PLUGINS}

STATIC_OBJS=$(addprefix $(LTOP)/anal/p/,$(STATIC_OBJ))
OBJLIBS=meta.o reflines.o ref.o op.o fcn.o bb.o var.o
OBJLIBS+=cond.o value.o cc.o diff.o types.o fcnstore.o
OBJLIBS+=cond.o value.o cc.o diff.o types.o
OBJLIBS+=hint.o anal.o data.o xrefs.o esil.o sign.o
OBJLIBS+=anal_ex.o switch.o state.o cycles.o
OBJLIBS+=esil_stats.o esil_trace.o flirt.o labels.o
Expand Down
7 changes: 0 additions & 7 deletions libr/anal/anal.c
Expand Up @@ -103,9 +103,6 @@ R_API RAnal *r_anal_new() {
anal->lineswidth = 0;
anal->fcns = r_anal_fcn_list_new ();
anal->fcn_tree = NULL;
#if USE_NEW_FCN_STORE
anal->fcnstore = r_listrange_new ();
#endif
anal->refs = r_anal_ref_list_new ();
anal->types = r_anal_type_list_new ();
r_anal_set_bits (anal, 32);
Expand Down Expand Up @@ -418,10 +415,6 @@ R_API int r_anal_purge (RAnal *anal) {
r_list_free (anal->fcns);
anal->fcns = r_anal_fcn_list_new ();
anal->fcn_tree = NULL;
#if USE_NEW_FCN_STORE
r_listrange_free (anal->fcnstore);
anal->fcnstore = r_listrange_new ();
#endif
r_list_free (anal->refs);
anal->refs = r_anal_ref_list_new ();
r_list_free (anal->types);
Expand Down
46 changes: 3 additions & 43 deletions libr/anal/fcn.c
Expand Up @@ -1419,10 +1419,6 @@ R_API int r_anal_fcn_insert(RAnal *anal, RAnalFunction *fcn) {
if (f) {
return false;
}
#if USE_NEW_FCN_STORE
r_listrange_add (anal->fcnstore, fcn);
// HUH? store it here .. for backweird compatibility
#endif
/* TODO: sdbization */
r_list_append (anal->fcns, fcn);
r_anal_fcn_tree_insert (&anal->fcn_tree, fcn);
Expand Down Expand Up @@ -1470,9 +1466,6 @@ R_API int r_anal_fcn_del_locs(RAnal *anal, ut64 addr) {
RListIter *iter, *iter2;
RAnalFunction *fcn, *f = r_anal_get_fcn_in (anal, addr,
R_ANAL_FCN_TYPE_ROOT);
#if USE_NEW_FCN_STORE
#warning TODO: r_anal_fcn_del_locs not implemented for newstore
#endif
if (!f) {
return false;
}
Expand All @@ -1491,24 +1484,12 @@ R_API int r_anal_fcn_del_locs(RAnal *anal, ut64 addr) {

R_API int r_anal_fcn_del(RAnal *a, ut64 addr) {
if (addr == UT64_MAX) {
#if USE_NEW_FCN_STORE
r_listrange_free (a->fcnstore);
a->fcnstore = r_listrange_new ();
#else
r_list_free (a->fcns);
a->fcn_tree = NULL;
if (!(a->fcns = r_anal_fcn_list_new ())) {
return false;
}
#endif
} else {
#if USE_NEW_FCN_STORE
// XXX: must only get the function if starting at 0?
RAnalFunction *f = r_listrange_find_in_range (a->fcnstore, addr);
if (f) {
r_listrange_del (a->fcnstore, f);
}
#else
RAnalFunction *fcni;
RListIter *iter, *iter_tmp;
r_list_foreach_safe (a->fcns, iter, iter_tmp, fcni) {
Expand All @@ -1522,19 +1503,12 @@ R_API int r_anal_fcn_del(RAnal *a, ut64 addr) {
r_list_delete (a->fcns, iter);
}
}
#endif
}
return true;
}

R_API RAnalFunction *r_anal_get_fcn_in(RAnal *anal, ut64 addr, int type) {
#if USE_NEW_FCN_STORE
// TODO: type is ignored here? wtf.. we need more work on fcnstore
// if (root) return r_listrange_find_root (anal->fcnstore, addr);
return r_listrange_find_in_range (anal->fcnstore, addr);
#else

# if 0
#if 0
// Linear scan
RAnalFunction *fcn, *ret = NULL;
RListIter *iter;
Expand All @@ -1556,7 +1530,7 @@ R_API RAnalFunction *r_anal_get_fcn_in(RAnal *anal, ut64 addr, int type) {
}
return ret;

# else
#else
// Interval tree query
RAnalFunction *fcn;
FcnTreeIter it;
Expand All @@ -1571,21 +1545,14 @@ R_API RAnalFunction *r_anal_get_fcn_in(RAnal *anal, ut64 addr, int type) {
}
}
return NULL;
# endif
#endif // USE_NEW_FCN_STORE
#endif
}

R_API bool r_anal_fcn_in(RAnalFunction *fcn, ut64 addr) {
return fcn? r_tinyrange_in (&fcn->bbr, addr): false;
}

R_API RAnalFunction *r_anal_get_fcn_in_bounds(RAnal *anal, ut64 addr, int type) {
#if USE_NEW_FCN_STORE
#warning TODO: r_anal_get_fcn_in_bounds
// TODO: type is ignored here? wtf.. we need more work on fcnstore
// if (root) return r_listrange_find_root (anal->fcnstore, addr);
return r_listrange_find_in_range (anal->fcnstore, addr);
#else
RAnalFunction *fcn, *ret = NULL;
RListIter *iter;
if (type == R_ANAL_FCN_TYPE_ROOT) {
Expand All @@ -1604,7 +1571,6 @@ R_API RAnalFunction *r_anal_get_fcn_in_bounds(RAnal *anal, ut64 addr, int type)
}
}
return ret;
#endif
}

R_API RAnalFunction *r_anal_fcn_find_name(RAnal *anal, const char *name) {
Expand Down Expand Up @@ -1828,11 +1794,6 @@ R_API int r_anal_str_to_fcn(RAnal *a, RAnalFunction *f, const char *sig) {
}

R_API RAnalFunction *r_anal_get_fcn_at(RAnal *anal, ut64 addr, int type) {
#if USE_NEW_FCN_STORE
// TODO: type is ignored here? wtf.. we need more work on fcnstore
// if (root) return r_listrange_find_root (anal->fcnstore, addr);
return r_listrange_find_root (anal->fcnstore, addr);
#else
RAnalFunction *fcn, *ret = NULL;
RListIter *iter;
if (type == R_ANAL_FCN_TYPE_ROOT) {
Expand All @@ -1851,7 +1812,6 @@ R_API RAnalFunction *r_anal_get_fcn_at(RAnal *anal, ut64 addr, int type) {
}
}
return ret;
#endif
}

R_API RAnalFunction *r_anal_fcn_next(RAnal *anal, ut64 addr) {
Expand Down
125 changes: 0 additions & 125 deletions libr/anal/fcnstore.c

This file was deleted.

1 change: 0 additions & 1 deletion libr/anal/meson.build
Expand Up @@ -13,7 +13,6 @@ files = [
'esil_stats.c',
'esil_trace.c',
'fcn.c',
'fcnstore.c',
'flirt.c',
'hint.c',
'labels.c',
Expand Down
2 changes: 0 additions & 2 deletions libr/include/r_anal.h
Expand Up @@ -37,8 +37,6 @@ R_LIB_VERSION_HEADER(r_anal);
bb_has_ops=1 -> 600M
bb_has_ops=0 -> 350MB
*/
/* TODO: work in progress */
#define USE_NEW_FCN_STORE 0

// TODO: Remove this define? /cc @nibble_ds
#define VERBOSE_ANAL if(0)
Expand Down

0 comments on commit 50739e6

Please sign in to comment.