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]

[RFA]: New function terminal_save_ours()


Hi!

When using gdb-tui and switching to or leaving the TUI mode, the terminal
settings are changed.  This is part of the curses management (endwin).

Gdb keeps in a static variable in inflow.c for the tty setting of himself.
It switches it with the inferior terminal (terminal_inferior, terminal_ours).
The gdb terminal settings are fetched only once, the first time it is
used/checked (so we don't know when).

For the TUI to work correctly, it needs to update the gdb knowledge of
its terminal.  The patch below proposes a new function `terminal_save_ours'
which is called by TUI each time the TUI changes from mode;  that is
after we enter in TUI mode (curses), and after we left the TUI mode.

Can you approve this patch ?

	Stephane

2001-07-20  Stephane Carrez  <Stephane.Carrez@worldnet.fr>

	* inferior.h (terminal_save_ours): Declare.
	* inflow.c (terminal_save_ours): New function.
Index: inflow.c
===================================================================
RCS file: /cvs/src/src/gdb/inflow.c,v
retrieving revision 1.11
diff -u -p -r1.11 inflow.c
--- inflow.c	2001/07/15 20:34:13	1.11
+++ inflow.c	2001/07/19 22:48:49
@@ -200,6 +200,23 @@ terminal_init_inferior_with_pgrp (int pg
     }
 }
 
+/* Save the terminal settings again.  This is necessary for the TUI
+   when it switches to TUI or non-TUI mode;  curses changes the terminal
+   and gdb must be able to restore it correctly.  */
+
+void
+terminal_save_ours ()
+{
+  if (gdb_has_a_terminal ())
+    {
+      /* We could just as well copy our_ttystate (if we felt like adding
+         a new function serial_copy_tty_state).  */
+      if (our_ttystate)
+	xfree (our_ttystate);
+      our_ttystate = serial_get_tty_state (stdin_serial);
+    }
+}
+
 void
 terminal_init_inferior (void)
 {
Index: inferior.h
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v
retrieving revision 1.23
diff -u -p -r1.23 inferior.h
--- inferior.h	2001/05/15 00:03:36	1.23
+++ inferior.h	2001/07/19 22:48:51
@@ -151,6 +151,8 @@ extern void generic_mourn_inferior (void
 
 extern void terminal_ours (void);
 
+extern void terminal_save_ours (void);
+
 extern int run_stack_dummy (CORE_ADDR, char *);
 
 extern CORE_ADDR read_pc (void);

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