From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by sourceware.org (Postfix) with ESMTPS id 1AEAD3858427 for ; Fri, 1 Mar 2024 15:53:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1AEAD3858427 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1AEAD3858427 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709308395; cv=none; b=u+qKZqfgngoFWAhiTPVKh3u7yzAdiAtFuNe4eg4SzlHOnlNHeS/FoMBWxvvDFiGWwPz9226dEPy5uMhtXc1g9yJj1URXl6WYUaEB1nKGXi7m+emtp9jTT/yOqKjdrU/yGYzHvhjYQdCBQAeCYTa3/GdHG2CSwFRfuQs+yCqvFq4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709308395; c=relaxed/simple; bh=gMWZqtNPsvUyrRCEN9Z/YvAMhGvvYSCAO0hzAUQE/3Q=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=FH1CkHwAeW9HCMS6uMomF8xr/fN2CIjFHiG/RAOCVMEMhEO1s9W89jUUGRzk2mdkVWsKKe/ozk8JNiCBOzjQomKZvZsN/tpg36RoBa79ElhNk1OHQEebqeCUPkjmpK+vMgH7UK8FDhSUADZ4+KXH8nwHf8ZDy2ozMoE9punMG4k= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709308392; x=1740844392; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=gMWZqtNPsvUyrRCEN9Z/YvAMhGvvYSCAO0hzAUQE/3Q=; b=AC5NZUUbrBmKsc56c9XUewhszQaLmLyGMQ3Yg8U50TLeFg9+qf33armi bnTG3MMw9SI9LXu6KGpAONi0QLcHyRksO7ivUKz7QCGU059b3v3K2D/PW RH1njRx1hlMAxT77TcARZBP6P9BhT13ko1eptTt8rxfglFlfDtjGOiBlH M3IS8D92Ritnwnrfg9jkqYgxmp+2kpMYKPnfxa1uFfrMW26XNwRbgya5B 61Nex44hIufXagTXzPpIL3phw3NiPRFc+1yOEId81ERQ0GlxzdH3TzcRI 1HAYnUGNft83N0y6ac9zaEEMliHCI6+Kl6O1MrSMfQI4x6wHN+EgDwvZx w==; X-IronPort-AV: E=McAfee;i="6600,9927,11000"; a="7621304" X-IronPort-AV: E=Sophos;i="6.06,196,1705392000"; d="scan'208";a="7621304" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2024 07:53:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,196,1705392000"; d="scan'208";a="8187801" Received: from gkldtt-dev-004.igk.intel.com (HELO localhost) ([10.123.221.202]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2024 07:53:10 -0800 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org Subject: [PATCH] gdb: iterate over targets, not inferiors, to commit resumed Date: Fri, 1 Mar 2024 16:52:59 +0100 Message-Id: <20240301155259.1507053-1-tankut.baris.aktemur@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.6 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: When committing resumed threads of targets, iterate over targets, not inferiors, so that we don't call commit_resumed multiple times for targets that have multiple inferiors. This gives more concise code. Similarly, iterate over targets when setting the commit_resumed_state of targets. No behavioral change is expected or intended with this patch. --- gdb/infrun.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index bbb98f6dcdb..af9c00d32e3 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3210,16 +3210,10 @@ maybe_set_commit_resumed_all_targets () { scoped_restore_current_thread restore_thread; - for (inferior *inf : all_non_exited_inferiors ()) + for (auto *proc_target : all_non_exited_process_targets ()) { - process_stratum_target *proc_target = inf->process_target (); - if (proc_target->commit_resumed_state) - { - /* We already set this in a previous iteration, via another - inferior sharing the process_stratum target. */ - continue; - } + continue; /* If the target has no resumed threads, it would be useless to ask it to commit the resumed threads. */ @@ -3243,7 +3237,7 @@ maybe_set_commit_resumed_all_targets () continue; } - switch_to_inferior_no_thread (inf); + switch_to_target_no_thread (proc_target); if (target_has_pending_events ()) { @@ -3267,14 +3261,12 @@ maybe_call_commit_resumed_all_targets () { scoped_restore_current_thread restore_thread; - for (inferior *inf : all_non_exited_inferiors ()) + for (auto *proc_target : all_non_exited_process_targets ()) { - process_stratum_target *proc_target = inf->process_target (); - if (!proc_target->commit_resumed_state) continue; - switch_to_inferior_no_thread (inf); + switch_to_target_no_thread (proc_target); infrun_debug_printf ("calling commit_resumed for target %s", proc_target->shortname()); -- 2.34.1 Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928