public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: John Baldwin <jhb@FreeBSD.org>
To: gdb-patches@sourceware.org
Subject: [PATCH v2 8/8] fbsd-nat: Implement the target stop method.
Date: Mon, 17 Jul 2023 12:20:39 -0700	[thread overview]
Message-ID: <20230717192039.13976-9-jhb@FreeBSD.org> (raw)
In-Reply-To: <20230717192039.13976-1-jhb@FreeBSD.org>

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(+)

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;
-- 
2.40.0


  parent reply	other threads:[~2023-07-17 19:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17 19:20 [PATCH v2 0/8] Fixes for multiprocess for FreeBSD's native target John Baldwin
2023-07-17 19:20 ` [PATCH v2 1/8] fbsd-nat: Add a list of pending events John Baldwin
2023-07-17 19:20 ` [PATCH v2 2/8] fbsd-nat: Defer any ineligible events reported by wait John Baldwin
2023-07-17 19:20 ` [PATCH v2 3/8] fbsd-nat: Fix resuming and waiting with multiple processes John Baldwin
2023-08-04 16:30   ` Tom Tromey
2023-08-04 21:30     ` John Baldwin
2023-07-17 19:20 ` [PATCH v2 4/8] fbsd-nat: Fix several issues with detaching John Baldwin
2023-07-17 19:20 ` [PATCH v2 5/8] fbsd-nat: Fix thread_alive against a running thread John Baldwin
2023-07-17 19:20 ` [PATCH v2 6/8] fbsd-nat: Stop a process if it is running before killing it John Baldwin
2023-07-17 19:20 ` [PATCH v2 7/8] fbsd-nat: Defer resume of inferiors John Baldwin
2023-07-17 19:20 ` John Baldwin [this message]
2023-08-04 16:45 ` [PATCH v2 0/8] Fixes for multiprocess for FreeBSD's native target Tom Tromey
2023-08-14 17:51   ` John Baldwin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230717192039.13976-9-jhb@FreeBSD.org \
    --to=jhb@freebsd.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).