Yay, today I wrote a C snippet to work with the Vala API to create a GtkWindow
with
a grava widget (graph) creating two nodes and one edge.
The code analysis module seems to work fine on x86 now, and you can use ".:pC"
command
to flag all code blocks. Remember:
. -> interpret
: -> drop verbosity (put pC in raw output mode)
pC -> analyze code from current seek and show radare commands to stdout (no
verbose)
Taking care of the program_t and using this api its bastly simple to create a
graph of
the code. So I expect to have this stuff finished this week.
Here's the source:
To compile it:
$ valac gravac.c --save-temps *.vala --pkg gtk+-2.0 --pkg cairo -o a.out
#include "widget.h"
#include "node.h"
#include "edge.h"
int main(int argc, char **argv)
{
GtkWindow *w;
GravaNode *node, *node2;
GravaEdge *edge;
GravaWidget *grava;
gtk_init(&argc, &argv);
grava = grava_widget_new();
node = grava_node_new();
grava_node_set(node, "label", "foo:");
grava_node_set(node, "body", "mov eax, 33\nxor ebx, ebx");
grava_graph_add_node(grava->graph, node);
node2 = grava_node_new();
grava_node_set(node2, "label", "bar:");
grava_node_set(node2, "body", "mov eax, 33\nxor ebx, ebx");
grava_graph_add_node(grava->graph, node2);
edge = grava_edge_with(grava_edge_new(), node, node2);
grava_graph_add_edge(grava->graph, edge);
grava_graph_update(grava->graph);
w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_container_add(w, grava_widget_get_widget(grava));
gtk_widget_show_all(w);
gtk_main();
}
--pancake
_______________________________________________
radare mailing list
[email protected]
https://lists.nopcode.org/mailman/listinfo/radare