#include "serial.h"
#include "terminal.h"
#include "target.h"
+#include "thread.h"
#include <signal.h>
#include <fcntl.h>
our_process_group = tcgetpgrp (0);
#endif
#ifdef HAVE_SGTTY
- ioctl (scb->fd, TIOCGPGRP, &our_process_group);
+ ioctl (0, TIOCGPGRP, &our_process_group);
#endif
}
}
return gdb_has_a_terminal_flag == yes;
+ default:
+ /* "Can't happen". */
+ return 0;
}
}
#define OOPSY(what) \
if (result == -1) \
- fprintf(stderr, "[%s failed in terminal_inferior: %s]\n", \
+ fprintf_unfiltered(gdb_stderr, "[%s failed in terminal_inferior: %s]\n", \
what, strerror (errno))
static void terminal_ours_1 PARAMS ((int));
free (inferior_ttystate);
inferior_ttystate = SERIAL_GET_TTY_STATE (stdin_serial);
#ifdef PROCESS_GROUP_TYPE
+#ifdef PIDGET /* XXX Lynx */
+ inferior_process_group = PIDGET (inferior_pid);
+#else
inferior_process_group = inferior_pid;
+#endif
#endif
/* Make sure that next time we call terminal_inferior (which will be
#endif
#ifdef HAVE_SGTTY
- result = ioctl (0, TIOCSPGRP, inferior_process_group);
+ result = ioctl (0, TIOCSPGRP, &inferior_process_group);
if (!attach_flag)
OOPSY ("TIOCSPGRP");
#endif
inferior_process_group = tcgetpgrp (0);
#endif
#ifdef HAVE_SGTTY
- ioctl (scb->fd, TIOCGPGRP, &inferior_process_group);
+ ioctl (0, TIOCGPGRP, &inferior_process_group);
#endif
/* Here we used to set ICANON in our ttystate, but I believe this
{
#ifdef HAVE_TERMIOS
result = tcsetpgrp (0, our_process_group);
- OOPSY ("tcsetpgrp");
+#if 0
+ /* This fails on Ultrix with EINVAL if you run the testsuite
+ in the background with nohup, and then log out. GDB never
+ used to check for an error here, so perhaps there are other
+ such situations as well. */
+ if (result == -1)
+ fprintf_unfiltered (gdb_stderr, "[tcsetpgrp failed in terminal_ours: %s]\n",
+ strerror (errno));
#endif
+#endif /* termios */
#ifdef HAVE_SGTTY
- result = ioctl (0, TIOCSPGRP, our_process_group);
- OOPSY ("TIOCSPGRP");
+ result = ioctl (0, TIOCSPGRP, &our_process_group);
#endif
}
error ("Not confirmed.");
target_kill ();
+ init_thread_list(); /* Destroy thread info */
+
/* Killing off the inferior can leave us with a core file. If so,
print the state we are left in. */
if (target_has_stack) {
printf_filtered ("In %s,\n", current_target->to_longname);
if (selected_frame == NULL)
- fputs_filtered ("No selected stack frame.\n", stdout);
+ fputs_filtered ("No selected stack frame.\n", gdb_stdout);
else
print_stack_frame (selected_frame, selected_frame_level, 1);
}