aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.h
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-06-21 01:11:44 +0100
committerPedro Alves <palves@redhat.com>2016-06-21 01:11:44 +0100
commit79aa2fe86f105fae162f780f760d655f212eaeb6 (patch)
treebc6d1631212c664c684169df1f061bc063b9f37b /gdb/utils.h
parenta74e1786ac24d4ef1ce8a92a1ab06c727a462881 (diff)
downloadgdb-79aa2fe86f105fae162f780f760d655f212eaeb6.zip
gdb-79aa2fe86f105fae162f780f760d655f212eaeb6.tar.gz
gdb-79aa2fe86f105fae162f780f760d655f212eaeb6.tar.bz2
Make gdb_stdout&co be per UI
We need to have these send output to the proper UI. However, this patch still make them look like globals. Kind of like __thread variables, if you will. Changing everything throughout to write something like current_ui->gdb_stdout instead would be massive overkill, IMNSHO. This leaves gdb_stdtargin/stdtarg/stdtargerr global, but maybe that was a mistake, I'm not sure -- IIRC, MI formats target I/O differently, so if we have a separate MI channel, then I guess target output should go there instead of to gdb's stdout. OTOH, maybe GDB should send that instead to "set inferior-tty", instead of multiplexing it over MI. We can always fix those later when it gets clearer where they should go. gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * main.c (gdb_stdout, gdb_stderr, gdb_stdlog, gdb_stdin): Delete globals. (gen_ret_current_ui_field_ptr): New macro. Use it to generate wrappers for gdb_stdout, gdb_stderr, gdb_stdlog and gdb_stdin. * top.h (struct ui) <m_gdb_stdout, m_gdb_stdin, m_gdb_stderr, m_gdb_stdlog>: New fields. (current_ui_gdb_stdout_ptr, current_ui_gdb_stdin_ptr) (current_ui_gdb_stderr_ptr, current_ui_gdb_stdlog_ptr): Declare. (gdb_stdout, gdb_stdin, gdb_stderr, gdb_stdlog): Reimplement as macros.
Diffstat (limited to 'gdb/utils.h')
-rw-r--r--gdb/utils.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/gdb/utils.h b/gdb/utils.h
index 87bb9c0..6080f5b 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -159,18 +159,27 @@ extern void reinitialize_more_filter (void);
extern int pagination_enabled;
-/* Global ui_file streams. These are all defined in main.c. */
+extern struct ui_file **current_ui_gdb_stdout_ptr (void);
+extern struct ui_file **current_ui_gdb_stdin_ptr (void);
+extern struct ui_file **current_ui_gdb_stderr_ptr (void);
+extern struct ui_file **current_ui_gdb_stdlog_ptr (void);
+
+/* The current top level's ui_file streams. */
+
/* Normal results */
-extern struct ui_file *gdb_stdout;
+#define gdb_stdout (*current_ui_gdb_stdout_ptr ())
/* Input stream */
-extern struct ui_file *gdb_stdin;
+#define gdb_stdin (*current_ui_gdb_stdin_ptr ())
/* Serious error notifications */
-extern struct ui_file *gdb_stderr;
+#define gdb_stderr (*current_ui_gdb_stderr_ptr ())
/* Log/debug/trace messages that should bypass normal stdout/stderr
filtering. For moment, always call this stream using
*_unfiltered. In the very near future that restriction shall be
removed - either call shall be unfiltered. (cagney 1999-06-13). */
-extern struct ui_file *gdb_stdlog;
+#define gdb_stdlog (*current_ui_gdb_stdlog_ptr ())
+
+/* Truly global ui_file streams. These are all defined in main.c. */
+
/* Target output that should bypass normal stdout/stderr filtering.
For moment, always call this stream using *_unfiltered. In the
very near future that restriction shall be removed - either call