From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +miHLQQ0x2DDPgAAWB0awg (envelope-from ) for ; Mon, 14 Jun 2021 06:48:36 -0400 Received: by simark.ca (Postfix, from userid 112) id AC1B31F163; Mon, 14 Jun 2021 06:48:36 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 6731D1E54D for ; Mon, 14 Jun 2021 06:48:34 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 61E82383300A for ; Mon, 14 Jun 2021 10:48:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 61E82383300A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1623667713; bh=YuEzKUPYhCng5sIHR2YPGgkUnfPfHQooE6TzQG7ltC0=; h=To:Subject:Date:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=P/mAN3PqxYwMNziabrn6Xw3IXJEPdJGQMKDqVYX8tbNyBPMUy5yYL0TuIV2U3nNE3 aqhBFLbd5fch0r9nzuTHQYKkksk07hkx08Zn1YXSSG+9l4labdy+RUdnUIjtC4T8cY iTLWxUA3DzUcJNHGIoBnqmqVZArmQRAeEppToPBM= Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by sourceware.org (Postfix) with ESMTPS id 951DB3943439 for ; Mon, 14 Jun 2021 10:47:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 951DB3943439 IronPort-SDR: CJBAqBajF9C38ZyJZwCX1m9JcaiC/7qMYeUkEV4d66sraLttm0xnSQ4RWvQed6DvyWO10WD4qD TWyxsUEfEQUQ== X-IronPort-AV: E=McAfee;i="6200,9189,10014"; a="192903839" X-IronPort-AV: E=Sophos;i="5.83,273,1616482800"; d="scan'208";a="192903839" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2021 03:47:51 -0700 IronPort-SDR: k2cKZWPCK9lhKYQUhjMeC4fBdf9jpAL3j1M5WuqmtkIrHxKmsBsZyMpGtg5bQIsrd+JmBGQrJ9 RCwETnofOnHw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,273,1616482800"; d="scan'208";a="553325737" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga004.jf.intel.com with ESMTP; 14 Jun 2021 03:47:51 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Mon, 14 Jun 2021 03:47:51 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Mon, 14 Jun 2021 03:47:50 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4 via Frontend Transport; Mon, 14 Jun 2021 03:47:50 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.177) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.4; Mon, 14 Jun 2021 03:47:50 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h/pnmwAtNdj3GYEWdvKAvI/yvjOMQO3J1zzHwv6aW07z1uaR2lTOEvfGDaP2r87E5IZLpJkIJs9nfK1FKOLSGmnW4qp9/iM0s9iSk37eSrs3I2rNtOawcya8M7MkWHAKqt8oygk9yvmuP1rb7kdw9S0SSXLBXkyoC/1QLM4drM/pOtxB8nmsxYF3ZF1/T0rSEm6dARZgsiN1Is0VTBYE595SL72HU6ELezX8Iu0jTfMDSK99yRN70eY94EpMyBhACjfPIT903UaPcpydlqpT+T5V1cq1WVP46uha3w4tqpcsiHmOo6p0Qw2MW1pLjHlRfuT+i4cOHAXvFOMZOj10EQ== 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-SenderADCheck; bh=UnrDjga1pvzAVxbLnribrb8Ayax+kDlpi9V+IUw0K2Y=; b=Vf1P01WetHajHF87yvKLPCZI1wH7bAIxpDMd1AE07aDYfN6v421q+KCQOhXWnQdapuK48inzPrKwOzvlXYavRivHz7S0BUo/s4Wayn7UxzIxD6kIQkv5YLh5PPw1A0i/IjwOSbrxAM/5IpplMDaJgv51YPcvFdS5Fu18n9LCI5aNuGsLg5RFrJ5kOi+TBvNCNOLdzrLFTm/TRPisqEraKQiA9dEp3vCxCozxCnX6yn0WWSfqfsvTal4XQaeUElilZwXi2EUCQ8Zk82jApxIEfRBZilhIxToH5H7oO9DcUexoa6xj/NaRyAIbetyvADrXSWDCJ4p7pbrk24wVqxYC8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM6PR11MB2588.namprd11.prod.outlook.com (2603:10b6:5:c6::18) by DM6PR11MB4378.namprd11.prod.outlook.com (2603:10b6:5:1d8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.22; Mon, 14 Jun 2021 10:47:49 +0000 Received: from DM6PR11MB2588.namprd11.prod.outlook.com ([fe80::b5dc:abd4:19c1:c05e]) by DM6PR11MB2588.namprd11.prod.outlook.com ([fe80::b5dc:abd4:19c1:c05e%7]) with mapi id 15.20.4219.025; Mon, 14 Jun 2021 10:47:49 +0000 To: Andrew Burgess Subject: RE: [PATCH 2/2] gdb: Improve the resuming of the stepped thread Thread-Topic: [PATCH 2/2] gdb: Improve the resuming of the stepped thread Thread-Index: AQHXW3kmMI6PUJhSXEOrIhyo9EXBc6sIkJgAgArMtqA= Date: Mon, 14 Jun 2021 10:47:49 +0000 Message-ID: References: <1623055323-3331-1-git-send-email-aleksandar.paunovic@intel.com> <1623055323-3331-3-git-send-email-aleksandar.paunovic@intel.com> <20210607134818.GT2672@embecosm.com> In-Reply-To: <20210607134818.GT2672@embecosm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.5.1.3 dlp-product: dlpe-windows x-originating-ip: [88.217.47.255] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: aeed241a-816c-4733-a0e4-08d92f21da5c x-ms-traffictypediagnostic: DM6PR11MB4378: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: aH35KyRPTSMnscXPi8Qo9ea5cjl6R1TLOXh3UdHWPauGVa4ovS8TA2jTo59FxW9Qn62ne5ss6FmK54l9S2H/2/WDxql3Yn8EKD/P5U2LzzSQ3gYWWI7ExaJnKB+9G3bcBWQv4eNkfkNYxeQsnHW2xbsO0yzn4tZWxJ3pP//zUKxKVnezKaMF0xCztF16Zb2BtyWeiD0kac5FIPSChLcio24g+97uI0317l2POjvF9nxFlZQ++FONYD0jwQbqyI7z5HLPDaPYiBze8NVuI1exrWYI2AsWd5fiTpWA39SiIJvKvOAGkG3pvAJrG6545Y7bMCaAhH33X5hf/GwE+NNRMfukuund+NjgE+yQLnjQYTHUwR43YFzNgbZ2KQmh4AS1WhRgBbKug6E9Lo+RInjh13VjqwQk55IwhsTD2mZCRIVRVYk3KclSXSsx9O25YqllhvsLHHdT5aY3nnm9DbB72/WAZ+KV+Rj/Rpp02wnDaxLjw95Ks8DnQ6H66WdYTuFThjbA585noL21RetvgnEKGBdV2oxtb1Fl3QV0elN7mrr5UIN7tvSK0JqR3H/hQVDyoz6Lv578P1XF4fxHPBA36MUzLt98PzRqOTU00LL14C4= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB2588.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(346002)(376002)(396003)(136003)(39860400002)(6916009)(38100700002)(122000001)(33656002)(7696005)(66946007)(316002)(66446008)(64756008)(66556008)(76116006)(66476007)(55016002)(5660300002)(83380400001)(186003)(2906002)(9686003)(4326008)(52536014)(86362001)(26005)(71200400001)(8676002)(478600001)(6506007)(8936002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?MR2aEaNYV6bTM4iEL+/XED3ebZpIr7yne5kUujtyyZ1AW+qf3APtcFtEoj1E?= =?us-ascii?Q?4pjsgE1y0nlLobEJ/LAl8F0g4FLT/BYPWG5XhOydJRfxa4eIuPvt0txBq60V?= =?us-ascii?Q?t/BAp7TcrVuUpX+kQLRE6vm1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+OqEbfbMTlU7V9RPQIyNZH8hFBbwBVI3AFQBBEcZRH1c1m1Fe6uWbw39gw?= =?us-ascii?Q?KNDUXbBhDNpN0EVEWE7Ov1lv8ZZSyfV+DBkL46ZwuyKPDLjwy8o9/f4oqaCK?= =?us-ascii?Q?xjvdtsEXesInh34cYLG+iTMlFT7LGMajNm289ad+PDH/S+hyBvdyP4GRfThq?= =?us-ascii?Q?AbCWilBEz12JfcN9+R9hFC8JdOipMV2SLffCyp9CZvdEHfVEy1y3QvE6jBgo?= =?us-ascii?Q?HCOOU5Iy4nYd8RI5auKn8Z/mnEp5WI30PkMDbZwQTz7Tvlkynb5BWHuwkAJS?= =?us-ascii?Q?LAc=3D?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB2588.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: aeed241a-816c-4733-a0e4-08d92f21da5c X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jun 2021 10:47:49.2476 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: DxGQ3LrPp+eqd5Fu5+7HW8lIU8/3DhK4NLDAnv+dNfqkI269ZasvzgRxdJt25D2ZehAHh9maPs2XuHLmglVMruQdJUsHjoovExRSbOuFwOw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4378 X-OriginatorOrg: intel.com Content-Transfer-Encoding: quoted-printable X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Paunovic, Aleksandar via Gdb-patches" Reply-To: "Paunovic, Aleksandar" Cc: "gdb-patches@sourceware.org" Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" >> From: Aleksandar Paunovic >> = >> Stepped thread should not be resumed (again) if the next stopping = >> point (next stopping PC) cannot be determined. Do not resume the = >> stepped thread in this case. Resuming would lead to an inconsistent = >> state where the stepped thread would be running forever and GDB would = >> never get to breakpoints of the other threads. */ >> = >> gdb/ChangeLog: >> 2021-04-30 Aleksandar Paunovic >> = >> * infrun.c (keep_going_stepped_thread): Do not resume an >> already executing thread. >> = >> gdb/testsuite/ChangeLog: >> 2021-04-30 Aleksandar Paunovic >> = >> * gdb.base/breakpoint-running-inferior.exp: Add a start_step >> function check. >> = >> 2021-06-07 Aleksandar Paunovic >> --- >> gdb/infrun.c | 15 ++++++++++++++- >> .../gdb.base/breakpoint-running-inferior.exp | 5 +++++ >> 2 files changed, 19 insertions(+), 1 deletion(-) >> = >> diff --git a/gdb/infrun.c b/gdb/infrun.c index 78da1f0e72..459a679ee6 = >> 100644 >> --- a/gdb/infrun.c >> +++ b/gdb/infrun.c >> @@ -7529,7 +7529,7 @@ restart_after_all_stop_detach = >> (process_stratum_target *proc_target) >> = >> /* Set a previously stepped thread back to stepping. Returns true on >> success, false if the resume is not possible (e.g., the thread >> - vanished). */ >> + vanished, or the thread breakpoint position cannot be determined). = >> + */ >> = >> static bool >> keep_going_stepped_thread (struct thread_info *tp) @@ -7566,6 = >> +7566,19 @@ keep_going_stepped_thread (struct thread_info *tp) >> delete_thread (tp); >> return false; >> } >> + /* Step start function determines the location of the next stopping >> + point (next PC where the stepped thread should stop). In case that >> + this position cannot be determined the step_start_function will not >> + be set. Do not resume the stepped thread in this case. Resuming >> + would lead to an inconsistent state where the stepped thread would= be >> + running forever and GDB would never get to breakpoints of the other >> + threads. */ >> + if (tp->control.step_start_function =3D=3D nullptr) >> + { >> + infrun_debug_printf ("not resuming previously stepped thread, it = is " >> + "already executing"); >> + return 0; > >I don't understand why the condition you're checking means that the thread= is already executing. > >Also, your comment says step_start_function is the pc where we should next= stop, but it is set with find_pc_function, which just gives the symbol for= the function containing the $pc when the step/next was started, so I don't= understand why this tells GDB where to stop. > >Also 'return false'. > >Thanks, >Andrew Actually now when I tested this further I saw that this check (the whole pa= tch) is unnecessary because GDB recovers successfully. Originally the regcache_read_pc function call (10 lines below my change) wa= s throwing "PC register is not available" but it seems in the meantime this= is fixed. I will put only first patch for review. >> + } >> = >> infrun_debug_printf ("resuming previously stepped thread"); >> = >> diff --git a/gdb/testsuite/gdb.base/breakpoint-running-inferior.exp = >> b/gdb/testsuite/gdb.base/breakpoint-running-inferior.exp >> index bb0406bc65..b95f2ec012 100644 >> --- a/gdb/testsuite/gdb.base/breakpoint-running-inferior.exp >> +++ b/gdb/testsuite/gdb.base/breakpoint-running-inferior.exp >> @@ -74,10 +74,15 @@ gdb_test "next" ".*Thread 2.*hit Breakpoint.*" "next= while in inferior 1" >> = >> # We should be able to normally switch to thread 1.1. >> # In case of a bad GDB flow the GDB was losing the thread. >> +# The thread should also not be in a "running" state because it is # = >> +stopped. >> gdb_test_multiple "thread 1.1" "Switching to thread 1.1" { >> -re "\\\[Switching to thread 1.1 \\(Thread .*\\)\\\]" { >> pass $gdb_test_name >> } >> + -re "\\\[Switching to thread 1.1.*\\(running\\)" { >> + fail $gdb_test_name >> + } >> -re ".*Thread ID 1.1 has terminated.*" { >> fail $gdb_test_name >> } >> -- >> 2.17.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