diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-05-27 18:39:56 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-05-27 18:39:56 +0000 |
commit | 8ee76a8d4bc70282a00eb456d70adbcef2f02c38 (patch) | |
tree | 68bf32ee537f2e31766ddc4d8d716ea60c1f5c50 /gcc/print-tree.c | |
parent | 098ab36a5a324a27b0826960a0291748afdfa5dc (diff) | |
download | gcc-8ee76a8d4bc70282a00eb456d70adbcef2f02c38.tar.gz |
* print-tree.c (debug_vec_tree): New fn.
(print_vec_tree): New fn.
* tree.h: Declare them.
* gdbinit.in (ptv): New command.
* print-tree.c (print_node) [TREE_VEC]: Print elements normally.
* gdbinit.in (pdd): New command.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159941 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/print-tree.c')
-rw-r--r-- | gcc/print-tree.c | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/gcc/print-tree.c b/gcc/print-tree.c index f1a2455b396..0c2318851be 100644 --- a/gcc/print-tree.c +++ b/gcc/print-tree.c @@ -60,6 +60,20 @@ debug_tree (tree node) putc ('\n', stderr); } +/* Print the vector of trees VEC on standard error, for debugging. + Most nodes referred to by this one are printed recursively + down to a depth of six. */ + +void +debug_vec_tree (VEC(tree,gc) *vec) +{ + table = XCNEWVEC (struct bucket *, HASH_SIZE); + print_vec_tree (stderr, "", vec, 0); + free (table); + table = 0; + putc ('\n', stderr); +} + /* Print PREFIX and ADDR to FILE. */ void dump_addr (FILE *file, const char *prefix, const void *addr) @@ -860,8 +874,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent) { char temp[10]; sprintf (temp, "elt %d", i); - indent_to (file, indent + 4); - print_node_brief (file, temp, TREE_VEC_ELT (node, i), 0); + print_node (file, temp, TREE_VEC_ELT (node, i), indent + 4); } break; @@ -979,3 +992,27 @@ print_node (FILE *file, const char *prefix, tree node, int indent) fprintf (file, ">"); } + +/* Print the tree vector VEC in full on file FILE, preceded by PREFIX, + starting in column INDENT. */ + +void +print_vec_tree (FILE *file, const char *prefix, VEC(tree,gc) *vec, int indent) +{ + tree elt; + unsigned ix; + + /* Indent to the specified column, since this is the long form. */ + indent_to (file, indent); + + /* Print the slot this node is in, and its code, and address. */ + fprintf (file, "%s <VEC", prefix); + dump_addr (file, " ", vec); + + for (ix = 0; VEC_iterate (tree, vec, ix, elt); ++ix) + { + char temp[10]; + sprintf (temp, "elt %d", ix); + print_node (file, temp, elt, indent + 4); + } +} |