From d2e62ed672e2b2724bc63fcd0f31e4a6189debf8 Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 1 Feb 2021 15:05:19 +0100 Subject: [PATCH] Fix #18316 - ?0 and ?1 were a bad idea, move to ?t (#18321) --- libr/core/cmd_help.c | 42 +++++++++++++++++++++++++++--------------- libr/core/visual.c | 10 +++++----- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/libr/core/cmd_help.c b/libr/core/cmd_help.c index 88adab4a58..1571bef8f8 100644 --- a/libr/core/cmd_help.c +++ b/libr/core/cmd_help.c @@ -469,15 +469,36 @@ static int cmd_help(void *data, const char *input) { RList *tmp; switch (input[0]) { - case '0': // "?0" - core->curtab = 0; - break; - case '1': // "?1" - if (core->curtab < 0) { + case 't': { // "?t" + switch (input[1]) { + case '0': core->curtab = 0; + break; + case '1': + if (core->curtab < 0) { + core->curtab = 0; + } + core->curtab ++; + break; + case ' ': + { + struct r_prof_t prof; + r_prof_start (&prof); + r_core_cmd (core, input + 1, 0); + r_prof_end (&prof); + core->num->value = (ut64)(int)prof.result; + eprintf ("%lf\n", prof.result); + break; + } + default: + eprintf ("Usage: ?t[0,1] [cmd]\n"); + eprintf ("?t pd 32 # show time needed to run 'pd 32'\n"); + eprintf ("?t0 # select first visual tab\n"); + eprintf ("?t1 # select next visual tab\n"); + break; } - core->curtab ++; break; + } case 'r': // "?r" { // TODO : Add support for 64bit random numbers ut64 b = 0; @@ -1192,15 +1213,6 @@ static int cmd_help(void *data, const char *input) { free (rstr); break; } - case 't': { // "?t" - struct r_prof_t prof; - r_prof_start (&prof); - r_core_cmd (core, input + 1, 0); - r_prof_end (&prof); - core->num->value = (ut64)(int)prof.result; - eprintf ("%lf\n", prof.result); - break; - } case '?': // "??" if (input[1] == '?') { if (input[2] == '?') { // "???" diff --git a/libr/core/visual.c b/libr/core/visual.c index 0dfa22b486..2bddef396b 100644 --- a/libr/core/visual.c +++ b/libr/core/visual.c @@ -4128,8 +4128,8 @@ static void visual_refresh(RCore *core) { break; } snprintf (debugstr, sizeof (debugstr), - "?0;%s %d @ %"PFMT64d";cl;" - "?1;%s %d @ %"PFMT64d";", + "?t0;%s %d @ %"PFMT64d";cl;" + "?t1;%s %d @ %"PFMT64d";", pxw, size, splitPtr, pxw, size, core->offset); core->print->screen_bounds = 1LL; @@ -4313,7 +4313,7 @@ dodo: if (cmdvhex && *cmdvhex) { snprintf (debugstr, sizeof (debugstr), - "?0;f tmp;ssr %s;%s;?1;%s;?1;" + "?t0;f tmp;ssr %s;%s;?1;%s;?1;" "ss tmp;f-tmp;pd $r", reg, cmdvhex, ref? "drr": "dr="); debugstr[sizeof (debugstr) - 1] = 0; @@ -4323,8 +4323,8 @@ dodo: const int absdelta = R_ABS (delta); snprintf (debugstr, sizeof (debugstr), "diq;?0;f tmp;ssr %s;%s %d@$$%c%d;" - "?1;%s;" - "?1;ss tmp;f-tmp;afal;pd $r", + "?t1;%s;" + "?t1;ss tmp;f-tmp;afal;pd $r", reg, pxa? "pxa": pxw, size, sign, absdelta, ref? "drr": "dr="); }