Skip to content

Commit

Permalink
Updated ag? help
Browse files Browse the repository at this point in the history
Fixed segfault in r_str_trunc_ellipsis()

Fix agC* command

Fix callgraph bug not resetting is_callgraph
  • Loading branch information
cyanpencil authored and radare committed May 22, 2018
1 parent fc82e86 commit 9936a1d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion libr/core/cmd_anal.c
Expand Up @@ -388,6 +388,9 @@ static const char *help_msg_ag[] = {
"aga", "[format] [fcn addr]", "Data references graph",
"agd", "[format] [fcn addr]", "Diff graph",
"agi", "[format]", "Imports graph",
"agC", "[format]", "Global callgraph",
"agR", "[format]", "Global references graph",
"agA", "[format]", "Global data references graph",
"agg", "[format]", "Custom graph",
"ag-", "", "Clear the custom graph",
"agn", "[?] title body", "Add a node to the custom graph",
Expand Down Expand Up @@ -5894,11 +5897,12 @@ static void cmd_anal_graph(RCore *core, const char *input) {
case ' ':
case 0: {
core->graph->is_callgraph = true;
char *cmd = r_str_newf ("ag-; .agc* %lld; agg%c;", UT64_MAX, input[1]);
char *cmd = r_str_newf ("ag-; .agC*; agg%c;", input[1]);
if (cmd && *cmd) {
r_core_cmd0 (core, cmd);
}
free (cmd);
core->graph->is_callgraph = false;
break;
}
case 'J':
Expand Down Expand Up @@ -6046,12 +6050,14 @@ static void cmd_anal_graph(RCore *core, const char *input) {
if (cmd && *cmd) {
r_core_cmd0 (core, cmd);
}
core->graph->is_callgraph = false;
free (cmd);
break;
}
case 0:
core->graph->is_callgraph = true;
r_core_cmd0 (core, "ag-; .agc* $$; agg;");
core->graph->is_callgraph = false;
break;
case 'g': {
ut64 addr = input[2] ? r_num_math (core->num, input + 2): core->offset;
Expand Down
2 changes: 1 addition & 1 deletion libr/core/graph.c
Expand Up @@ -3429,7 +3429,7 @@ R_API RANode *r_agraph_get_first_node(const RAGraph *g) {
}

R_API RANode *r_agraph_get_node(const RAGraph *g, const char *title) {
char *title_trunc = r_str_trunc_ellipsis (title, 255);
char *title_trunc = title ? r_str_trunc_ellipsis (title, 255) : NULL;
RANode *node = (RANode *) (size_t) sdb_num_get (g->nodes, title_trunc, NULL);
free (title_trunc);
return node;
Expand Down

0 comments on commit 9936a1d

Please sign in to comment.