Fortran: Add debug functions for OpenMP data structures

Message ID 20260506181223.190564-1-parras@baylibre.com
State New
Headers
Series Fortran: Add debug functions for OpenMP data structures |

Commit Message

Paul-Antoine Arras May 6, 2026, 6:12 p.m. UTC
  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.
---
 gcc/fortran/dump-parse-tree.cc | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
  

Patch

diff --git a/gcc/fortran/dump-parse-tree.cc b/gcc/fortran/dump-parse-tree.cc
index 028c946d2d9..4613aae7e36 100644
--- a/gcc/fortran/dump-parse-tree.cc
+++ b/gcc/fortran/dump-parse-tree.cc
@@ -4714,3 +4714,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;
+}