Skip to content

Commit

Permalink
Fix graph.from graph.to behaviour
Browse files Browse the repository at this point in the history
Updated graph.from graph.to help

Updated visual help

Removed cmd.graph unused config variable

Whitespace cleanup
  • Loading branch information
cyanpencil authored and radare committed May 23, 2018
1 parent c774c12 commit 8a65873
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
8 changes: 2 additions & 6 deletions libr/core/canal.c
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 2 additions & 6 deletions libr/core/cconfig.c
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand All @@ -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");
Expand Down
12 changes: 10 additions & 2 deletions libr/core/cmd_anal.c
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion libr/core/visual.c
Expand Up @@ -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"
Expand Down

0 comments on commit 8a65873

Please sign in to comment.