]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/gdbserver/ gdb-csl-20060226-branch
authorRichard Sandiford <rdsandiford@googlemail.com>
Wed, 2 Aug 2006 17:40:18 +0000 (17:40 +0000)
committerRichard Sandiford <rdsandiford@googlemail.com>
Wed, 2 Aug 2006 17:40:18 +0000 (17:40 +0000)
* server.c (terminal_fd): New variable.
(old_foreground_pgrp): Likewise.
(restore_old_foreground_pgrp): New function.
(start_inferior): Record the terminal file descriptor in terminal_fd
and its original foreground group in old_foreground_pgrp.  Register
restore_old_foreground_pgrp with atexit().

ChangeLog.csl
gdb/gdbserver/server.c

index f5c6570aa61719402ce15ba26f8fea02f75e219e..7ea98706cf4c9ddc0adcc4194f9771e2cf0d99f5 100644 (file)
@@ -1,3 +1,13 @@
+2006-08-02  Richard Sandiford  <richard@codesourcery.com>
+
+       gdb/gdbserver/
+       * server.c (terminal_fd): New variable.
+       (old_foreground_pgrp): Likewise.
+       (restore_old_foreground_pgrp): New function.
+       (start_inferior): Record the terminal file descriptor in terminal_fd
+       and its original foreground group in old_foreground_pgrp.  Register
+       restore_old_foreground_pgrp with atexit().
+
 2006-08-01  Vladimir Prus  <vladimir@codesourcery.com>
 
        gdb/
index 51b87642a83bd3a921df2726c17363e0167547a5..7880ad2fd70f01eef58b9bbd1caf8598cc6f921e 100644 (file)
@@ -43,6 +43,20 @@ jmp_buf toplevel;
 
 unsigned long signal_pid;
 
+/* A file descriptor for the controlling terminal.  */
+int terminal_fd;
+
+/* TERMINAL_FD's original foreground group.  */
+pid_t old_foreground_pgrp;
+
+/* Hand back terminal ownership to the original foreground group.  */
+
+static void
+restore_old_foreground_pgrp (void)
+{
+  tcsetpgrp (terminal_fd, old_foreground_pgrp);
+}
+
 static int
 start_inferior (char *argv[], char *statusptr)
 {
@@ -56,7 +70,10 @@ start_inferior (char *argv[], char *statusptr)
 
   signal (SIGTTOU, SIG_IGN);
   signal (SIGTTIN, SIG_IGN);
-  tcsetpgrp (fileno (stderr), signal_pid);
+  terminal_fd = fileno (stderr);
+  old_foreground_pgrp = tcgetpgrp (terminal_fd);
+  tcsetpgrp (terminal_fd, signal_pid);
+  atexit (restore_old_foreground_pgrp);
 
   /* Wait till we are at 1st instruction in program, return signal number.  */
   return mywait (statusptr, 0);