diff --git a/libr/core/cconfig.c b/libr/core/cconfig.c index 83cfd9053d..a7f4e551b7 100644 --- a/libr/core/cconfig.c +++ b/libr/core/cconfig.c @@ -3433,6 +3433,7 @@ R_API int r_core_config_init(RCore *core) { #endif SETBPREF ("dbg.glibc.demangle", "false", "Demangle linked-lists pointers introduced in glibc 2.32"); SETBPREF ("esil.prestep", "true", "Step before esil evaluation in `de` commands"); + SETI ("esil.maxsteps", 0, "If !=0 defines the maximum amount of steps to perform on aesu/aec/.."); SETPREF ("esil.fillstack", "", "Initialize ESIL stack with (random, debrujn, sequence, zeros, ...)"); SETICB ("esil.verbose", 0, &cb_esilverbose, "Show ESIL verbose level (0, 1, 2)"); SETICB ("esil.gotolimit", core->anal->esil_goto_limit, &cb_gotolimit, "Maximum number of gotos per ESIL expression"); diff --git a/libr/core/cmd_debug.c b/libr/core/cmd_debug.c index 8ce2951f01..132c07c01f 100644 --- a/libr/core/cmd_debug.c +++ b/libr/core/cmd_debug.c @@ -847,10 +847,13 @@ static int step_until_optype(RCore *core, const char *_optypes) { ut8 buf[32]; ut64 pc; int res = true; + st64 maxsteps = r_config_get_i (core->config, "esil.maxsteps"); + ut64 countsteps = 0; RList *optypes_list = NULL; RListIter *iter; - char *optype, *optypes = strdup (r_str_trim_head_ro ((char *) _optypes)); + char *optype = NULL; + char *optypes = strdup (r_str_trim_head_ro ((char *) _optypes)); if (!core || !core->dbg) { eprintf ("Wrong state\n"); @@ -867,7 +870,7 @@ static int step_until_optype(RCore *core, const char *_optypes) { optypes_list = r_str_split_list (optypes, " ", 0); r_cons_break_push (NULL, NULL); - for (;;) { + for (; !maxsteps || countsteps < maxsteps; countsteps++) { if (r_cons_is_breaked ()) { core->break_loop = true; break;