dtc now uses r_cons_printf

This commit is contained in:
pancake 2013-03-03 05:47:33 +01:00
parent ab32c7bb95
commit b45f07a39a
4 changed files with 11 additions and 5 deletions

View File

@ -761,6 +761,8 @@ static int cmd_debug(void *data, const char *input) {
if (r_cons_singleton ()->breaked)
break;
r_debug_step (core->dbg, 1);
if (r_debug_is_dead (core->dbg))
break;
if (checkbpcallback (core)) {
eprintf ("Interrupted by a breakpoint\n");
break;

View File

@ -502,6 +502,8 @@ R_API int r_core_init(RCore *core) {
r_core_cmd_init (core);
core->flags = r_flag_new ();
core->dbg = r_debug_new (R_TRUE);
core->dbg->graph->printf = (PrintfCallback)r_cons_printf;
core->dbg->printf = (PrintfCallback)r_cons_printf;
core->dbg->anal = core->anal; // XXX: dupped instance.. can cause lost pointerz
//r_debug_use (core->dbg, "native");
r_reg_arena_push (core->dbg->reg); // create a 2 level register state stack

View File

@ -197,6 +197,7 @@ typedef struct r_graph_t {
RList *roots; // <RGraphNode>
RListIter *cur; // ->data = RGraphNode*
RList *nodes; // <RGraphNode>
PrintfCallback printf;
int level;
} RGraph;

View File

@ -44,13 +44,13 @@ static void walk_children (RGraph *t, RGraphNode *tn, int level) {
return;
}
for (i=0; i<level; i++)
eprintf (" ");
eprintf ("%d: 0x%08"PFMT64x" refs %d\n",
level, tn->addr, tn->refs);
t->printf (" ");
t->printf (" 0x%08"PFMT64x" refs %d\n",
tn->addr, tn->refs);
r_list_foreach (tn->parents, iter, n) {
for (i=0; i<level; i++)
eprintf (" ");
eprintf (" ^ 0x%08"PFMT64x"\n", n->addr);
t->printf (" ");
t->printf (" |_ 0x%08"PFMT64x"\n", n->addr);
}
r_list_push (t->path, tn);
r_list_foreach (tn->children, iter, n) {
@ -73,6 +73,7 @@ R_API void r_graph_traverse(RGraph *t) {
R_API RGraph * r_graph_new () {
RGraph *t = R_NEW0 (RGraph);
t->printf = printf;
t->path = r_list_new ();
t->nodes = r_list_new ();
t->roots = r_list_new ();