Skip to content

Commit

Permalink
A bit verboser esil step
Browse files Browse the repository at this point in the history
  • Loading branch information
trufae authored Nov 17, 2023
1 parent 231b5f1 commit 90eee1b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions libr/core/cmd_anal.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -6410,7 +6410,8 @@ R_API int r_core_esil_step(RCore *core, ut64 until_addr, const char *until_expr,
return 0;
}
char *pcname = strdup (_pcname);
const bool r2wars = r_config_get_b (core->config, "cfg.r2wars");
const bool is_x86 = r_str_startswith (r_config_get (core->config, "asm.arch"), "x86");
const bool r2wars = is_x86 && r_config_get_b (core->config, "cfg.r2wars");
const bool breakoninvalid = r_config_get_b (core->config, "esil.breakoninvalid");
const int esiltimeout = r_config_get_i (core->config, "esil.timeout");
ut64 startTime = 0;
Expand All @@ -6422,6 +6423,7 @@ R_API int r_core_esil_step(RCore *core, ut64 until_addr, const char *until_expr,
ut64 addr = -1;
ut64 oaddr = -1;
int minopsz = r_arch_info (core->anal->arch, R_ARCH_INFO_MIN_OP_SIZE);
int dataAlign = r_anal_archinfo (esil->anal, R_ANAL_ARCHINFO_DATA_ALIGN);
ut64 naddr = addr + minopsz;
bool notfirst = false;
for (; true; r_anal_op_fini (&op)) {
Expand Down Expand Up @@ -6470,7 +6472,6 @@ R_API int r_core_esil_step(RCore *core, ut64 until_addr, const char *until_expr,
return_tail (1);
}
}
int dataAlign = r_anal_archinfo (esil->anal, R_ANAL_ARCHINFO_DATA_ALIGN);
if (dataAlign > 1) {
if (addr % dataAlign) {
if (esil->cmd && R_STR_ISNOTEMPTY (esil->cmd_trap)) {
Expand All @@ -6484,7 +6485,7 @@ R_API int r_core_esil_step(RCore *core, ut64 until_addr, const char *until_expr,
}
(void) r_io_read_at (core->io, addr, code, sizeof (code));
// TODO: sometimes this is dupe
ret = r_anal_op (core->anal, &op, addr, code, sizeof (code), R_ARCH_OP_MASK_ESIL | R_ARCH_OP_MASK_HINT);
ret = r_anal_op (core->anal, &op, addr, code, sizeof (code), R_ARCH_OP_MASK_BASIC | R_ARCH_OP_MASK_ESIL | R_ARCH_OP_MASK_HINT);
naddr = addr + op.size;
// if type is JMP then we execute the next N instructions
// update the esil pointer because RAnal.op() can change it
Expand Down Expand Up @@ -6549,6 +6550,7 @@ R_API int r_core_esil_step(RCore *core, ut64 until_addr, const char *until_expr,
r_debug_trace_op (core->dbg, &op);
core->dbg->reg = reg;
} else if (R_STR_ISNOTEMPTY (e)) {
R_LOG_DEBUG ("esil_parse: %s", e);
r_esil_parse (esil, e);
if (esil->trap) {
R_LOG_WARN ("ESIL TRAP %d/%d ON %s at 0x%08"PFMT64x,
Expand Down

0 comments on commit 90eee1b

Please sign in to comment.