2011-03-17 18:05:39 +00:00
|
|
|
/* radare - LGPL - Copyright 2010-2011 - nibble<develsec.org> */
|
2010-05-24 16:35:08 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <r_anal.h>
|
|
|
|
#include <r_list.h>
|
|
|
|
#include <r_util.h>
|
2010-05-25 18:12:49 +00:00
|
|
|
#include <r_core.h>
|
2010-05-24 17:08:38 +00:00
|
|
|
|
2010-12-06 02:34:44 +00:00
|
|
|
R_API int r_core_gdiff(RCore *c, RCore *c2) {
|
|
|
|
RCore *cores[2] = {c, c2};
|
2010-05-24 16:35:08 +00:00
|
|
|
RAnalFcn *fcn;
|
|
|
|
RAnalBlock *bb;
|
2010-12-24 15:58:27 +00:00
|
|
|
RListIter *iter, *iter2;
|
2010-05-24 16:35:08 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 2; i++) {
|
2010-12-06 02:34:44 +00:00
|
|
|
r_core_anal_all (cores[i]);
|
2010-12-24 15:58:27 +00:00
|
|
|
/* Fingerprint fcn bbs */
|
2010-12-06 02:34:44 +00:00
|
|
|
iter = r_list_iterator (cores[i]->anal->fcns);
|
2010-05-24 16:35:08 +00:00
|
|
|
while (r_list_iter_next (iter)) {
|
|
|
|
fcn = r_list_iter_get (iter);
|
2010-12-24 15:58:27 +00:00
|
|
|
iter2 = r_list_iterator (fcn->bbs);
|
|
|
|
while (r_list_iter_next (iter2)) {
|
|
|
|
bb = r_list_iter_get (iter2);
|
2011-03-06 14:21:13 +00:00
|
|
|
r_anal_diff_fingerprint_bb (cores[i]->anal, bb);
|
2010-12-04 14:14:53 +00:00
|
|
|
}
|
2010-05-24 16:35:08 +00:00
|
|
|
}
|
2011-03-06 14:21:13 +00:00
|
|
|
/* Fingerprint fcn */
|
2010-12-24 15:58:27 +00:00
|
|
|
iter = r_list_iterator (cores[i]->anal->fcns);
|
2010-12-04 14:14:53 +00:00
|
|
|
while (r_list_iter_next (iter)) {
|
2010-12-24 15:58:27 +00:00
|
|
|
fcn = r_list_iter_get (iter);
|
2011-03-06 14:21:13 +00:00
|
|
|
fcn->size = r_anal_diff_fingerprint_fcn (cores[i]->anal, fcn);
|
2010-12-04 14:14:53 +00:00
|
|
|
}
|
2010-05-24 16:35:08 +00:00
|
|
|
}
|
|
|
|
/* Diff functions */
|
2011-03-06 14:21:13 +00:00
|
|
|
r_anal_diff_fcn (cores[0]->anal, cores[0]->anal->fcns, cores[1]->anal->fcns);
|
2010-05-24 16:35:08 +00:00
|
|
|
|
|
|
|
return R_TRUE;
|
|
|
|
}
|