This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] tui-out: don't "inherit" redirect from CLI
- From: Paul Bolle <pebolle at tiscali dot nl>
- To: gdb-patches at sourceware dot org
- Date: Mon, 30 Aug 2010 11:29:10 +0200
- Subject: [PATCH] tui-out: don't "inherit" redirect from CLI
Since revision 1.17 tui_ui_out_impl "inherits" from cli_ui_out_impl (ie,
it starts as a copy of that struct). tui_ui_out_impl.redirect is never
redefined after that so it points to cli_redirect(). (Before revision
1.17 it was NULL.)
As a consequence, uo_redirect() will actually try to redirect if passed
a tui_ui_out_impl. That will probably crash gdb (as
tui_ui_out_impl->data->stream and tui_ui_out_impl->data->original_stream
don't exist).
So set tui_ui_out_impl.redirect to NULL after "inheriting".
(Just something I noticed while trying to understand the ui code.)
---
gdb/ChangeLog | 5 +++++
gdb/tui/tui-out.c | 1 +
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5d81848..1beb8fc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2010-08-30 Paul Bolle <pebolle@tiscali.nl>
+
+ * tui/tui-out.c (_initialize_tui_out): Don't "inherit" redirect from
+ CLI.
+
2010-08-28 Jan Kratochvil <jan.kratochvil@redhat.com>
Code cleanup.
diff --git a/gdb/tui/tui-out.c b/gdb/tui/tui-out.c
index 8cd6b88..1e8ef74 100644
--- a/gdb/tui/tui-out.c
+++ b/gdb/tui/tui-out.c
@@ -178,4 +178,5 @@ _initialize_tui_out (void)
tui_ui_out_impl.field_string = tui_field_string;
tui_ui_out_impl.field_fmt = tui_field_fmt;
tui_ui_out_impl.text = tui_text;
+ tui_ui_out_impl.redirect = NULL;
}
--
1.7.2.1