Add "void debug (tree)" to support:

(gdb) call debug (expr)
 <parm_decl 0x7fffe9810bb0 f
    type <record_type 0x7fffe99cec78 c BLK
        size <integer_cst 0x7fffe98242d0 constant 256>
        unit-size <integer_cst 0x7fffe98243a8 constant 32>
        user align:256 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffe99cebd0
        fields <field_decl 0x7fffe98318c0 a type <real_type 0x7fffe982a3f0 long
double>
            XF x.c:2:15
            size <integer_cst 0x7fffe9802fa8 constant 128>
            unit-size <integer_cst 0x7fffe9802fc0 constant 16>
            align:128 warn_if_not_align:0 offset_align 128 decl_not_flexarray: 1
            offset <integer_cst 0x7fffe9802f90 constant 0>
            bit-offset <integer_cst 0x7fffe9802fd8 constant 0> context <record_t
ype 0x7fffe99cebd0> chain <field_decl 0x7fffe9831960 b>>>
    used read BLK x.c:7:6 size <integer_cst 0x7fffe98242d0 256> unit-size <integ
er_cst 0x7fffe98243a8 32>
    align:256 warn_if_not_align:0 context <function_decl 0x7fffe99d2900 e> arg-t
ype <record_type 0x7fffe99cec78 c>>
(gdb)

PR debug/120849
* print-tree.cc (debug): New.
* print-tree.h (debug): Likewise.

OK for master?

-- 
H.J.
From 2bd201e6aa84b88d8e51b350cfbcdd4730e79688 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.to...@gmail.com>
Date: Sat, 28 Jun 2025 07:32:01 +0800
Subject: [PATCH] Add "void debug (tree)"

Add "void debug (tree)" to support:

(gdb) call debug (expr)
 <parm_decl 0x7fffe9810bb0 f
    type <record_type 0x7fffe99cec78 c BLK
        size <integer_cst 0x7fffe98242d0 constant 256>
        unit-size <integer_cst 0x7fffe98243a8 constant 32>
        user align:256 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffe99cebd0
        fields <field_decl 0x7fffe98318c0 a type <real_type 0x7fffe982a3f0 long double>
            XF x.c:2:15
            size <integer_cst 0x7fffe9802fa8 constant 128>
            unit-size <integer_cst 0x7fffe9802fc0 constant 16>
            align:128 warn_if_not_align:0 offset_align 128 decl_not_flexarray: 1
            offset <integer_cst 0x7fffe9802f90 constant 0>
            bit-offset <integer_cst 0x7fffe9802fd8 constant 0> context <record_type 0x7fffe99cebd0> chain <field_decl 0x7fffe9831960 b>>>
    used read BLK x.c:7:6 size <integer_cst 0x7fffe98242d0 256> unit-size <integer_cst 0x7fffe98243a8 32>
    align:256 warn_if_not_align:0 context <function_decl 0x7fffe99d2900 e> arg-type <record_type 0x7fffe99cec78 c>>
(gdb)

	PR debug/120849
	* print-tree.cc (debug): New.
	* print-tree.h (debug): Likewise.

Signed-off-by: H.J. Lu <hjl.to...@gmail.com>
---
 gcc/print-tree.cc | 6 ++++++
 gcc/print-tree.h  | 1 +
 2 files changed, 7 insertions(+)

diff --git a/gcc/print-tree.cc b/gcc/print-tree.cc
index 63b1f94a1d7..6ec96f0ba17 100644
--- a/gcc/print-tree.cc
+++ b/gcc/print-tree.cc
@@ -1148,6 +1148,12 @@ debug_tree (tree node)
   putc ('\n', stderr);
 }
 
+DEBUG_FUNCTION void
+debug (tree node)
+{
+  debug_tree (node);
+}
+
 DEBUG_FUNCTION void
 debug_raw (const tree_node &ref)
 {
diff --git a/gcc/print-tree.h b/gcc/print-tree.h
index fb729ccddd8..5c613ddb799 100644
--- a/gcc/print-tree.h
+++ b/gcc/print-tree.h
@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3.  If not see
 #define GCC_PRINT_TREE_H
 
 extern void debug_tree (tree);
+extern void debug (tree);
 extern void debug_raw (const tree_node &ref);
 extern void debug_raw (const tree_node *ptr);
 extern void debug (const tree_node &ref);
-- 
2.50.0

Reply via email to