This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Make current_ui_out be per UI
- From: Pedro Alves <palves at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 21 Jun 2016 00:19:02 -0000
- Subject: [binutils-gdb] Make current_ui_out be per UI
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b6dcde571e1a230d12fc483ba6d38a1253ab097e
commit b6dcde571e1a230d12fc483ba6d38a1253ab097e
Author: Pedro Alves <palves@redhat.com>
Date: Tue Jun 21 01:11:48 2016 +0100
Make current_ui_out be per UI
Similarly to gdb_stdout&co.
gdb/ChangeLog:
2016-06-21 Pedro Alves <palves@redhat.com>
* top.c: Call gen_ret_current_ui_field_ptr for current_uiout.
* top.h (struct ui) <m_current_uiout>: New field.
* ui-out.c (current_uiout): Delete.
* ui-out.h (current_uiout): Delete.
(current_ui_current_uiout_ptr): New declaration.
(current_uiout): Reimplement as wrapper around
current_ui_current_uiout_ptr.
Diff:
---
gdb/ChangeLog | 10 ++++++++++
gdb/top.c | 1 +
gdb/top.h | 3 +++
gdb/ui-out.c | 5 -----
gdb/ui-out.h | 3 ++-
5 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ccf31f2..58afe3b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
2016-06-21 Pedro Alves <palves@redhat.com>
+ * top.c: Call gen_ret_current_ui_field_ptr for current_uiout.
+ * top.h (struct ui) <m_current_uiout>: New field.
+ * ui-out.c (current_uiout): Delete.
+ * ui-out.h (current_uiout): Delete.
+ (current_ui_current_uiout_ptr): New declaration.
+ (current_uiout): Reimplement as wrapper around
+ current_ui_current_uiout_ptr.
+
+2016-06-21 Pedro Alves <palves@redhat.com>
+
* ui-out.c (default_ui_out_impl): Delete.
(def_uiout): Delete.
(current_uiout): Set to NULL.
diff --git a/gdb/top.c b/gdb/top.c
index 733580f..2e6cf31 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -100,6 +100,7 @@ gen_ret_current_ui_field_ptr (struct ui_file *, gdb_stdout)
gen_ret_current_ui_field_ptr (struct ui_file *, gdb_stdin)
gen_ret_current_ui_field_ptr (struct ui_file *, gdb_stderr)
gen_ret_current_ui_field_ptr (struct ui_file *, gdb_stdlog)
+gen_ret_current_ui_field_ptr (struct ui_out *, current_uiout)
/* Initialization file name for gdb. This is host-dependent. */
diff --git a/gdb/top.h b/gdb/top.h
index e544514..905ad7b 100644
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -98,6 +98,9 @@ struct ui
*_unfiltered. In the very near future that restriction shall be
removed - either call shall be unfiltered. (cagney 1999-06-13). */
struct ui_file *m_gdb_stdlog;
+
+ /* The current ui_out. */
+ struct ui_out *m_current_uiout;
};
/* The main UI. This is the UI that is bound to stdin/stdout/stderr.
diff --git a/gdb/ui-out.c b/gdb/ui-out.c
index 4ea571b..3972a56 100644
--- a/gdb/ui-out.c
+++ b/gdb/ui-out.c
@@ -147,11 +147,6 @@ pop_level (struct ui_out *uiout,
return uiout->level + 1;
}
-/* FIXME: This should not be a global, but something passed down from main.c
- or top.c. */
-
-struct ui_out *current_uiout = NULL;
-
/* These are the interfaces to implementation functions. */
static void uo_table_begin (struct ui_out *uiout, int nbrofcols,
diff --git a/gdb/ui-out.h b/gdb/ui-out.h
index 905d73c..9e1e74d 100644
--- a/gdb/ui-out.h
+++ b/gdb/ui-out.h
@@ -32,7 +32,8 @@ struct ui_file;
/* FIXME: This should not be a global but something passed down from main.c
or top.c. */
-extern struct ui_out *current_uiout;
+extern struct ui_out **current_ui_current_uiout_ptr (void);
+#define current_uiout (*current_ui_current_uiout_ptr ())
/* alignment enum */
enum ui_align