Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
pancake | a5ef4bbd10 | |
pancake | 86e0f2c009 |
|
@ -1841,8 +1841,10 @@ static int get_edge_number(const RAGraph *g, RANode *src, RANode *dst, bool outg
|
|||
RANode *v;
|
||||
|
||||
if (outgoing && src->is_dummy) {
|
||||
if (src->gnode) {
|
||||
RANode *in = (RANode *) (((RGraphNode *)r_list_first ((src->gnode)->in_nodes))->data);
|
||||
cur_nth = get_edge_number (g, in, src, outgoing);
|
||||
}
|
||||
} else {
|
||||
const RList *neighbours = outgoing
|
||||
? r_graph_get_neighbours (g->graph, src->gnode)
|
||||
|
@ -3260,7 +3262,8 @@ static void agraph_print_edges(RAGraph *g) {
|
|||
|
||||
if (tt) {
|
||||
int arg = (rightlen < leftlen)? maxx + 1: minx - 1;
|
||||
r_cons_canvas_line_back_edge (g->can, temp->ax, temp->ay, temp->bx, temp->by, &(temp->style), temp->edgectr, arg, tt->revedgectr, !g->layout);
|
||||
r_cons_canvas_line_back_edge (g->can, temp->ax, temp->ay, temp->bx, temp->by,
|
||||
&(temp->style), temp->edgectr, arg, tt->revedgectr, !g->layout);
|
||||
}
|
||||
|
||||
r_list_foreach (lyr, ito, tl) {
|
||||
|
@ -3468,6 +3471,10 @@ static void agraph_prev_node(RAGraph *g) {
|
|||
|
||||
static void agraph_update_title(RCore *core, RAGraph *g, RAnalFunction *fcn) {
|
||||
RANode *a = get_anode (g->curnode);
|
||||
if (!a) {
|
||||
return;
|
||||
}
|
||||
eprintf ("GET NODE %p\n", a);
|
||||
char *sig = r_core_cmd_str (core, "afcf");
|
||||
char *new_title = r_str_newf (
|
||||
"%s[0x%08"PFMT64x "]> %s # %s ",
|
||||
|
@ -4422,16 +4429,16 @@ static void nextword(RCore *core, RAGraph *g, const char *word) {
|
|||
free (gh->old_word);
|
||||
gh->old_word = strdup (word);
|
||||
free (s);
|
||||
if (!a && count == 0) {
|
||||
return;
|
||||
}
|
||||
if (a || count > 0) {
|
||||
nextword (core, g, word);
|
||||
}
|
||||
}
|
||||
|
||||
R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int is_interactive) {
|
||||
R_API bool r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int mode) {
|
||||
bool is_interactive = (mode != 0);
|
||||
if (is_interactive && !r_cons_is_interactive ()) {
|
||||
eprintf ("Interactive graph mode requires scr.interactive=true.\n");
|
||||
return 0;
|
||||
R_LOG_ERROR ("Interactive graph mode requires 'e scr.interactive=true'");
|
||||
return false;
|
||||
}
|
||||
r_cons_set_raw (true);
|
||||
int o_asmqjmps_letter = core->is_asmqjmps_letter;
|
||||
|
@ -4486,7 +4493,7 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
|
|||
r_config_hold_free (hc);
|
||||
return false;
|
||||
}
|
||||
g->is_tiny = is_interactive == 2;
|
||||
g->is_tiny = mode == 2;
|
||||
g->layout = r_config_get_i (core->config, "graph.layout");
|
||||
g->dummy = r_config_get_i (core->config, "graph.dummy");
|
||||
g->show_node_titles = r_config_get_i (core->config, "graph.ntitles");
|
||||
|
@ -4545,21 +4552,21 @@ R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int
|
|||
core->cons->event_resize = (RConsEvent) agraph_refresh_oneshot;
|
||||
|
||||
r_cons_break_push (NULL, NULL);
|
||||
#if 0
|
||||
// XXX wrong usage or buggy RGraph.domTree()
|
||||
if (mode == 3) { // XXX wrong usage or buggy RGraph.domTree()
|
||||
// dominance tree here
|
||||
const RList *l = r_graph_get_nodes (g->graph);
|
||||
RGraphNode *root = r_list_first (l);
|
||||
if (root) {
|
||||
RGraph *dg = r_graph_dom_tree (g->graph, root);
|
||||
if (dg) {
|
||||
// XXX double free - r_graph_free (g->graph);
|
||||
g->graph = dg;
|
||||
} else {
|
||||
R_LOG_WARN ("Cannot compute the dominance tree");
|
||||
sleep (1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
while (!exit_graph && !is_error && !r_cons_is_breaked ()) {
|
||||
w = r_cons_get_size (&h);
|
||||
|
|
|
@ -789,6 +789,7 @@ static RCoreHelpMessage help_msg_ag = {
|
|||
"agc", "[format]", "function callgraph",
|
||||
"agC", "[format]", "global callgraph",
|
||||
"agd", "[format] [fcn addr]", "diff graph",
|
||||
"agD", "[format]", "function dom graph",
|
||||
"agf", "[format]", "basic blocks function graph",
|
||||
"agi", "[format]", "imports graph",
|
||||
"agr", "[format]", "references graph",
|
||||
|
@ -12088,10 +12089,13 @@ static void cmd_anal_graph(RCore *core, const char *input) {
|
|||
return;
|
||||
}
|
||||
switch (input[0]) {
|
||||
case 'D': // "agD"-> dom function graph
|
||||
r_core_visual_graph (core, NULL, NULL, 3); // 3 means dom graph
|
||||
break;
|
||||
case 'f': // "agf"
|
||||
switch (input[1]) {
|
||||
case 0: // "agf"
|
||||
r_core_visual_graph (core, NULL, NULL, false);
|
||||
r_core_visual_graph (core, NULL, NULL, 0);
|
||||
break;
|
||||
case 'b': // "agfb" // braile
|
||||
cmd_agfb (core);
|
||||
|
|
|
@ -536,7 +536,7 @@ R_API int r_core_visual_anal_classes(RCore *core);
|
|||
R_API int r_core_visual_types(RCore *core);
|
||||
R_API int r_core_visual(RCore *core, const char *input);
|
||||
R_API void r_core_visual_find(RCore *core, RAGraph *g);
|
||||
R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int is_interactive);
|
||||
R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int mode);
|
||||
R_API void r_core_visual_browse(RCore *core, const char *arg);
|
||||
R_API int r_core_visual_cmd(RCore *core, const char *arg);
|
||||
R_API void r_core_visual_seek_animation(RCore *core, ut64 addr);
|
||||
|
|
|
@ -146,22 +146,19 @@ R_API void r_graph_reset(RGraph *t) {
|
|||
return;
|
||||
}
|
||||
t->nodes->free = (RListFree)r_graph_node_free;
|
||||
t->n_nodes = 0;
|
||||
t->n_nodes = 0; // XXX isnt r_list_length enough?
|
||||
t->n_edges = 0;
|
||||
t->last_index = 0;
|
||||
}
|
||||
|
||||
R_API RGraphNode *r_graph_add_node(RGraph *t, void *data) {
|
||||
if (!t) {
|
||||
return NULL;
|
||||
}
|
||||
r_return_val_if_fail (t && data, NULL);
|
||||
RGraphNode *n = r_graph_node_new (data);
|
||||
if (!n) {
|
||||
return NULL;
|
||||
}
|
||||
if (n) {
|
||||
n->idx = t->last_index++;
|
||||
r_list_append (t->nodes, n);
|
||||
t->n_nodes++;
|
||||
t->n_nodes++; /// istn r_list_length enough?
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue