And playing a bit with the Grava api i just make it render the graphviz
output inside the view as a separate layer...so if you pan the view the
nodes scroll faster than the image (like in videogames or so :P) here's
a shot of the preview:

http://news.nopcode.org/g.png

I have just added a small function to export a code analysis in dot
format to feed graphviz... i just want to play a bit with it to make the
graph interface better...let's see how to walk a graph:

int graph_viz(struct program_t *prg)
{
        struct block_t *b0;
        struct list_head *head;

        cons_printf("digraph code {\n");
        cons_printf("\tnode [color=lightblue2, style=filled];\n");
        list_for_each_prev(head, &(prg->blocks)) {
                b0 = list_entry(head, struct block_t, list);
                if (b0->tnext)
                        cons_printf("\t\"0x%08llx\" -> \"0x%08llx\";\n",
                            b0->addr, b0->tnext);
                if (b0->fnext)
                        cons_printf("\t\"0x%08llx\" -> \"0x%08llx\";\n",
                            b0->addr, b0->fnext);
                if (!b0->tnext && !b0->fnext)
                        cons_printf("\t\"0x%08llx\";\n", b0->addr);
        }
        cons_printf("}\n");
}


simple huh? :)

then we just generate the analysis and call this function from the 'ag.'
command:

prg = code_analyze(config.baddr + config.seek, depth );
graph_viz(prg);

pretty stupid huh? :)

If you want to test this. just pull the last version and type:

$ radare -d ls
> !step 3
> ag. > foo.gv && dot -Tpng -o foo.png foo.gv && gqview foo.png

Working with graphs and so is quite stupid and simple..but withotu a
decent frontend it is pretty useless... i will work on this a bit for
the 1.0.. i think it is an important point.

--pancake
_______________________________________________
radare mailing list
[email protected]
http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org

Reply via email to