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(+)

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;
+}
-- 
2.53.0

Reply via email to