From 8d02b7fececfc98090d4da1b26b780c63ae06dc8 Mon Sep 17 00:00:00 2001 From: pancake Date: Fri, 9 Dec 2016 22:42:43 +0100 Subject: [PATCH] Fix #6296 - Set esil->cmd to fix regression --- libr/anal/esil.c | 6 ++++-- libr/core/cconfig.c | 2 +- libr/core/cmd_anal.c | 8 ++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/libr/anal/esil.c b/libr/anal/esil.c index 218732cc73..b66e6e3403 100644 --- a/libr/anal/esil.c +++ b/libr/anal/esil.c @@ -140,8 +140,9 @@ R_API int r_anal_esil_fire_interrupt(RAnalEsil *esil, int interrupt) { char t[128]; char *i; RAnalEsilInterruptCB icb; - if (!esil) + if (!esil) { return false; + } if (esil->cmd) { if (esil->cmd (esil, esil->cmd_intr, interrupt, 0)) { return true; @@ -2532,8 +2533,9 @@ R_API void r_anal_esil_stack_free(RAnalEsil *esil) { R_API int r_anal_esil_condition(RAnalEsil *esil, const char *str) { char *popped; int ret; - if (!esil) + if (!esil) { return false; + } while (*str == ' ') str++; // use proper string chop? ret = r_anal_esil_parse (esil, str); popped = r_anal_esil_pop (esil); diff --git a/libr/core/cconfig.c b/libr/core/cconfig.c index 37a898d6a7..fc3fa17a4b 100644 --- a/libr/core/cconfig.c +++ b/libr/core/cconfig.c @@ -937,7 +937,7 @@ static int cb_hexpairs(void *user, void *data) { return true; } -static int r_core_esil_cmd(RAnalEsil *esil, const char *cmd, int a1, int a2) { +R_API int r_core_esil_cmd(RAnalEsil *esil, const char *cmd, int a1, int a2) { if (cmd && *cmd) { RCore *core = esil->anal->user; r_core_cmdf (core, "%s %d %d", cmd, a1, a2); diff --git a/libr/core/cmd_anal.c b/libr/core/cmd_anal.c index 08e2877d37..aef4794e1a 100644 --- a/libr/core/cmd_anal.c +++ b/libr/core/cmd_anal.c @@ -2093,6 +2093,7 @@ void cmd_anal_reg(RCore *core, const char *str) { } } +R_API int r_core_esil_cmd(RAnalEsil *esil, const char *cmd, int a1, int a2); R_API int r_core_esil_step(RCore *core, ut64 until_addr, const char *until_expr) { // Stepping int ret; @@ -2100,6 +2101,13 @@ R_API int r_core_esil_step(RCore *core, ut64 until_addr, const char *until_expr) RAnalOp op; RAnalEsil *esil = core->anal->esil; const char *name = r_reg_get_name (core->anal->reg, R_REG_NAME_PC); + if (!esil) { + r_core_cmd0 (core, "aei"); + esil = core->anal->esil; + } + if (esil) { + esil->cmd = r_core_esil_cmd; + } ut64 addr = r_reg_getv (core->anal->reg, name); r_cons_break_push (NULL, NULL); repeat: