new_read_window 🡒 read_at

This commit is contained in:
Khairul Kasmiran 2018-03-06 22:19:57 +08:00
parent 0d3879fc52
commit 2244152360
3 changed files with 8 additions and 11 deletions

View File

@ -63,10 +63,12 @@ static int bf_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) {
op->type = R_ANAL_OP_TYPE_ILL;
goto beach;
}
if (i == len - 1 && anal->cb.new_read_window) {
const ut8 *new_buf = anal->cb.new_read_window (anal, addr, len + 1 + BUFSIZE_INC);
if (i == len - 1 && anal->cb.read_at) {
int new_buf_len = len + 1 + BUFSIZE_INC;
const ut8 *new_buf = calloc (new_buf_len, 1);
if (new_buf) {
free ((ut8 *)buf);
(void)anal->cb.read_at (anal, addr, new_buf, new_buf_len);
buf = new_buf;
p = buf + i;
len += BUFSIZE_INC;

View File

@ -3098,14 +3098,9 @@ static ut64 initializeEsil(RCore *core) {
return addr;
}
static const ut8 *new_read_window(void *anal_, ut64 new_addr, int new_len) {
static bool read_at(void *anal_, ut64 new_addr, ut8 *buf, int new_len) {
RAnal *anal = anal_;
ut8 *buf = calloc (new_len, 1);
if (!buf) {
return NULL;
}
(void)r_io_read_at (anal->iob.io, new_addr, buf, new_len);
return buf;
return r_io_read_at (anal->iob.io, new_addr, buf, new_len);
}
R_API int r_core_esil_step(RCore *core, ut64 until_addr, const char *until_expr, ut64 *prev_addr) {
@ -3129,7 +3124,7 @@ R_API int r_core_esil_step(RCore *core, ut64 until_addr, const char *until_expr,
return 0;
}
r_anal_esil_setup (esil, core->anal, romem, stats, noNULL); // setup io
core->anal->cb.new_read_window = new_read_window;
core->anal->cb.read_at = read_at;
core->anal->esil = esil;
esil->verbose = verbose;
{

View File

@ -578,7 +578,7 @@ typedef struct r_anal_callbacks_t {
int (*on_fcn_delete) (RANAL , void *user, RAnalFunction *fcn);
int (*on_fcn_rename) (RANAL, void *user, RAnalFunction *fcn, const char *oldname);
int (*on_fcn_bb_new) (RANAL, void *user, RAnalFunction *fcn, RANAL_BLOCK bb);
const ut8 *(*new_read_window)(RANAL, ut64 new_addr, int new_len);
bool (*read_at)(RANAL, ut64 new_addr, ut8 *buf, int new_len);
} RAnalCallbacks;
#define R_ANAL_ESIL_GOTO_LIMIT 4096