From 435c7524ef4832101640cc2e0b4a7d6186e4fc4e Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 18 Dec 2017 02:02:29 +0100 Subject: [PATCH] Implement @.. for temporary partial address seeks --- libr/core/cmd.c | 14 +++++++++++--- libr/core/cmd_print.c | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/libr/core/cmd.c b/libr/core/cmd.c index 4ad662d7fe..1d07acbc12 100644 --- a/libr/core/cmd.c +++ b/libr/core/cmd.c @@ -2199,6 +2199,16 @@ repeat_arroba: if (ptr[1] == '?') { r_core_cmd_help (core, help_msg_at); + } else if (ptr[1] == '.') { // "@." + if (ptr[2] == '.') { + addr = r_num_tail (core->num, core->offset, ptr + 3); + r_core_seek (core, addr, 1); + core->tmpseek = true; + goto fuji; + } else { + // WAT DU + eprintf ("TODO: what do you expect for @. import offset from file maybe?\n"); + } } else if (ptr[0] && ptr[1] == ':' && ptr[2]) { usemyblock = true; switch (ptr[0]) { @@ -2369,7 +2379,6 @@ next_arroba: goto repeat_arroba; } if (ptr[1] == '@') { - // TODO: remove temporally seek (should be done by cmd_foreach) if (ptr[2] == '@') { char *rule = ptr + 3; while (*rule && *rule == ' ') rule++; @@ -2377,7 +2386,6 @@ next_arroba: } else { ret = r_core_cmd_foreach (core, cmd, ptr + 2); } - //ret = -1; /* do not run out-of-foreach cmd */ } else { bool tmpseek = false; const char *fromvars[] = { "anal.from", "diff.from", "graph.from", @@ -2467,7 +2475,7 @@ next_arroba: rc = ret; goto beach; } - +fuji: rc = cmd? r_cmd_call (core->rcmd, r_str_trim_head (cmd)): false; beach: r_cons_grep_process (grep); diff --git a/libr/core/cmd_print.c b/libr/core/cmd_print.c index df4d6e1915..2615eb74bc 100644 --- a/libr/core/cmd_print.c +++ b/libr/core/cmd_print.c @@ -53,6 +53,7 @@ static const char *help_msg_at[] = { "~", "word:3[0]", "grep 1st column from the 4th line matching word", "@", " 0x1024", "temporary seek to this address (sym.main+3)", "@", " [addr]!blocksize", "temporary set a new blocksize", + "@..", "addr", "temporary partial address seek (see s..)", "@a:", "arch[:bits]", "temporary set arch and bits", "@b:", "bits", "temporary set asm.bits", "@e:", "k=v,k=v", "temporary change eval vars",