Rotate between call/jmp/lea in graph and panels with 'r'

This commit is contained in:
Deepak Chethan 2019-04-16 22:12:30 +05:30 committed by radare
parent 74d7d7635d
commit 71dd95bb90
3 changed files with 27 additions and 11 deletions

View File

@ -4382,8 +4382,16 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
g->need_reload_nodes = true;
}
// TODO: toggle shortcut hotkeys
r_core_cmd0 (core, "e!asm.hint.jmp");
r_core_cmd0 (core, "e!asm.hint.lea");
if (r_config_get_i (core->config, "asm.hint.call")) {
r_core_cmd0 (core, "e!asm.hint.call");
r_core_cmd0 (core, "e!asm.hint.jmp");
} else if (r_config_get_i (core->config, "asm.hint.jmp")) {
r_core_cmd0 (core, "e!asm.hint.jmp");
r_core_cmd0 (core, "e!asm.hint.lea");
} else if (r_config_get_i (core->config, "asm.hint.lea")) {
r_core_cmd0 (core, "e!asm.hint.lea");
r_core_cmd0 (core, "e!asm.hint.call");
}
break;
case '$':
r_core_cmd (core, "dr PC=$$", 0);

View File

@ -147,7 +147,7 @@ static const char *help_msg_panels[] = {
"o", "go/seek to given offset",
"pP", "seek to next or previous scr.nkey",
"q", "quit, back to visual mode",
"r", "toggle jmphints/leahints",
"r", "toggle callhints/jmphints/leahints",
"sS", "step in / step over",
"uU", "undo / redo seek",
"w", "start Window mode",
@ -3855,8 +3855,16 @@ repeat:
setRefreshAll (panels, true);
break;
case 'r':
r_core_cmd0 (core, "e!asm.hint.jmp");
r_core_cmd0 (core, "e!asm.hint.lea");
if (r_config_get_i (core->config, "asm.hint.call")) {
r_core_cmd0 (core, "e!asm.hint.call");
r_core_cmd0 (core, "e!asm.hint.jmp");
} else if (r_config_get_i (core->config, "asm.hint.jmp")) {
r_core_cmd0 (core, "e!asm.hint.jmp");
r_core_cmd0 (core, "e!asm.hint.lea");
} else if (r_config_get_i (core->config, "asm.hint.lea")) {
r_core_cmd0 (core, "e!asm.hint.lea");
r_core_cmd0 (core, "e!asm.hint.call");
}
setRefreshAll (panels, false);
break;
case 'R':

View File

@ -279,7 +279,7 @@ static const char *help_msg_visual[] = {
"O", "toggle asm.pseudo and asm.esil",
"p/P", "rotate print modes (hex, disasm, debug, words, buf)",
"q", "back to radare shell",
"r", "toggle jmphints/leahints",
"r", "toggle callhints/jmphints/leahints",
"R", "randomize color palette (ecr)",
"sS", "step / step over",
"tT", "tt new tab, t[1-9] switch to nth tab, t= name tab, t- close tab",
@ -2681,15 +2681,15 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
break;
case 'r':
// TODO: toggle shortcut hotkeys
if (r_config_get_i (core->config, "asm.hint.jmp")) {
if (r_config_get_i (core->config, "asm.hint.call")) {
r_core_cmd0 (core, "e!asm.hint.call");
r_core_cmd0 (core, "e!asm.hint.jmp");
} else if (r_config_get_i (core->config, "asm.hint.jmp")) {
r_core_cmd0 (core, "e!asm.hint.jmp");
r_core_cmd0 (core, "e!asm.hint.call");
} else if (r_config_get_i (core->config, "asm.hint.call")) {
r_core_cmd0 (core, "e!asm.hint.call");
r_core_cmd0 (core, "e!asm.hint.lea");
} else if (r_config_get_i (core->config, "asm.hint.lea")) {
r_core_cmd0 (core, "e!asm.hint.lea");
r_core_cmd0 (core, "e!asm.hint.jmp");
r_core_cmd0 (core, "e!asm.hint.call");
}
visual_refresh (core);
break;