aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2024-09-30 11:48:28 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2024-09-30 11:48:28 -0400
commit4c7a58ac2617e24069c9ad3d469a7f87dc96091d (patch)
tree1bbc935ce17fefc6dc5c20d46fe9221f14b6cf51 /gcc
parent3286b6724ec1d005436dffa5228516db88e754b9 (diff)
downloadgcc-4c7a58ac2617e24069c9ad3d469a7f87dc96091d.zip
gcc-4c7a58ac2617e24069c9ad3d469a7f87dc96091d.tar.gz
gcc-4c7a58ac2617e24069c9ad3d469a7f87dc96091d.tar.bz2
diagnostics: add "dump" to pretty_printer and output_buffer
No functional change intended. gcc/ChangeLog: * pretty-print.cc (output_buffer::dump): New. (pretty_printer::dump): New. * pretty-print.h (output_buffer::dump): New decls. (pretty_printer::dump): New decls. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/pretty-print.cc23
-rw-r--r--gcc/pretty-print.h6
2 files changed, 29 insertions, 0 deletions
diff --git a/gcc/pretty-print.cc b/gcc/pretty-print.cc
index 68c145e..6a1d1ec 100644
--- a/gcc/pretty-print.cc
+++ b/gcc/pretty-print.cc
@@ -790,6 +790,21 @@ output_buffer::pop_formatted_chunks ()
obstack_free (&m_chunk_obstack, old_top);
}
+/* Dump state of this output_buffer to OUT, for debugging. */
+
+void
+output_buffer::dump (FILE *out) const
+{
+ int depth = 0;
+ for (pp_formatted_chunks *iter = m_cur_formatted_chunks;
+ iter;
+ iter = iter->m_prev, depth++)
+ {
+ fprintf (out, "pp_formatted_chunks: depth %i\n", depth);
+ iter->dump (out);
+ }
+}
+
#ifndef PTRDIFF_MAX
#define PTRDIFF_MAX INTTYPE_MAXIMUM (ptrdiff_t)
#endif
@@ -3013,6 +3028,14 @@ pretty_printer::end_url ()
pp_string (this, get_end_url_string (this));
}
+/* Dump state of this pretty_printer to OUT, for debugging. */
+
+void
+pretty_printer::dump (FILE *out) const
+{
+ m_buffer->dump (out);
+}
+
/* class pp_markup::context. */
void
diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h
index b5ded5c..ec64a16 100644
--- a/gcc/pretty-print.h
+++ b/gcc/pretty-print.h
@@ -93,6 +93,9 @@ public:
pp_formatted_chunks *push_formatted_chunks ();
void pop_formatted_chunks ();
+ void dump (FILE *out) const;
+ void DEBUG_FUNCTION dump () const { dump (stderr); }
+
/* Obstack where the text is built up. */
struct obstack m_formatted_obstack;
@@ -313,6 +316,9 @@ public:
void set_real_maximum_length ();
int remaining_character_count_for_line ();
+ void dump (FILE *out) const;
+ void DEBUG_FUNCTION dump () const { dump (stderr); }
+
private:
/* Where we print external representation of ENTITY. */
output_buffer *m_buffer;