From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id MGg5JHD7QWiDUwIAWB0awg (envelope-from ) for ; Thu, 05 Jun 2025 16:17:52 -0400 Received: by simark.ca (Postfix, from userid 112) id 91B6B1E102; Thu, 5 Jun 2025 16:17:52 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-9.0 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE autolearn=unavailable autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 2BCF61E0C2 for ; Thu, 5 Jun 2025 16:17:52 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D157D385AC32 for ; Thu, 5 Jun 2025 20:17:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D157D385AC32 Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id F1AF33857B84 for ; Thu, 5 Jun 2025 20:17:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F1AF33857B84 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F1AF33857B84 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1749154628; cv=none; b=TtoOHKIMwuqyiGqijFYkHCka7C1mdQSxIuDolqaEVsZeGmuOyQwZO+eDPn5vgLh5x7V3Y7AQdIRW+0Qz1Qk2tugfkf2dNZYO3R1hriHv0kslsARAfCkT7dvKyTpAFCtfkjsUJvMtp91uJ53OBiY8KqQqYdaWcHTzskMK0KmfRbA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1749154628; c=relaxed/simple; bh=Jr2fdOy31fbTfIlH3R4IEcDfZ4ZNEdRgH19hp1PXrUw=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=SZa/tg8WPiFeJsaXNxbg6TydE6RyzjD8vbUVGJNkCCM4giaG99j5BodM/1tWnAhGUhraFvrbCrJcouw9kBLYdf7DK/h9IXTzRMkVeEbp3S8+ofwTeO9v0sV9Iun4AKhXsK+uStr6dMRCE13FChH3D4JzDaAGKSFdAOvuQtA0Yyc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by simark.ca (Postfix, from userid 112) id 153621E102; Thu, 5 Jun 2025 16:17:06 -0400 (EDT) Received: from localhost.localdomain (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 065001E11C; Thu, 5 Jun 2025 16:16:59 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Lancelot Six , Simon Marchi Subject: [PATCH 4/5] gdb/amd-dbgapi: factor out require_forward_progress overload to target one inferior Date: Thu, 5 Jun 2025 16:16:27 -0400 Message-ID: <20250605201657.418206-4-simon.marchi@efficios.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250605201657.418206-1-simon.marchi@efficios.com> References: <20250605201657.418206-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org A following patch will want to call require_forward_progress for a given inferior. Extract a new require_forward_progress overload from the existing require_forward_progress function that targets a specific inferior. Change-Id: I54f42b83eb8443d4d91747ffbc86eaeb017f1e49 --- gdb/amd-dbgapi-target.c | 49 +++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/gdb/amd-dbgapi-target.c b/gdb/amd-dbgapi-target.c index 1ec20d1874ec..e86d7f34d0f6 100644 --- a/gdb/amd-dbgapi-target.c +++ b/gdb/amd-dbgapi-target.c @@ -443,6 +443,32 @@ async_event_handler_mark () mark_async_event_handler (amd_dbgapi_async_event_handler); } +/* Set forward progress requirement to REQUIRE for inferior INFO. */ + +static void +require_forward_progress (amd_dbgapi_inferior_info &info, 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 (!info.inf->process_target ()->commit_resumed_state); + + gdb_assert (info.process_id != AMD_DBGAPI_PROCESS_NONE); + + /* Don't do unnecessary calls to amd-dbgapi to avoid polluting the logs. */ + if (info.forward_progress_required == require) + return; + + const auto progress + = require ? AMD_DBGAPI_PROGRESS_NORMAL : AMD_DBGAPI_PROGRESS_NO_FORWARD; + const auto status + = amd_dbgapi_process_set_progress (info.process_id, progress); + gdb_assert (status == AMD_DBGAPI_STATUS_SUCCESS); + + info.forward_progress_required = require; +} + /* Set forward progress requirement to REQUIRE for all processes of PROC_TARGET matching PTID. */ @@ -450,12 +476,6 @@ 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 ()) @@ -463,21 +483,8 @@ require_forward_progress (ptid_t ptid, process_stratum_target *proc_target, amd_dbgapi_inferior_info *info = get_amd_dbgapi_inferior_info (inf); - if (info->process_id == AMD_DBGAPI_PROCESS_NONE) - continue; - - /* Don't do unnecessary calls to amd-dbgapi to avoid polluting the logs. */ - if (info->forward_progress_required == require) - continue; - - amd_dbgapi_status_t status - = amd_dbgapi_process_set_progress - (info->process_id, (require - ? AMD_DBGAPI_PROGRESS_NORMAL - : AMD_DBGAPI_PROGRESS_NO_FORWARD)); - gdb_assert (status == AMD_DBGAPI_STATUS_SUCCESS); - - info->forward_progress_required = require; + if (info->process_id != AMD_DBGAPI_PROCESS_NONE) + require_forward_progress (*info, require); /* If ptid targets a single inferior and we have found it, no need to continue. */ -- 2.49.0