https://gcc.gnu.org/g:c028b7c645514cfbd682bef364734314c01745d6

commit r17-815-gc028b7c645514cfbd682bef364734314c01745d6
Author: Paul-Antoine Arras <[email protected]>
Date:   Wed May 6 20:07:44 2026 +0200

    Fortran: Add debug functions for OpenMP data structures
    
    show_omp_namelist and show_omp_clauses cannot be called from GDB because
    dumpfile is NULL at debug time. Add debug wrappers that temporarily set it 
to
    stderr.
    
    gcc/fortran/ChangeLog:
    
            * dump-parse-tree.cc (debug): Add debug functions for 
gfc_omp_namelist
            and gfc_omp_clauses.

Diff:
---
 gcc/fortran/dump-parse-tree.cc | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gcc/fortran/dump-parse-tree.cc b/gcc/fortran/dump-parse-tree.cc
index ea878099da53..e7bfa480a2c6 100644
--- a/gcc/fortran/dump-parse-tree.cc
+++ b/gcc/fortran/dump-parse-tree.cc
@@ -4722,3 +4722,25 @@ debug (gfc_array_ref *ar)
   fputc ('\n', dumpfile);
   dumpfile = tmp;
 }
+
+/* Dump OpenMP data structures.  */
+
+DEBUG_FUNCTION void
+debug (gfc_omp_namelist *n)
+{
+  FILE *tmp = dumpfile;
+  dumpfile = stderr;
+  show_omp_namelist (OMP_LIST_MAP, n);
+  fputc ('\n', dumpfile);
+  dumpfile = tmp;
+}
+
+DEBUG_FUNCTION void
+debug (gfc_omp_clauses *clauses)
+{
+  FILE *tmp = dumpfile;
+  dumpfile = stderr;
+  show_omp_clauses (clauses);
+  fputc ('\n', dumpfile);
+  dumpfile = tmp;
+}

Reply via email to