From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by sourceware.org (Postfix) with ESMTPS id 07DA93858D37 for ; Mon, 26 Oct 2020 12:11:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 07DA93858D37 IronPort-SDR: mv01DTxwKqZKt5A6WFCkYaA3qRiqRD7Nd0Y1PDOakdn4PFQ6Yl46hX/gRWg5orM1uogco4rQrz 8hFyKDMoGVfA== X-IronPort-AV: E=McAfee;i="6000,8403,9785"; a="164413846" X-IronPort-AV: E=Sophos;i="5.77,419,1596524400"; d="scan'208";a="164413846" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2020 05:11:09 -0700 IronPort-SDR: 7o7M6L+0vDCH7GVe63rDu9f5pLjZKtgLKEcFRNDu5cCXPsCxuMz95OSt6TxijePa+TYh+bnXeR r8/NbqjBGIJQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,419,1596524400"; d="scan'208";a="349875422" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga008.jf.intel.com with ESMTP; 26 Oct 2020 05:11:08 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 26 Oct 2020 05:11:08 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 26 Oct 2020 05:11:08 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 26 Oct 2020 05:11:08 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.107) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Mon, 26 Oct 2020 05:11:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WEKBBJxqowFCg82OxC4dtmT/24Aymi7Wlnb6/uaKjLsF+yOIcRz3XfwS/axubz8z15ZheU7p/kVANZ2cZMLWf8EV8I2iHr50Vpw/4+fDYxFCFv2O+dSWAFus0+3nM4XZa11SF8ZoBscOVi8XAeXeeWDxkCrteXDNKsyRjmflU6c5wM6i+FVvzW+U89QV4Yw2PSppOq6UqujVvrYT0mrRnfdUwOKBK3w0Rv4c4stqbYTngBk4pvgWD40453xuVL+d6RWydSbrepny5/kagLYM5MMvkxH1gS0VbPB9F/t3WMcrAUsWp+mgPqGcWaa9ifWHta3nfovO1U71gjUEtbJhTg== 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=Cz/lWpdL5Y4pCzFCFK/OEWd3v+K+VpQCefMygE9v8ug=; b=ena1I+atHlsVnFmQMc2/pUyyCEs+Jwm/R4lPlTmdCSmsHxIZJ+fuhnOnJ3uWeZAfris9L7btwY7kGjXL9F+oU4yugJWGW+vSA3wHX/BnqDnHQaOCsHvrXnNoBtDeAiNoVQ7zuLtGzjQgcvUnixT7vlTI4jeL3yI52LR9HI/JA6l1VbzwPRVToNnpChBNHeJgb5+QgLz0HBX4JY7kDTBfqeflTHERVxhp8mg/2kcI7gecQqNVjK/VxAGPR/ZQ3aSRHwZP/OKKhH3N49Ec3ktyyzWoh0zZSt3WSZ0QWC2ATzup/Kw9u81I4GA2ZbVmSyE9+WGEoxqBmzQkvcbmB1QYow== 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 SN6PR11MB3406.namprd11.prod.outlook.com (2603:10b6:805:bb::33) by SA0PR11MB4736.namprd11.prod.outlook.com (2603:10b6:806:9f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Mon, 26 Oct 2020 12:11:06 +0000 Received: from SN6PR11MB3406.namprd11.prod.outlook.com ([fe80::e0a3:b08d:35:c964]) by SN6PR11MB3406.namprd11.prod.outlook.com ([fe80::e0a3:b08d:35:c964%7]) with mapi id 15.20.3499.018; Mon, 26 Oct 2020 12:11:06 +0000 From: "Saiapova, Natalia" To: 'Kevin Buettner' , Natalia Saiapova via Gdb-patches Subject: RE: [PATCH v2 4/6] gdb/infrun: in condition evaluation wait only for the current inferior. Thread-Topic: [PATCH v2 4/6] gdb/infrun: in condition evaluation wait only for the current inferior. Thread-Index: AQHWni9mIwPmwUX/GESHmp+0ouYHM6meNmWAgAcOW3A= Date: Mon, 26 Oct 2020 12:11:06 +0000 Message-ID: References: <20200831123519.16232-1-natalia.saiapova () intel ! com> <20201009112719.629-1-natalia.saiapova@intel.com> <20201009112719.629-5-natalia.saiapova@intel.com> <20201018184429.06921e24@f32-m1.lan> In-Reply-To: <20201018184429.06921e24@f32-m1.lan> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.5.1.3 dlp-reaction: no-action x-originating-ip: [83.102.203.130] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f6e3280a-3541-4610-5e41-08d879a837a9 x-ms-traffictypediagnostic: SA0PR11MB4736: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:972; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: m2tOu7NUIA0raxJ9gaazkOEaVhDMgn+E9pslyWrk2LQoDiO1kQnupItJal6nSpeDuYf81/Ugg9W9KfEndNhLXuv3H2gIFs0HD1If6Eq06dpSKdp0V6k++fuZzGCN06u+Q9ZvrM6b63LXY6Hhr8sd6dSij7o6+FYs7mnuovo+fNNtJeecmlCFekXoj1x1FoKG0cejw+zmj9FnzqK7TSBNBf4fBmERmVTRX34REoc7Ha7pYrtHD9xU+P5T21P5h16dTWEREr9NvajkJmXFA+mbTZ7kmDyJMdGwpUA1C6fCyJmrfFl1tlHpy8gVjbx2YanuUdrnXdMCClqPC0YsSzuVFAMfiC2EPjmPXTQQjJG/SRBJJqjT2Z7/4B69neRMD6V1Chaw180izAVaO0lq9u4IdUoi3zh+ubEd1g8pI+MlPhRXWO7ZykdXd/xg7BAVy8z1uFicpr1ksaST1SPmI705gw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB3406.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(396003)(366004)(39860400002)(136003)(376002)(26005)(66556008)(53546011)(55016002)(66946007)(64756008)(83080400002)(86362001)(7696005)(66476007)(76116006)(15974865002)(110136005)(5660300002)(6506007)(9686003)(71200400001)(316002)(8936002)(478600001)(66446008)(2906002)(8676002)(52536014)(33656002)(83380400001)(186003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: SN4fYC4wbgwgye6MnfCTUdTAruHFLlVsRDqfo0prj62+52ZUVVq3NeZXVOSjz6j8u8VvNP7Rz19QXWy0dl1nR4imMn09r8aEjTjDCaEhytBFGkFrtk73t8Qis3s6cbzEDtNibmv6T3njDwLG+ZYIJU5LledvQwS/FmoZ/qG3sIZ453r2cbQdlkG43JtWK2iLOT3YUyPsTXm9w/GOSdE1lzd0Sz15n01SObzaEjh78grPHFFkDdNcTmMvHEReLPhjBW+cicQcQ6+vQg91xJc7PhG9pU6clJWhAxPGs+w+Yf6M6DDPmG5jfuoBvOLWIPT+nrLBUDThzQtakuibaO8/nbSIkJNrukDZWI1T2dhNVIQEJhUyXF77JCeRGy0VHn+4amKEcuH08G8vPFTqHiecto1Lm+DfgKUAP6LdquzA2IQYISEfOogfn38pGFFXNwzl5CJA3h9AQVtmAhnIl+Y/Rt/HNdUmrYsWu9xk3cY4jLNlOS3Qsp2JS8xig4yic3xqCHyy/GcCiP0OUQgIXqXHb+WGhJpcL6EV1FgHvjLArtC1fXUzpgKHeJ0nkM7qFE5vgnjTMD/ilg6RkJoroEKQDqXTh+6AupVix80Alzqhukz+mzgrKqv260BQw1wp6GVfnd49Pdmprz4r4KJ/cpOqbg== 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: SN6PR11MB3406.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f6e3280a-3541-4610-5e41-08d879a837a9 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Oct 2020 12:11:06.7069 (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: rDAt42T26VErIF2YVMYHeUPZUSRvmgWSujbO0enEJ/TDpMkCDsh/ixZmBw+DTKufdQRL2Prj2EtY/HTuFcJj+OXaW4xAUbBHQTvuMVhjL/0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR11MB4736 X-OriginatorOrg: intel.com Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_INVALID, DKIM_SIGNED, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Mon, 26 Oct 2020 12:11:13 -0000 Hi Kevin, Thank you for looking into this! See my answer below. Regards, Natalia > -----Original Message----- > From: Kevin Buettner > Sent: Monday, October 19, 2020 4:44 AM > To: Natalia Saiapova via Gdb-patches > Cc: Saiapova, Natalia > Subject: Re: [PATCH v2 4/6] gdb/infrun: in condition evaluation wait only= for the > current inferior. > = > Hi Natalia, > = > I have a question about this commit. See below. > = > On Fri, 9 Oct 2020 13:27:16 +0200 > Natalia Saiapova via Gdb-patches wrote: > = > > In the middle of a condition evaluation, to successfully finish the > > inferior call we need to wait for events from the current thread. > > Otherwise, a pending event from another thread might be taken and > > the inferior call is abandoned. > > > > gdb/ChangeLog: > > 2020-08-26 Natalia Saiapova > > Tankut Baris Aktemur > > > > * infrun.c (do_target_wait): Match an inferior PID with the > > expected PID. > > (fetch_inferior_event): In condition evaluation, wait for the > > event from the current inferior. > > > > Co-authored-by: Natalia Saiapova > > Co-authored-by: Tankut Baris Aktemur > > > > Signed-off-by: Natalia Saiapova > > --- > > gdb/infrun.c | 17 +++++++++++++---- > > 1 file changed, 13 insertions(+), 4 deletions(-) > > > > diff --git a/gdb/infrun.c b/gdb/infrun.c > > index 91271c2ddbe..d260eb6e3a7 100644 > > --- a/gdb/infrun.c > > +++ b/gdb/infrun.c > > @@ -3565,10 +3565,11 @@ do_target_wait (ptid_t wait_ptid, > execution_control_state *ecs, > > polling the rest of the inferior list starting from that one in a > > circular fashion until the whole list is polled once. */ > > > > - auto inferior_matches =3D [&wait_ptid] (inferior *inf) > > + ptid_t wait_pid_ptid {wait_ptid.pid ()}; > > + auto inferior_matches =3D [&wait_pid_ptid] (inferior *inf) > > { > > - return (inf->process_target () !=3D NULL > > - && ptid_t (inf->pid).matches (wait_ptid)); > > + return (inf->process_target () !=3D nullptr > > + && ptid_t (inf->pid).matches (wait_pid_ptid)); > > }; > = > I'm puzzled by the changes above. Can you explain what this is > about? (And perhaps add a comment...) When we come here from the infcall inside the condition, the wait_ptid has = a form {non-zero, non-zero, zero}, which corresponds to the thread started = the infcall. So, when we construct a ptid via ptid_t (inf->pid) in inferior= _matches function, it does not match the wait_ptid. That leads to ecs->ws.= kind =3D TARGET_WAITKIND_IGNORE and we are not getting the event. But we wa= it for an event from the thread which has started the infcall, so until we = get one we are in an infinite loop. = This code looks like the intention here is to find a matching inferior, so = we are interested only in the PID part of the wait_ptid. Thus, I made the c= hange. Does this make sense to you? > = > > > > /* First see how many matching inferiors we have. */ > > @@ -3906,7 +3907,15 @@ fetch_inferior_event () > > =3D make_scoped_restore (&execution_direction, > > target_execution_direction ()); > > > > - if (!do_target_wait (minus_one_ptid, ecs, TARGET_WNOHANG)) > > + ptid_t waiton_ptid =3D minus_one_ptid; > > + > > + /* If the thread is in the middle of the condition evaluation, > > + wait for the event from the current inferior. */ > > + if (inferior_ptid !=3D null_ptid > > + && inferior_thread ()->control.in_cond_eval) > > + waiton_ptid =3D inferior_ptid; > > + > > + if (!do_target_wait (waiton_ptid, ecs, TARGET_WNOHANG)) > > return; > > > > gdb_assert (ecs->ws.kind !=3D TARGET_WAITKIND_IGNORE); > > -- > > 2.17.1 > > > > Intel Deutschland GmbH > > Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany > > Tel: +49 89 99 8853-0, www.intel.de > > Managing Directors: Christin Eisenschmid, Gary Kershaw > > Chairperson of the Supervisory Board: Nicole Lau > > Registered Office: Munich > > Commercial Register: Amtsgericht Muenchen HRB 186928 > > Intel Deutschland GmbH Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Gary Kershaw Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928