summaryrefslogtreecommitdiff
path: root/gdb/fork-child.c
diff options
context:
space:
mode:
authorThiago Jung Bauermann <bauerman@br.ibm.com>2008-03-12 14:10:56 +0000
committerThiago Jung Bauermann <bauerman@br.ibm.com>2008-03-12 14:10:56 +0000
commit83116857a35fc5125d098984fae29a549a2b29f3 (patch)
tree345c301a7e13d9bdb1cbd65fb38a0fbe0bf92e26 /gdb/fork-child.c
parent2774f1a679efef2fc5f9f9a445f7c1e904a13225 (diff)
downloadbinutils-gdb-83116857a35fc5125d098984fae29a549a2b29f3.tar.gz
* configure.ac (AC_CHECK_FUNCS): Add check for setsid.
* config.in, configure: Regenerate. * fork-child.c (fork_inferior): Call create_tty_session. * inflow.c (new_tty): Set controlling terminal with TIOCSCTTY. (create_tty_session): New function. * terminal.h: Declare create_tty_session.
Diffstat (limited to 'gdb/fork-child.c')
-rw-r--r--gdb/fork-child.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index cbde5dbfac4..c8e76838dbb 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -303,10 +303,16 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
if (debug_fork)
sleep (debug_fork);
- /* Run inferior in a separate process group. */
- debug_setpgrp = gdb_setpgid ();
- if (debug_setpgrp == -1)
- perror ("setpgrp failed in child");
+ /* Create a new session for the inferior process, if necessary.
+ It will also place the inferior in a separate process group. */
+ if (create_tty_session () <= 0)
+ {
+ /* No session was created, but we still want to run the inferior
+ in a separate process group. */
+ debug_setpgrp = gdb_setpgid ();
+ if (debug_setpgrp == -1)
+ perror ("setpgrp failed in child");
+ }
/* Ask the tty subsystem to switch to the one we specified
earlier (or to share the current terminal, if none was