This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH]: Fix tui for background pb
- To: gdb-patches at sources dot redhat dot com
- Subject: [PATCH]: Fix tui for background pb
- From: Stephane Carrez <Stephane dot Carrez at worldnet dot fr>
- Date: Sun, 22 Jul 2001 00:41:00 +0200
Hi!
When the gdb-tui is put in background and it is restored, the
screen is not updated and the terminal is not restored.
I've committed this patch that catches SIGCONT to restore the
terminal and refresh the screen. The terminal settings is saved
restored using the curses savetty/resetty functions.
Stephane
2001-07-22 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* tuiIO.c (tui_initialize_io): Install tui_cont_sig signal handler
if SIGCONT is defined.
(tui_cont_sig): New function when SIGCONT is defined.
(tui_setup_io): Save tty setting to restore by SIGCONT.
Index: tuiIO.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiIO.c,v
retrieving revision 1.8
diff -u -p -r1.8 tuiIO.c
--- tuiIO.c 2001/07/21 19:56:54 1.8
+++ tuiIO.c 2001/07/21 22:34:08
@@ -37,6 +37,7 @@
#include "ui-out.h"
#include "cli-out.h"
#include <fcntl.h>
+#include <signal.h>
/* This file controls the IO interactions between gdb and curses.
When the TUI is enabled, gdb has two modes a curses and a standard
@@ -267,6 +268,9 @@ tui_setup_io (int mode)
gdb_stdlog = gdb_stdout; /* for moment */
gdb_stdtarg = gdb_stderr; /* for moment */
uiout = tui_out;
+
+ /* Save tty for SIGCONT. */
+ savetty ();
}
else
{
@@ -284,13 +288,38 @@ tui_setup_io (int mode)
rl_getc_function = tui_old_rl_getc_function;
rl_outstream = tui_old_rl_outstream;
readline_echoing_p = tui_old_readline_echoing_p;
+
+ /* Save tty for SIGCONT. */
+ savetty ();
+ }
+}
+
+#ifdef SIGCONT
+/* Catch SIGCONT to restore the terminal and refresh the screen. */
+static void
+tui_cont_sig (int sig)
+{
+ if (tui_active)
+ {
+ /* Restore the terminal setting because another process (shell)
+ might have changed it. */
+ resetty ();
+
+ /* Force a refresh of the screen. */
+ tuiRefreshAll ();
}
+ signal (sig, tui_cont_sig);
}
+#endif
/* Initialize the IO for gdb in curses mode. */
void
tui_initialize_io ()
{
+#ifdef SIGCONT
+ signal (SIGCONT, tui_cont_sig);
+#endif
+
/* Create tui output streams. */
tui_stdout = tui_fileopen (stdout);
tui_stderr = tui_fileopen (stderr);