-
- Downloads
diagnostics: add debug dump functions
This commit expands on r15-3973-g4c7a58ac2617e2, which added
debug "dump" member functiosn to pretty_printer and output_buffer.
This followup adds "dump" member functions to diagnostic_context and
diagnostic_format, extends the existing dump functions and adds
indentation to make it much easier to see the various relationships
between context, format, printer, etc.
Hence you can now do:
(gdb) call global_dc->dump ()
and get a useful summary of what the diagnostic subsystem is doing;
for example:
(gdb) call global_dc->dump()
diagnostic_context:
counts:
output format:
sarif_output_format
printer:
m_show_color: false
m_url_format: bel
m_buffer:
m_formatted_obstack current object: length 0:
m_chunk_obstack current object: length 0:
pp_formatted_chunks: depth 0
0: TEXT("Function ")]
1: BEGIN_QUOTE, TEXT("program"), END_QUOTE]
2: TEXT(" requires an argument list at ")]
3: TEXT("(1)")]
showing the counts of all diagnostic kind that are non-zero (none yet),
that we have a sarif output format, and the printer is part-way through
formatting a string.
gcc/ChangeLog:
* diagnostic-format-json.cc (json_output_format::dump): New.
* diagnostic-format-sarif.cc (sarif_output_format::dump): New.
(sarif_file_output_format::dump): New.
* diagnostic-format-text.cc (diagnostic_text_output_format::dump):
New.
* diagnostic-format-text.h (diagnostic_text_output_format::dump):
New decl.
* diagnostic-format.h (diagnostic_output_format::dump): New decls.
* diagnostic.cc (diagnostic_context::dump): New.
(diagnostic_output_format::dump): New.
* diagnostic.h (diagnostic_context::dump): New decls.
* pretty-print-format-impl.h (pp_formatted_chunks::dump): Add
"indent" param.
* pretty-print.cc (bytes_per_hexdump_line): New constant.
(print_hexdump_line): New.
(print_hexdump): New.
(output_buffer::dump): Add "indent" param and use it. Add
hexdump of current object in m_formatted_obstack and
m_chunk_obstack.
(pp_formatted_chunks::dump): Add "indent" param and use it.
(pretty_printer::dump): Likewise. Add dumping of m_show_color
and m_url_format.
* pretty-print.h (output_buffer::dump): Add "indent" param.
(pretty_printer::dump): Likewise.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic_plugin_xhtml_format.c
(xhtml_output_format::dump): New.
Signed-off-by:
David Malcolm <dmalcolm@redhat.com>
Showing
- gcc/diagnostic-format-json.cc 6 additions, 0 deletionsgcc/diagnostic-format-json.cc
- gcc/diagnostic-format-sarif.cc 13 additions, 0 deletionsgcc/diagnostic-format-sarif.cc
- gcc/diagnostic-format-text.cc 7 additions, 0 deletionsgcc/diagnostic-format-text.cc
- gcc/diagnostic-format-text.h 3 additions, 0 deletionsgcc/diagnostic-format-text.h
- gcc/diagnostic-format.h 4 additions, 0 deletionsgcc/diagnostic-format.h
- gcc/diagnostic.cc 24 additions, 0 deletionsgcc/diagnostic.cc
- gcc/diagnostic.h 3 additions, 0 deletionsgcc/diagnostic.h
- gcc/pretty-print-format-impl.h 2 additions, 2 deletionsgcc/pretty-print-format-impl.h
- gcc/pretty-print.cc 88 additions, 8 deletionsgcc/pretty-print.cc
- gcc/pretty-print.h 4 additions, 4 deletionsgcc/pretty-print.h
- gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_xhtml_format.c 6 additions, 0 deletionsgcc/testsuite/gcc.dg/plugin/diagnostic_plugin_xhtml_format.c
Loading
Please register or sign in to comment