From 4e8e66a6cca661ac9995af880dff5b71e66ed126 Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 15 May 2017 01:28:28 +0200 Subject: [PATCH] Show offset in psb and add psbq to only print strings --- libr/core/cmd_print.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libr/core/cmd_print.c b/libr/core/cmd_print.c index 8b44694db1..2a03da24e4 100644 --- a/libr/core/cmd_print.c +++ b/libr/core/cmd_print.c @@ -1252,10 +1252,10 @@ R_API void r_core_print_examine(RCore *core, const char *str) { "Size letters are b(byte), h(halfword), w(word), g(giant, 8 bytes).\n" ); break; - case 's': + case 's': // "x/s" r_core_cmdf (core, "psb %d @ 0x%"PFMT64x, count * size, addr); break; - case 'o': + case 'o': // "x/o" r_core_cmdf (core, "pxo %d @ 0x%"PFMT64x, count * size, addr); break; case 'f': @@ -3790,10 +3790,14 @@ static int cmd_print(void *data, const char *input) { break; case 'b': // "psb" if (l > 0) { + int quiet = input[2] == 'q'; // "psbq" char *s = malloc (core->blocksize + 1); int i, j, hasnl = 0;; if (s) { memset (s, 0, core->blocksize); + if (!quiet) { + r_print_offset (core->print, core->offset, 0, 0, 0, 0, NULL); + } // TODO: filter more chars? for (i = j = 0; i < core->blocksize; i++) { char ch = (char) core->block[i]; @@ -3802,6 +3806,9 @@ static int cmd_print(void *data, const char *input) { s[j] = 0; if (*s) { r_cons_println (s); + if (!quiet) { + r_print_offset (core->print, core->offset + i, 0, 0, 0, 0, NULL); + } } j = 0; s[0] = 0;