[v2,8/8] fbsd-nat: Implement the target stop method.

Message ID 20230717192039.13976-9-jhb@FreeBSD.org
State New
Headers
Series Fixes for multiprocess for FreeBSD's native target |

Commit Message

John Baldwin July 17, 2023, 7:20 p.m. UTC
  Stop each requested process via the stop_process helper function.
---
 gdb/fbsd-nat.c | 19 +++++++++++++++++++
 gdb/fbsd-nat.h |  2 ++
 2 files changed, 21 insertions(+)
  

Patch

diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index f114f88e649..91d0841fb33 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -1367,6 +1367,25 @@  fbsd_nat_target::commit_resumed ()
     resume_one_process (inf);
 }
 
+/* Implement the "stop" target method.  */
+
+void
+fbsd_nat_target::stop (ptid_t ptid)
+{
+  fbsd_nat_debug_printf ("[%s]", target_pid_to_str (ptid).c_str ());
+  if (ptid == minus_one_ptid)
+    {
+      for (inferior *inf : all_non_exited_inferiors (this))
+	stop_process (inf);
+    }
+  else
+    {
+      inferior *inf = find_inferior_ptid (this, ptid);
+      gdb_assert (inf != nullptr);
+      stop_process (inf);
+    }
+}
+
 #ifdef USE_SIGTRAP_SIGINFO
 /* Handle breakpoint and trace traps reported via SIGTRAP.  If the
    trap was a breakpoint or trace trap that should be reported to the
diff --git a/gdb/fbsd-nat.h b/gdb/fbsd-nat.h
index b149217b71b..65d0954d36a 100644
--- a/gdb/fbsd-nat.h
+++ b/gdb/fbsd-nat.h
@@ -91,6 +91,8 @@  class fbsd_nat_target : public inf_ptrace_target
 
   void commit_resumed () override;
 
+  void stop (ptid_t) override;
+
   ptid_t wait (ptid_t, struct target_waitstatus *, target_wait_flags) override;
 
   void post_attach (int) override;