Re: RFA: PATCH to restore old behavior of debug_vec_tree

2013-07-09 Thread Lawrence Crowl
On 7/8/13, Jason Merrill ja...@redhat.com wrote:
 Lawrence's overhaul of the debug() functions changed the behavior of the
 pvt macro in gdbinit.in.  Previously it used print_node to dump each of
 the elements of the vector, but after the change it uses debug, which
 both prints less information by default and fails to handle many C++
 tree nodes.

 Fixed by adding debug_raw for vectree,va_gc and changing
 debug_vec_tree to use that.

 OK for trunk?

Looks good to me.

-- 
Lawrence Crowl


RFA: PATCH to restore old behavior of debug_vec_tree

2013-07-08 Thread Jason Merrill
Lawrence's overhaul of the debug() functions changed the behavior of the 
pvt macro in gdbinit.in.  Previously it used print_node to dump each of 
the elements of the vector, but after the change it uses debug, which 
both prints less information by default and fails to handle many C++ 
tree nodes.


Fixed by adding debug_raw for vectree,va_gc and changing 
debug_vec_tree to use that.


OK for trunk?
commit 682cd181d980513bc1ecd30874c5c2aaceb3b725
Author: Jason Merrill ja...@redhat.com
Date:   Mon Jul 8 16:02:50 2013 -0400

	* print-tree.c (debug_vec_tree): Use debug_raw.
	(debug_raw (vectree, va_gc )): New.
	(debug_raw (vectree, va_gc *)): New.
	* tree.h: Declare them.

diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index 689eeb9..029c3a2 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -1097,26 +1097,37 @@ debug_body (const tree_node *ptr)
down to a depth of six.  */
 
 DEBUG_FUNCTION void
-debug_vec_tree (vectree, va_gc *vec)
+debug_raw (vectree, va_gc ref)
 {
   tree elt;
   unsigned ix;
 
   /* Print the slot this node is in, and its code, and address.  */
   fprintf (stderr, VEC);
-  dump_addr (stderr,  , vec-address ());
+  dump_addr (stderr,  , ref.address ());
 
-  FOR_EACH_VEC_ELT (*vec, ix, elt)
+  FOR_EACH_VEC_ELT (ref, ix, elt)
 {
   fprintf (stderr, elt %d , ix);
-  debug (elt);
+  debug_raw (elt);
 }
 }
 
 DEBUG_FUNCTION void
 debug (vectree, va_gc ref)
 {
-  debug_vec_tree (ref);
+  tree elt;
+  unsigned ix;
+
+  /* Print the slot this node is in, and its code, and address.  */
+  fprintf (stderr, VEC);
+  dump_addr (stderr,  , ref.address ());
+
+  FOR_EACH_VEC_ELT (ref, ix, elt)
+{
+  fprintf (stderr, elt %d , ix);
+  debug (elt);
+}
 }
 
 DEBUG_FUNCTION void
@@ -1127,3 +1138,18 @@ debug (vectree, va_gc *ptr)
   else
 fprintf (stderr, nil\n);
 }
+
+DEBUG_FUNCTION void
+debug_raw (vectree, va_gc *ptr)
+{
+  if (ptr)
+debug_raw (*ptr);
+  else
+fprintf (stderr, nil\n);
+}
+
+DEBUG_FUNCTION void
+debug_vec_tree (vectree, va_gc *vec)
+{
+  debug_raw (vec);
+}
diff --git a/gcc/tree.h b/gcc/tree.h
index 6297b49..0058a4b 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -6025,6 +6025,8 @@ extern void debug_body (const tree_node *ptr);
 extern void debug_vec_tree (vectree, va_gc *);
 extern void debug (vectree, va_gc ref);
 extern void debug (vectree, va_gc *ptr);
+extern void debug_raw (vectree, va_gc ref);
+extern void debug_raw (vectree, va_gc *ptr);
 #ifdef BUFSIZ
 extern void dump_addr (FILE*, const char *, const void *);
 extern void print_node (FILE *, const char *, tree, int);