From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2060e.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5a::60e]) by sourceware.org (Postfix) with ESMTPS id 29AC23858C1F for ; Wed, 22 Mar 2023 16:35:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 29AC23858C1F Authentication-Results: sourceware.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eyARjnyDBDofTcUFvEuFcIcW7PObyCFrjb3RVciZselPbwFP3Bgh89JzaFTpGkeu87Hq1GtMe5g3qDQlJrn5+VUQA0o+6wm0vSo6puueteXyT7BIcjv+EUwj7ceeHuhYkJTxiClANdloD3pF9CPsFzptB66MAih/3Xcw7hUi2XAgoc1i7+N52X+fiaajIxvWE0lOBYPWc/bvJt+DFuifV9gJnnq12+NQRJaXzjsJERNIGXhaCvN5wsNuL+hKjdHWd27q95tsoiH/vwP/THgKsVcAu44f89V5vrXpEJHurisMkm5dqfzpM4asAeNJoPa8nlQKYva7ChfZIKVZgqAfAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GxXY2sICo4V+8fe4Kg2Hx088Y48z7T61fupwVTzAGps=; b=MeFiwJgUZcfjbd8BRWQflVS3vNEa07Kw3M2KuC6FmeKp2bEIwNeGPKFK5c81jTwVBBUSBe++2I77IJzTRNBneRNIh34wkRDOSrMWQhLDIlhAeKj5YBcXj9dP1EKKc53bAHB896+Eaz+ga5VmOERv6f8dO16b9q8Ub6eoK6wuRj6qbASJ1+X2kVjzDDl174uWFxO9/eFrR7nUbJk//XCw2D0O24y/mTu4wGhD3TwL0HaeTUZXdzRX+fey89scG2CQ61vzNvN7U9xNP/Y0NiZj9pvyfb0Z3RJSaNc/2wDXgFudSFNBE8yfQF57LZpbd/l+671gmDa40IGNixzJScQY4g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=sourceware.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GxXY2sICo4V+8fe4Kg2Hx088Y48z7T61fupwVTzAGps=; b=djwloqcq9Y9PTZmWyOP4jceEGF5nU0HSuWFPTp3K8UdgAoX64NnoQcogmziSBkwYt7dTYrK8T5iaoa5yYv8WryhryLl9whxIBzKzjb2wR7ofvOZ4DWPlmyAJGf6oNoC1Y+Lzjjs0kpioJbpDZyA+vmKlKRIXu3ojABRgZ83wDHY= Received: from BN9PR03CA0975.namprd03.prod.outlook.com (2603:10b6:408:109::20) by CH0PR12MB5043.namprd12.prod.outlook.com (2603:10b6:610:e2::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Wed, 22 Mar 2023 16:35:25 +0000 Received: from BN8NAM11FT083.eop-nam11.prod.protection.outlook.com (2603:10b6:408:109:cafe::da) by BN9PR03CA0975.outlook.office365.com (2603:10b6:408:109::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Wed, 22 Mar 2023 16:35:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT083.mail.protection.outlook.com (10.13.177.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6222.17 via Frontend Transport; Wed, 22 Mar 2023 16:35:25 +0000 Received: from khazad-dum.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 22 Mar 2023 11:35:23 -0500 From: Lancelot SIX To: CC: , Lancelot SIX Subject: [PATCH v6 1/3] gdb: add inferior parameter to target_is_non_stop_p Date: Wed, 22 Mar 2023 16:35:02 +0000 Message-ID: <20230322163504.560986-2-lancelot.six@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230322163504.560986-1-lancelot.six@amd.com> References: <2daa1736-57cb-3c5a-f1cd-48f5aa03d010@simark.ca> <20230322163504.560986-1-lancelot.six@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT083:EE_|CH0PR12MB5043:EE_ X-MS-Office365-Filtering-Correlation-Id: b1560a6f-baa0-4cc1-33e1-08db2af3707f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: As6G+51jnIWF/BEfNW1ce2J8ZJESXiwv6nB7NPrxBP8YcwkJ1I5ViDkQOLue13nMyhUmxyN1M3aSG9NrTZw9RuLmP3HYr21BbJk5yo4QZvMsroscXOl+aCQnqvQl2YCb7Yk0DURxE3TQRPU3VCSsFPq0LHVb/e+1G0/lHE36GhxT5BEgEJzFRH6fkNY5HHaVxkgfs50ApQpj7Ks6CtZYSq4FJrezMuMyGSwXX9AeABBawtJQcgOvRfT8a5bb/qTe+c+EhsKNOgdp8SPnB2s9ZxerT/tpoKEcxRlZyErZvx1YvGChNpHTjjS0HwIeP7amkWbthxM+OQUtNJw+7wYY/zFP7nSUsY1WofbQM5WB1tRZ/JESU4Ggda/rtpB4VMmdLpUlbxmvmAg8IrcTKgU0E/AfeQPgfBbPCqUKeSsuEEZuSecjgvH1qVpY1JOeGxd/+B9uFQR0eGZNAcRDxyT1bvC3SzR4F9Lk4o1/Vq5ytOJXeW+c6UcQAXG8wAeS5p2IvW5C+AE5wq7apgzSUxc671WzYiZDM/jtjCO36Gadnm88VqH0lq8oOBTD/E9GYOqAkIUJZDKPVZbO4t97o4q1Qu8L9oAtIkpzx8I51AmFsZAR6nrmJn22Aq6aXvoUxcgpewUo+EkulnAs+aYXlEiCDKux7lw9ua/w7UCKlkeb5vx1dkEVJhG7gLbYZ9A+3cAtgo8lGH9fdHbyTvriq/vtxgnNkN1PmwgTHYDWIRwex5w= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(396003)(376002)(346002)(136003)(39860400002)(451199018)(40470700004)(46966006)(36840700001)(356005)(2616005)(6666004)(336012)(1076003)(16526019)(26005)(7696005)(186003)(86362001)(47076005)(426003)(82310400005)(54906003)(2906002)(40460700003)(478600001)(82740400003)(83380400001)(81166007)(316002)(4326008)(8676002)(40480700001)(36860700001)(41300700001)(70586007)(8936002)(6916009)(70206006)(5660300002)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 16:35:25.5392 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b1560a6f-baa0-4cc1-33e1-08db2af3707f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT083.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5043 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,GIT_PATCH_0,SPF_HELO_PASS,SPF_NONE,TXREP 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: This patch add a "inferior *inf" parameter to the target_is_non_stop_p function. The default value is nullptr so all existing calls remain valid. This will be used in the following patch. --- gdb/target.c | 9 ++++++++- gdb/target.h | 8 +++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/gdb/target.c b/gdb/target.c index 0cebecfafc3..5e5d1054541 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -4391,8 +4391,15 @@ target_always_non_stop_p (void) /* See target.h. */ bool -target_is_non_stop_p () +target_is_non_stop_p (inferior *inf) { + gdb::optional restore_thread; + if (inf != nullptr && inf != current_inferior ()) + { + restore_thread.emplace (); + switch_to_inferior_no_thread (inf); + } + return ((non_stop || target_non_stop_enabled == AUTO_BOOLEAN_TRUE || (target_non_stop_enabled == AUTO_BOOLEAN_AUTO diff --git a/gdb/target.h b/gdb/target.h index 2dac86c394d..ffa6d95becd 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1892,10 +1892,12 @@ extern void target_thread_events (int enable); non-stop mode is enabled. */ extern enum auto_boolean target_non_stop_enabled; -/* Is the target in non-stop mode? Some targets control the inferior +/* Is INF's target in non-stop mode? Some targets control the inferior in non-stop mode even with "set non-stop off". Always true if "set - non-stop" is on. */ -extern bool target_is_non_stop_p (); + non-stop" is on. + + If INF is nullptr, check the current inferior. */ +extern bool target_is_non_stop_p (inferior *inf = nullptr); /* Return true if at least one inferior has a non-stop target. */ extern bool exists_non_stop_target (); -- 2.34.1