This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH]: Fix TUI startup in gdb normal mode followed by TUI switch


Hi!

When Andrew converted the TUI to the interp mechanism the fix broke the ability to
start gdb without -tui (ie, normal mode) and then be able to switch in TUI mode
(with CTRL-X CTRL-A).  For this to work, it is important to have the TUI interpreter
running even if the curses mode is not used.

The TUI interpreter is forced only when the selected interpretor is the console.
In which case, the TUI will behave like it but with the ability to enter TUI mode.

Committed on 6_0 and mainline.

Stephane

2003-07-23 Stephane Carrez <stcarrez@nerim.fr>

	* tui-interp.c (tui_resume): Enable tui when we expected it.
	(tui_suspend): Remember in which TUI mode we are.
	(_initialize_tui_interp): Use the tui interpreter even when no
	other interpreter was set and define in which TUI mode to start.
Index: tui-interp.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-interp.c,v
retrieving revision 1.1
diff -u -p -r1.1 tui-interp.c
--- tui-interp.c	14 Feb 2003 13:58:06 -0000	1.1
+++ tui-interp.c	23 Jul 2003 21:03:54 -0000
@@ -31,6 +31,9 @@
 #include "tui/tui.h"
 #include "tui/tuiIO.h"
 
+/* Set to 1 when the TUI mode must be activated when we first start gdb.  */
+static int tui_start_enabled = 0;
+
 /* Cleanup the tui before exiting.  */
 
 static void
@@ -61,13 +64,15 @@ static int
 tui_resume (void *data)
 {
   gdb_setup_readline ();
-  tui_enable ();
+  if (tui_start_enabled)
+    tui_enable ();
   return 1;
 }
 
 static int
 tui_suspend (void *data)
 {
+  tui_start_enabled = tui_active;
   tui_disable ();
   return 1;
 }
@@ -177,4 +182,12 @@ _initialize_tui_interp (void)
   /* Create a default uiout builder for the TUI. */
   tui_out = tui_out_new (gdb_stdout);
   interp_add (interp_new ("tui", NULL, tui_out, &procs));
+  if (interpreter_p && strcmp (interpreter_p, "tui") == 0)
+    tui_start_enabled = 1;
+
+  if (interpreter_p && strcmp (interpreter_p, INTERP_CONSOLE) == 0)
+    {
+      xfree (interpreter_p);
+      interpreter_p = xstrdup ("tui");
+    }
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]