diff --git a/libr/anal/xrefs.c b/libr/anal/xrefs.c index cabbaae78f..4845841555 100644 --- a/libr/anal/xrefs.c +++ b/libr/anal/xrefs.c @@ -188,6 +188,36 @@ static int xrefs_list_cb_rad(RAnal *anal, const char *k, const char *v) { return 1; } +static int xrefs_list_cb_quiet(RAnal *anal, const char *k, const char *v) { + ut64 dst, src = r_num_get (NULL, v); + if (!strncmp (k, "ref.", 4)) { + const char *p = r_str_rchr (k, NULL, '.'); + if (p) { + dst = r_num_get (NULL, p + 1); + char * type = strchr (k, '.'); + if (type) { + type ++; + type = strdup (type); + char *t = strchr (type, '.'); + if (t) { + *t = ' '; + } + t = (char *)r_str_rchr (type, NULL, '.'); + if (t) { + t = (char *)r_str_rchr (t, NULL, '.'); + if (t) { + *t = 0; + anal->cb_printf ("0x%"PFMT64x" -> 0x%"PFMT64x" %s\n", src, dst, type); + } + } + free (type); + } + + } + } + return 1; +} + static bool xrefs_list_cb_json(RAnal *anal, bool is_first, const char *k, const char *v) { ut64 dst, src = r_num_get (NULL, v); if (strlen (k) > 8) { @@ -217,6 +247,9 @@ R_API void r_anal_xrefs_list(RAnal *anal, int rad) { case '*': sdb_foreach (DB, (SdbForeachCallback)xrefs_list_cb_rad, anal); break; + case 'q': + sdb_foreach (DB, (SdbForeachCallback)xrefs_list_cb_quiet, anal); + break; case 'j': { anal->cb_printf ("{"); diff --git a/libr/core/cmd_anal.c b/libr/core/cmd_anal.c index 75796b7ef3..c28c66d8f5 100644 --- a/libr/core/cmd_anal.c +++ b/libr/core/cmd_anal.c @@ -4004,6 +4004,7 @@ static bool cmd_anal_refs(RCore *core, const char *input) { "axC", " addr [at]", "add code call ref", "axg", " addr", "show xrefs graph to reach current function", "axd", " addr [at]", "add data ref", + "axq", "", "list refs in quiet/human-readable format", "axj", "", "list refs in json format", "axF", " [flg-glob]", "find data/code references of flags", "axt", " [addr]", "find data/code references to this address", @@ -4067,6 +4068,7 @@ static bool cmd_anal_refs(RCore *core, const char *input) { break; case '\0': // "ax" case 'j': // "axj" + case 'q': // "axq" case '*': // "ax*" r_core_anal_ref_list (core, input[0]); break;