Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Lancelot Six <Lancelot.Six@amd.com>,
	Simon Marchi <simon.marchi@efficios.com>,
	Lancelot Six <lancelot.six@amd.com>
Subject: [PATCH v2 2/6] gdb/amd-dbgapi: add assert in require_forward_progress
Date: Mon,  9 Jun 2025 12:08:58 -0400	[thread overview]
Message-ID: <20250609161004.97787-2-simon.marchi@efficios.com> (raw)
In-Reply-To: <20250609161004.97787-1-simon.marchi@efficios.com>

I didn't have a problem in this area, but it seems to me that this
pre-condition should always hold.  We should only disable forward
progress requirement if the target says it's ok to do so.  Otherwise, we
could get in a situation where we wait for events from amd-dbgapi, which
will never arrive, because amd-dbgapi didn't actually resume things.

Change-Id: Ifc49f55c7874924b7c47888b8391a07a01d960fc
Approved-by: Lancelot Six <lancelot.six@amd.com>
---
 gdb/amd-dbgapi-target.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gdb/amd-dbgapi-target.c b/gdb/amd-dbgapi-target.c
index 2aa9d2a03a4b..32a3f6d3c334 100644
--- a/gdb/amd-dbgapi-target.c
+++ b/gdb/amd-dbgapi-target.c
@@ -450,6 +450,12 @@ static void
 require_forward_progress (ptid_t ptid, process_stratum_target *proc_target,
 			  bool require)
 {
+  /* If we try to disable forward progress requirement but the target expects
+     resumed threads to be committed to the target, we could wait for events
+     that will never arrive.  */
+  if (!require)
+    gdb_assert (!proc_target->commit_resumed_state);
+
   for (inferior *inf : all_inferiors (proc_target))
     {
       if (ptid != minus_one_ptid && inf->pid != ptid.pid ())
-- 
2.49.0


  reply	other threads:[~2025-06-09 16:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-09 16:08 [PATCH v2 1/6] gdb/amd-dbgapi: remove unnecessary AMD_DBGAPI_EVENT_KIND_NONE argument Simon Marchi
2025-06-09 16:08 ` Simon Marchi [this message]
2025-06-09 16:08 ` [PATCH v2 3/6] gdb/amd-dbgapi: pass amd_dbgapi_inferior_info to process_event_queue Simon Marchi
2025-06-16 10:29   ` Lancelot SIX
2025-06-09 16:09 ` [PATCH v2 4/6] gdb/amd-dbgapi: pass amd_dbgapi_inferior_info to process_one_event Simon Marchi
2025-06-16 10:32   ` Lancelot SIX
2025-06-16 14:24     ` Simon Marchi
2025-06-09 16:09 ` [PATCH v2 5/6] gdb/amd-dbgapi: factor out require_forward_progress overload to target one inferior Simon Marchi
2025-06-09 16:09 ` [PATCH v2 6/6] gdb/amd-dbgapi: disable forward progress requirement in amd_dbgapi_target_breakpoint::check_status Simon Marchi

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=20250609161004.97787-2-simon.marchi@efficios.com \
    --to=simon.marchi@efficios.com \
    --cc=Lancelot.Six@amd.com \
    --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