diff --git a/libr/core/canal.c b/libr/core/canal.c index 4b00bd32e2b85..9b90f8f1878b1 100644 --- a/libr/core/canal.c +++ b/libr/core/canal.c @@ -1826,10 +1826,10 @@ R_API void r_core_anal_callgraph(RCore *core, ut64 addr, int fmt) { if (base == UT64_MAX) { base = fcni->addr; } - if (from != UT64_MAX && addr < from) { + if (from != UT64_MAX && fcni->addr < from) { continue; } - if (to != UT64_MAX && addr > to) { + if (to != UT64_MAX && fcni->addr > to) { continue; } if (addr != UT64_MAX && addr != fcni->addr) { @@ -2722,10 +2722,6 @@ R_API int r_core_anal_graph(RCore *core, ut64 addr, int opts) { return false; } - eprintf ("%lld\n", addr); - eprintf ("%lld\n", UT64_MAX); - /*return NULL;*/ - r_config_save_num (hc, "asm.lines", "asm.bytes", "asm.dwarf", NULL); //opts |= R_CORE_ANAL_GRAPHBODY; r_config_set_i (core->config, "asm.lines", 0); diff --git a/libr/core/cconfig.c b/libr/core/cconfig.c index f0d95fbf80c5d..6c42455a664d8 100644 --- a/libr/core/cconfig.c +++ b/libr/core/cconfig.c @@ -2719,7 +2719,6 @@ R_API int r_core_config_init(RCore *core) { /* cmd */ - r_config_desc (cfg, "cmd.graph", "Command executed by 'agv' command to view graphs"); SETPREF ("cmd.xterm", "xterm -bg black -fg gray -e", "xterm command to spawn with V@"); SETICB ("cmd.depth", 10, &cb_cmddepth, "Maximum command depth"); SETPREF ("cmd.bp", "", "Run when a breakpoint is hit"); @@ -2824,8 +2823,8 @@ R_API int r_core_config_init(RCore *core) { SETPREF ("graph.font", "Courier", "Font for dot graphs"); SETPREF ("graph.offset", "false", "Show offsets in graphs"); SETPREF ("graph.web", "false", "Display graph in web browser (VV)"); - SETI ("graph.from", UT64_MAX, ""); - SETI ("graph.to", UT64_MAX, ""); + SETI ("graph.from", UT64_MAX, "Lower bound address when drawing global graphs"); + SETI ("graph.to", UT64_MAX, "Upper bound address when drawing global graphs"); SETI ("graph.scroll", 5, "Scroll speed in ascii-art graph"); SETPREF ("graph.invscroll", "false", "Invert scroll direction in ascii-art graph"); SETPREF ("graph.title", "", "Title of the graph"); @@ -2835,9 +2834,6 @@ R_API int r_core_config_init(RCore *core) { SETPREF ("graph.gv.graph", "", "Graphviz global style attributes. (bgcolor=white)"); SETPREF ("graph.gv.current", "false", "Highlight the current node in graphviz graph."); SETPREF ("graph.nodejmps", "true", "Enables shortcuts for every node."); - char *cmd = r_core_graph_cmd (core, "ag $$"); - r_config_set (cfg, "cmd.graph", cmd); - free (cmd); /* hud */ SETPREF ("hud.path", "", "Set a custom path for the HUD file"); diff --git a/libr/core/cmd_anal.c b/libr/core/cmd_anal.c index c92391043cd95..0e4e9a41f28e3 100644 --- a/libr/core/cmd_anal.c +++ b/libr/core/cmd_anal.c @@ -5989,10 +5989,14 @@ static void cmd_anal_graph(RCore *core, const char *input) { break; } case '*': { + ut64 from = r_config_get_i (core->config, "graph.from"); + ut64 to = r_config_get_i (core->config, "graph.to"); RListIter *it; RAnalFunction *fcn; r_list_foreach (core->anal->fcns, it, fcn) { - r_core_anal_coderefs (core, fcn->addr); + if ((from == UT64_MAX && to == UT64_MAX) || R_BETWEEN (from, fcn->addr, to)) { + r_core_anal_coderefs (core, fcn->addr); + } } break; } @@ -6163,10 +6167,14 @@ static void cmd_anal_graph(RCore *core, const char *input) { break; } case '*': { + ut64 from = r_config_get_i (core->config, "graph.from"); + ut64 to = r_config_get_i (core->config, "graph.to"); RListIter *it; RAnalFunction *fcn; r_list_foreach (core->anal->fcns, it, fcn) { - r_core_anal_datarefs (core, fcn->addr); + if ((from == UT64_MAX && to == UT64_MAX) || R_BETWEEN (from, fcn->addr, to)) { + r_core_anal_datarefs (core, fcn->addr); + } } break; } diff --git a/libr/core/visual.c b/libr/core/visual.c index 5085fddbc7c79..83482e523776b 100644 --- a/libr/core/visual.c +++ b/libr/core/visual.c @@ -287,7 +287,7 @@ static int visual_help() { " T enter textlog chat console (TT)\n" " uU undo/redo seek\n" " v visual function/vars code analysis menu\n" - " V (V)iew graph using cmd.graph (agv?)\n" + " V (V)iew interactive ascii art graph (agfv)\n" " wW seek cursor to next/prev word\n" " xX show xrefs/refs of current function from/to data/code\n" " yY copy and paste selection\n"