diff --git a/libr/bin/format/mach0/mach0.c b/libr/bin/format/mach0/mach0.c index 0506901d05..bdba093f3c 100644 --- a/libr/bin/format/mach0/mach0.c +++ b/libr/bin/format/mach0/mach0.c @@ -307,7 +307,7 @@ static int MACH0_(r_bin_mach0_init_items)(struct MACH0_(r_bin_mach0_obj_t)* bin) // TODO table of non-instructions in __text break; case LC_RPATH: - eprintf ("--->\n"); + //eprintf ("--->\n"); break; case LC_SEGMENT_64: case LC_SEGMENT: diff --git a/libr/core/anal.c b/libr/core/anal.c index 1abdc69e70..d6a6a0d26c 100644 --- a/libr/core/anal.c +++ b/libr/core/anal.c @@ -314,18 +314,24 @@ static int iscodesection(RCore *core, ut64 addr) { // XXX: This function takes sometimes forever R_API int r_core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int depth) { + int has_next = r_config_get_i (core->config, "anal.hasnext"); RListIter *iter, *iter2; int buflen, fcnlen = 0; RAnalFunction *fcn = NULL, *fcni; RAnalRef *ref = NULL, *refi; ut64 *next = NULL; +# define next_append(x) {\ + next = realloc (next, sizeof (ut64)*(1+nexti)); \ + next[nexti] = (x); \ + nexti++; \ + } int i, nexti = 0; ut8 *buf; if (core->anal->cur && core->anal->cur->analyze_fns) { int result = R_ANAL_RET_ERROR; - r_bin_bind(core->bin, &(core->anal->binb)); - result = core->anal->cur->analyze_fns( core->anal, at, from, reftype, depth); + r_bin_bind (core->bin, &(core->anal->binb)); + result = core->anal->cur->analyze_fns (core->anal, at, from, reftype, depth); // do this to prevent stale usage and catch others who are using it //memset(&core->anal->binb, 0, sizeof(RBinBind)); r_list_foreach (core->anal->fcns, iter, fcni) { @@ -385,9 +391,6 @@ fcn->name = r_str_newf ("fcn.%08"PFMT64x, at); eprintf ("Error: malloc (buf)\n"); goto error; } -#define MAXNEXT 1032 // TODO: make it relocatable - if (r_config_get_i (core->config, "anal.hasnext")) - next = R_NEWS0 (ut64, MAXNEXT); //eprintf ("FUNC 0x%08"PFMT64x"\n", at+fcnlen); do { @@ -460,8 +463,7 @@ fcn->name = r_str_newf ("fcn.%08"PFMT64x, at); } // XXX: this looks weird r_anal_fcn_insert (core->anal, fcn); -#if 1 - if (next && nextiaddr + fcn->size; for (i=0; iname = r_str_newf ("fcn.%08"PFMT64x, at); r_cons_clear_line (); eprintf ("FUNC 0x%08"PFMT64x" > 0x%08"PFMT64x"\r", fcn->addr, fcn->addr + fcn->size); - next[nexti++] = fcn->addr + fcn->size; + next_append (fcn->addr+fcn->size); } } -#endif r_list_foreach (fcn->refs, iter, refi) { if (refi->addr != UT64_MAX) { switch (refi->type) { @@ -507,7 +508,7 @@ fcn->name = r_str_newf ("fcn.%08"PFMT64x, at); } while (fcnlen != R_ANAL_RET_END); free (buf); - if (next) { + if (has_next) { for (i=0; iaddr + fcn->size; + if (has_next) { + next_append (fcn->addr+fcn->size); for (i=0; idata = data; r_list_append (s->list, item); // item must be alloacted by slices // find slot - slot = r_slist_get_slot(s, from); + slot = r_slist_get_slot (s, from); if (slot<0) { //r_slist_optimize (); return NULL;