]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/inflow.c
Update copyright year range in all GDB files.
[thirdparty/binutils-gdb.git] / gdb / inflow.c
index a3b5ba8abef83e16e0293083d69475d6d96f3d8e..9fd3acfdd2d49e49edf55155ac7da83fd7bfd0ae 100644 (file)
@@ -1,5 +1,5 @@
 /* Low level interface to ptrace, for GDB when running under Unix.
-   Copyright (C) 1986-2018 Free Software Foundation, Inc.
+   Copyright (C) 1986-2019 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -138,7 +138,9 @@ private:
    to SIG_IGN.  */
 
 static sighandler_t sigint_ours;
+#ifdef SIGQUIT
 static sighandler_t sigquit_ours;
+#endif
 
 /* The name of the tty (from the `tty' command) that we're giving to
    the inferior when starting it up.  This is only (and should only
@@ -544,9 +546,8 @@ void
 child_interrupt (struct target_ops *self)
 {
   /* Interrupt the first inferior that has a resumed thread.  */
-  thread_info *thr;
   thread_info *resumed = NULL;
-  ALL_NON_EXITED_THREADS (thr)
+  for (thread_info *thr : all_non_exited_threads ())
     {
       if (thr->executing)
        {
@@ -603,8 +604,7 @@ child_pass_ctrlc (struct target_ops *self)
 
   /* Otherwise, pass the Ctrl-C to the first inferior that was resumed
      in the foreground.  */
-  inferior *inf;
-  ALL_INFERIORS (inf)
+  for (inferior *inf : all_inferiors ())
     {
       if (inf->terminal_state != target_terminal_state::is_ours)
        {
@@ -700,6 +700,22 @@ copy_terminal_info (struct inferior *to, struct inferior *from)
   to->terminal_state = from->terminal_state;
 }
 
+/* See terminal.h.  */
+
+void
+swap_terminal_info (inferior *a, inferior *b)
+{
+  terminal_info *info_a
+    = (terminal_info *) inferior_data (a, inflow_inferior_data);
+  terminal_info *info_b
+    = (terminal_info *) inferior_data (a, inflow_inferior_data);
+
+  set_inferior_data (a, inflow_inferior_data, info_b);
+  set_inferior_data (b, inflow_inferior_data, info_a);
+
+  std::swap (a->terminal_state, b->terminal_state);
+}
+
 void
 info_terminal_command (const char *arg, int from_tty)
 {
@@ -825,11 +841,11 @@ check_syscall (const char *msg, int result)
 void
 new_tty (void)
 {
-  int tty;
-
   if (inferior_thisrun_terminal == 0)
     return;
 #if !defined(__GO32__) && !defined(_WIN32)
+  int tty;
+
 #ifdef TIOCNOTTY
   /* Disconnect the child process from our controlling terminal.  On some
      systems (SVR4 for example), this may cause a SIGTTOU, so temporarily