From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id B9E993858020 for ; Mon, 19 Oct 2020 01:44:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B9E993858020 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-221-rEVIYXLcOqiBL2ABs03AOg-1; Sun, 18 Oct 2020 21:44:31 -0400 X-MC-Unique: rEVIYXLcOqiBL2ABs03AOg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6DC081853DA3; Mon, 19 Oct 2020 01:44:30 +0000 (UTC) Received: from f32-m1.lan (ovpn-112-216.phx2.redhat.com [10.3.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3F4081992D; Mon, 19 Oct 2020 01:44:30 +0000 (UTC) Date: Sun, 18 Oct 2020 18:44:29 -0700 From: Kevin Buettner To: Natalia Saiapova via Gdb-patches Subject: Re: [PATCH v2 4/6] gdb/infrun: in condition evaluation wait only for the current inferior. Message-ID: <20201018184429.06921e24@f32-m1.lan> In-Reply-To: <20201009112719.629-5-natalia.saiapova@intel.com> References: <20200831123519.16232-1-natalia.saiapova () intel ! com> <20201009112719.629-1-natalia.saiapova@intel.com> <20201009112719.629-5-natalia.saiapova@intel.com> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, 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, 19 Oct 2020 01:44:37 -0000 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 = [&wait_ptid] (inferior *inf) > + ptid_t wait_pid_ptid {wait_ptid.pid ()}; > + auto inferior_matches = [&wait_pid_ptid] (inferior *inf) > { > - return (inf->process_target () != NULL > - && ptid_t (inf->pid).matches (wait_ptid)); > + return (inf->process_target () != 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...) > > /* First see how many matching inferiors we have. */ > @@ -3906,7 +3907,15 @@ fetch_inferior_event () > = make_scoped_restore (&execution_direction, > target_execution_direction ()); > > - if (!do_target_wait (minus_one_ptid, ecs, TARGET_WNOHANG)) > + ptid_t waiton_ptid = 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 != null_ptid > + && inferior_thread ()->control.in_cond_eval) > + waiton_ptid = inferior_ptid; > + > + if (!do_target_wait (waiton_ptid, ecs, TARGET_WNOHANG)) > return; > > gdb_assert (ecs->ws.kind != 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 >