Make type matching independent of bb list order ##anal
This commit is contained in:
parent
50040f8810
commit
a68ff59a32
|
@ -453,6 +453,11 @@ static void type_match(RCore *core, ut64 addr, char *fcn_name, ut64 baddr, const
|
|||
r_cons_break_pop ();
|
||||
}
|
||||
|
||||
static int bb_cmpaddr(const void *_a, const void *_b) {
|
||||
const RAnalBlock *a = _a, *b = _b;
|
||||
return a->addr > b->addr ? 1 : (a->addr < b->addr ? -1 : 0);
|
||||
}
|
||||
|
||||
R_API void r_core_anal_type_match(RCore *core, RAnalFunction *fcn) {
|
||||
RAnalBlock *bb;
|
||||
RListIter *it;
|
||||
|
@ -503,6 +508,7 @@ R_API void r_core_anal_type_match(RCore *core, RAnalFunction *fcn) {
|
|||
return;
|
||||
}
|
||||
r_cons_break_push (NULL, NULL);
|
||||
r_list_sort (fcn->bbs, bb_cmpaddr); // TODO: The algorithm can be more accurate if blocks are followed by their jmp/fail, not just by address
|
||||
r_list_foreach (fcn->bbs, it, bb) {
|
||||
ut64 addr = bb->addr;
|
||||
int i = 0;
|
||||
|
|
|
@ -80,6 +80,11 @@ R_API void r_load_panels_layout(RCore *core, const char *_name);
|
|||
|
||||
static int r_core_cmd_subst_i(RCore *core, char *cmd, char* colon, bool *tmpseek);
|
||||
|
||||
static int bb_cmpaddr(const void *_a, const void *_b) {
|
||||
const RAnalBlock *a = _a, *b = _b;
|
||||
return a->addr > b->addr ? 1 : (a->addr < b->addr ? -1 : 0);
|
||||
}
|
||||
|
||||
static void cmd_debug_reg(RCore *core, const char *str);
|
||||
#include "cmd_quit.c"
|
||||
#include "cmd_hash.c"
|
||||
|
|
|
@ -879,6 +879,7 @@ R_API void r_core_link_stroff(RCore *core, RAnalFunction *fcn) {
|
|||
r_config_set_i (core->config, "dbg.follow", 0);
|
||||
ut64 oldoff = core->offset;
|
||||
r_cons_break_push (NULL, NULL);
|
||||
r_list_sort (fcn->bbs, bb_cmpaddr); // TODO: The algorithm can be more accurate if blocks are followed by their jmp/fail, not just by address
|
||||
r_list_foreach (fcn->bbs, it, bb) {
|
||||
ut64 at = bb->addr;
|
||||
ut64 to = bb->addr + bb->size;
|
||||
|
|
Loading…
Reference in New Issue