public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Lancelot SIX <lancelot.six@amd.com>
To: <gdb-patches@sourceware.org>
Cc: <lsix@lancelotsix.com>, Lancelot SIX <lancelot.six@amd.com>
Subject: [PATCH v6 2/3] gdb/infrun: Improve assertion in stop_all_threads
Date: Wed, 22 Mar 2023 16:35:03 +0000	[thread overview]
Message-ID: <20230322163504.560986-3-lancelot.six@amd.com> (raw)
In-Reply-To: <20230322163504.560986-1-lancelot.six@amd.com>

The stop_all_threads function has an assertion to check that there is a
non-stop target.  However, when called with a non-NULL INF parameter, we
only need INF's target to be non-stop.

This patch updates the assertion.  If INF is non-NULL, check that INF's
target is non-stop, otherwise keep the assertion as before.
---
 gdb/infrun.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 5c9babb9104..a509e0d5bef 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -5189,7 +5189,10 @@ stop_all_threads (const char *reason, inferior *inf)
   int pass;
   int iterations = 0;
 
-  gdb_assert (exists_non_stop_target ());
+  if (inf == nullptr)
+    gdb_assert (exists_non_stop_target ());
+  else
+    gdb_assert (target_is_non_stop_p (inf));
 
   INFRUN_SCOPED_DEBUG_START_END ("reason=%s, inf=%d", reason,
 				 inf != nullptr ? inf->num : -1);
-- 
2.34.1


  parent reply	other threads:[~2023-03-22 16:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30 16:51 [PATCH v5] gdb/gcore: interrupt all threads before generating the corefile Lancelot SIX
2023-02-10 14:36 ` [PING] " Lancelot SIX
2023-02-10 21:46 ` Simon Marchi
2023-03-22 16:35   ` [PATCH v6 0/3] interrupt all threads to generate core in non-stop targets Lancelot SIX
2023-03-22 16:35     ` [PATCH v6 1/3] gdb: add inferior parameter to target_is_non_stop_p Lancelot SIX
2023-03-22 16:35     ` Lancelot SIX [this message]
2023-03-22 16:35     ` [PATCH v6 3/3] gdb/gcore: interrupt all threads to generate core in non-stop targets Lancelot SIX
2023-03-22 16:44       ` Eli Zaretskii
2023-03-22 16:59         ` Lancelot SIX
2023-05-10 18:46       ` Lancelot SIX
2023-05-10 19:05         ` Eli Zaretskii
2023-05-10 19:08           ` Lancelot SIX

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=20230322163504.560986-3-lancelot.six@amd.com \
    --to=lancelot.six@amd.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lsix@lancelotsix.com \
    /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).