gdb: Fix remote-sim/MinGW/Darwin builds
authorPedro Alves <palves@redhat.com>
Wed, 31 Jan 2018 13:45:06 +0000 (13:45 +0000)
committerPedro Alves <palves@redhat.com>
Wed, 31 Jan 2018 13:45:06 +0000 (13:45 +0000)
The recent commit e671cd59 ("Per-inferior target_terminal state, fix
PR gdb/13211, more") missed adjusting a few targets to the new
target_ops->to_interrupt interface, breaking the build for those
targets.  This fixes it.

Note: remote-sim doesn't really support async execution, so I don't
think gdbsim_interrupt is ever reached via target_interrupt.  (It is
reached via gdbsim_cntrl_c though).

The inflow.c changes are a bit ugly, but they're just doing what other
parts of the file already do to handle the same missing functions.
Targets that don't have 'kill', like mingw have their own
target_ops->to_interrupt implementation, so it's fine to make
child_interrupt be a nop.

gdb/ChangeLog:
2018-01-31  Pedro Alves  <palves@redhat.com>

* darwin-nat.c (darwin_interrupt): Remove ptid_t parameter.
* inflow.c (child_terminal_save_inferior): Wrap reference to
tcgetpgrp in HAVE_TERMIOS_H.
(child_interrupt, child_pass_ctrlc): Wrap references to signal in
_WIN32.
* remote-sim.c (gdbsim_interrupt): Remove ptid_t parameter and
always iterate over all inferiors.
(gdbsim_cntrl_c): Adjust.
* windows-nat.c (windows_interrupt): Remove 'ptid_t' parameter.

gdb/darwin-nat.c
gdb/inflow.c
gdb/remote-sim.c
gdb/windows-nat.c

index 7a862cdeae43e79aac326057e1a0b0a8fc92e258..e98ac6c5486f5527a847467161fa93bfdbb49997 100644 (file)
@@ -83,7 +83,7 @@
 #define PTRACE(CMD, PID, ADDR, SIG) \
  darwin_ptrace(#CMD, CMD, (PID), (ADDR), (SIG))
 
-static void darwin_interrupt (struct target_ops *self, ptid_t);
+static void darwin_interrupt (struct target_ops *self);
 
 static void darwin_resume_to (struct target_ops *ops, ptid_t ptid, int step,
                               enum gdb_signal signal);
@@ -1342,7 +1342,7 @@ darwin_wait_to (struct target_ops *ops,
 }
 
 static void
-darwin_interrupt (struct target_ops *self, ptid_t t)
+darwin_interrupt (struct target_ops *self)
 {
   struct inferior *inf = current_inferior ();
   darwin_inferior *priv = get_darwin_inferior (inf);
index 7c5e90470309093d14d83c8f36d37eeafb9d6586..d971543a2819e091fe6e69de835e45c359e0f0b1 100644 (file)
@@ -469,7 +469,9 @@ child_terminal_save_inferior (struct target_ops *self)
   xfree (tinfo->ttystate);
   tinfo->ttystate = serial_get_tty_state (stdin_serial);
 
+#ifdef HAVE_TERMIOS_H
   tinfo->process_group = tcgetpgrp (0);
+#endif
 
 #ifdef F_GETFL
   tinfo->tflags = fcntl (0, F_GETFL, 0);
@@ -563,7 +565,9 @@ child_interrupt (struct target_ops *self)
         either Ctrl-C or with kill(3) with negative PID) sends a
         SIGINT to each process in the process group, and we may not
         be debugging all processes in the process group.  */
+#ifndef _WIN32
       kill (resumed->inf->pid, SIGINT);
+#endif
     }
 }
 
@@ -606,7 +610,9 @@ child_pass_ctrlc (struct target_ops *self)
        {
          gdb_assert (inf->pid != 0);
 
+#ifndef _WIN32
          kill (inf->pid, SIGINT);
+#endif
          return;
        }
     }
index aed7a34b42c5498098869b2f7f266cdabf7119c2..2f8fb68634e590a80771f7349cfe0123352e0c86 100644 (file)
@@ -86,7 +86,7 @@ static void gdbsim_files_info (struct target_ops *target);
 
 static void gdbsim_mourn_inferior (struct target_ops *target);
 
-static void gdbsim_interrupt (struct target_ops *self, ptid_t ptid);
+static void gdbsim_interrupt (struct target_ops *self);
 
 void simulator_command (char *args, int from_tty);
 
@@ -920,24 +920,9 @@ gdbsim_interrupt_inferior (struct inferior *inf, void *arg)
 }
 
 static void
-gdbsim_interrupt (struct target_ops *self, ptid_t ptid)
+gdbsim_interrupt (struct target_ops *self)
 {
-  struct sim_inferior_data *sim_data;
-
-  if (ptid_equal (ptid, minus_one_ptid))
-    {
-      iterate_over_inferiors (gdbsim_interrupt_inferior, NULL);
-    }
-  else
-    {
-      struct inferior *inf = find_inferior_ptid (ptid);
-
-      if (inf == NULL)
-       error (_("Can't stop pid %d.  No inferior found."),
-              ptid_get_pid (ptid));
-
-      gdbsim_interrupt_inferior (inf, NULL);
-    }
+  iterate_over_inferiors (gdbsim_interrupt_inferior, NULL);
 }
 
 /* GDB version of os_poll_quit callback.
@@ -961,7 +946,7 @@ gdb_os_poll_quit (host_callback *p)
 static void
 gdbsim_cntrl_c (int signo)
 {
-  gdbsim_interrupt (NULL, minus_one_ptid);
+  gdbsim_interrupt (NULL);
 }
 
 static ptid_t
index 5fb143e00db5af2ddc520337ac63dc9e4c27197e..f849f1f322160aa1dbb2032799500fd4c4f670e1 100644 (file)
@@ -201,7 +201,7 @@ typedef enum
 #define DEBUG_MEM(x)   if (debug_memory)       printf_unfiltered x
 #define DEBUG_EXCEPT(x)        if (debug_exceptions)   printf_unfiltered x
 
-static void windows_interrupt (struct target_ops *self, ptid_t);
+static void windows_interrupt (struct target_ops *self);
 static int windows_thread_alive (struct target_ops *, ptid_t);
 static void windows_kill_inferior (struct target_ops *);
 
@@ -2777,7 +2777,7 @@ windows_mourn_inferior (struct target_ops *ops)
    ^C on the controlling terminal.  */
 
 static void
-windows_interrupt (struct target_ops *self, ptid_t ptid)
+windows_interrupt (struct target_ops *self)
 {
   DEBUG_EVENTS (("gdb: GenerateConsoleCtrlEvent (CTRLC_EVENT, 0)\n"));
   CHECK (GenerateConsoleCtrlEvent (CTRL_C_EVENT, current_event.dwProcessId));
This page took 0.035996 seconds and 4 git commands to generate.