summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@nildram.co.uk>2006-08-02 17:40:18 +0000
committerRichard Sandiford <rsandifo@nildram.co.uk>2006-08-02 17:40:18 +0000
commit9d26ea3721d597eff8f5d924990b47527c2a44a4 (patch)
tree2b379e8cd1bf97698d447f2d3bc7ed3b8aabf116
parent3b277629109572e856d0ba764acb99909f4cb297 (diff)
downloadgdb-cvs/gdb-csl-20060226-branch.tar.gz
* 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().
-rw-r--r--ChangeLog.csl10
-rw-r--r--gdb/gdbserver/server.c19
2 files changed, 28 insertions, 1 deletions
diff --git a/ChangeLog.csl b/ChangeLog.csl
index f5c6570aa61..7ea98706cf4 100644
--- a/ChangeLog.csl
+++ b/ChangeLog.csl
@@ -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/
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 51b87642a83..7880ad2fd70 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -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);