Ejemplo n.º 1
0
/*  Dumping the tree.
    */
void
dwarf_tdump(const void*headp_in,
            char *(* keyprint)(const void *),
            const char *msg)
{
    const struct hs_base *head = (const struct hs_base *)headp_in;
    if(!head) {
        printf("dumptree null tree ptr : %s\n",msg);
        return;
    }
    dumptree_inner(head,keyprint,msg,1);
}
Ejemplo n.º 2
0
/* For debugging. This prints the nodes with the parent (in each case)
   in between the children.  So it is a tree with root at the left. */
static void
dumptree_inner(const struct ts_entry *t,
    char *(* keyprint)(const void *),
    const char *descr, int level)
{
    char *v = "";
    if(!t) {
        return;
    }
    dumptree_inner(t->rlink,keyprint,"left ",level+1);
    if(t->keyptr) {
        v = keyprint(t->keyptr);
    }
    printlevel(level);
    printf("0x%08x <keyptr 0x%08x> <%s %s> <l 0x%08x> <r 0x%08x> %s\n",
        (unsigned)t,
        (unsigned)t->keyptr,
        t->keyptr?"key ":"null",
        v,
        (unsigned)t->llink,(unsigned)t->rlink,
        descr);
    dumptree_inner(t->llink,keyprint,"right",level+1);
}
Ejemplo n.º 3
0
/*  Dumping the tree to stdout. */
void
dwarf_tdump(const void*rootin,
    char *(* keyprint)(const void *),
    const char *msg)
{
    const struct ts_entry *head = (const struct ts_entry *)rootin;
    const struct ts_entry *root = 0;
    if(!head) {
        printf("dwarf_tdump null tree ptr : %s\n",msg);
        return;
    }
    root = head->rlink;
    if(!root) {
        printf("dwarf_tdump empty tree : %s\n",msg);
        return;
    }
    printf("dwarf_tdump tree head : 0x%08lx %s\n",(unsigned long)head,msg);
    printf("dwarf_tdump tree root : 0x%08lx %s\n",(unsigned long)root,msg);
    dumptree_inner(root,keyprint,"top",0);
}