* Fix bb analysis

- Remove depth checks, it makes sense only for fcns
* Update r_core vapi
This commit is contained in:
Nibble 2011-02-25 20:23:07 +01:00
parent 43b57a7102
commit 7eefc3b582
3 changed files with 6 additions and 8 deletions

View File

@ -96,7 +96,7 @@ static void r_core_anal_graph_nodes(RCore *core, RAnalFcn *fcn, int opts) {
}
}
R_API int r_core_anal_bb(RCore *core, RAnalFcn *fcn, ut64 at, int depth, int head) {
R_API int r_core_anal_bb(RCore *core, RAnalFcn *fcn, ut64 at, int head) {
struct r_anal_bb_t *bb, *bbi;
RListIter *iter;
ut64 jump, fail;
@ -104,8 +104,6 @@ R_API int r_core_anal_bb(RCore *core, RAnalFcn *fcn, ut64 at, int depth, int hea
int ret = R_ANAL_RET_NEW, buflen, bblen = 0;
int split = core->anal->split;
if (depth < 0)
return R_FALSE;
if (!(bb = r_anal_bb_new()))
return R_FALSE;
if (split) ret = r_anal_fcn_split_bb (fcn, bb, at);
@ -134,9 +132,9 @@ R_API int r_core_anal_bb(RCore *core, RAnalFcn *fcn, ut64 at, int depth, int hea
fail = bb->fail;
jump = bb->jump;
if (fail != -1)
r_core_anal_bb (core, fcn, fail, depth-1, R_FALSE);
r_core_anal_bb (core, fcn, fail, R_FALSE);
if (jump != -1)
r_core_anal_bb (core, fcn, jump, depth-1, R_FALSE);
r_core_anal_bb (core, fcn, jump, R_FALSE);
}
}
} while (bblen != R_ANAL_RET_END);
@ -219,7 +217,7 @@ R_API int r_core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int dept
r_flag_set (core->flags, fcn->name, at, fcn->size, 0);
}
/* TODO: Dupped analysis, needs more optimization */
r_core_anal_bb (core, fcn, fcn->addr, depth, R_TRUE);
r_core_anal_bb (core, fcn, fcn->addr, R_TRUE);
r_list_sort (fcn->bbs, &cmpaddr);
/* New function: Add initial xref */
if (from != -1) {

View File

@ -165,7 +165,7 @@ R_API char *r_core_disassemble_bytes(RCore *core, ut64 addr, int b);
/* anal.c */
R_API int r_core_anal_search(RCore *core, ut64 from, ut64 to, ut64 ref);
R_API void r_core_anal_refs(RCore *core, ut64 addr, int gv);
R_API int r_core_anal_bb(RCore *core, RAnalFcn *fcn, ut64 at, int depth, int head);
R_API int r_core_anal_bb(RCore *core, RAnalFcn *fcn, ut64 at, int head);
R_API int r_core_anal_bb_seek(struct r_core_t *core, ut64 addr);
R_API int r_core_anal_fcn(struct r_core_t *core, ut64 at, ut64 from, int reftype, int depth);
R_API int r_core_anal_fcn_list(RCore *core, const char *input, int rad);

View File

@ -52,7 +52,7 @@ public class RCore {
public int anal_search (uint64 from, uint64 to, uint64 ref);
public void anal_refs(uint64 addr, int gv);
public int anal_bb(RAnal.Fcn fcn, uint64 at, int depth, int head);
public int anal_bb(RAnal.Fcn fcn, uint64 at, int head);
public int anal_bb_seek(uint64 addr);
public int anal_fcn(uint64 at, uint64 from, int reftype, int depth);
public int anal_fcn_list(string input, bool rad);