Commit 05ec8351 authored by Rusty Russell's avatar Rusty Russell

tal: tal_dump() now prints to stderr.

This is more widely available than stdout, which can interfere with
other things.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent ec95c3c5
...@@ -824,36 +824,36 @@ static void dump_node(unsigned int indent, const struct tal_hdr *t) ...@@ -824,36 +824,36 @@ static void dump_node(unsigned int indent, const struct tal_hdr *t)
const struct prop_hdr *p; const struct prop_hdr *p;
for (i = 0; i < indent; i++) for (i = 0; i < indent; i++)
printf(" "); fprintf(stderr, " ");
printf("%p len=%zu", t, t->bytelen); fprintf(stderr, "%p len=%zu", t, t->bytelen);
for (p = t->prop; p; p = p->next) { for (p = t->prop; p; p = p->next) {
struct children *c; struct children *c;
struct name *n; struct name *n;
struct notifier *no; struct notifier *no;
if (is_literal(p)) { if (is_literal(p)) {
printf(" \"%s\"", (const char *)p); fprintf(stderr, " \"%s\"", (const char *)p);
break; break;
} }
switch (p->type) { switch (p->type) {
case CHILDREN: case CHILDREN:
c = (struct children *)p; c = (struct children *)p;
printf(" CHILDREN(%p):parent=%p,children={%p,%p}\n", fprintf(stderr, " CHILDREN(%p):parent=%p,children={%p,%p}\n",
p, c->parent, p, c->parent,
c->children.n.prev, c->children.n.next); c->children.n.prev, c->children.n.next);
break; break;
case NAME: case NAME:
n = (struct name *)p; n = (struct name *)p;
printf(" NAME(%p):%s", p, n->name); fprintf(stderr, " NAME(%p):%s", p, n->name);
break; break;
case NOTIFIER: case NOTIFIER:
no = (struct notifier *)p; no = (struct notifier *)p;
printf(" NOTIFIER(%p):fn=%p", p, no->u.notifyfn); fprintf(stderr, " NOTIFIER(%p):fn=%p", p, no->u.notifyfn);
break; break;
default: default:
printf(" **UNKNOWN(%p):%i**", p, p->type); fprintf(stderr, " **UNKNOWN(%p):%i**", p, p->type);
} }
} }
printf("\n"); fprintf(stderr, "\n");
} }
static void tal_dump_(unsigned int level, const struct tal_hdr *t) static void tal_dump_(unsigned int level, const struct tal_hdr *t)
......
...@@ -456,7 +456,7 @@ bool tal_check(const tal_t *ctx, const char *errorstr); ...@@ -456,7 +456,7 @@ bool tal_check(const tal_t *ctx, const char *errorstr);
#ifdef CCAN_TAL_DEBUG #ifdef CCAN_TAL_DEBUG
/** /**
* tal_dump - dump entire tal tree. * tal_dump - dump entire tal tree to stderr.
* *
* This is a helper for debugging tal itself, which dumps all the tal internal * This is a helper for debugging tal itself, which dumps all the tal internal
* state. * state.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment