From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id TeTeII333GM54ygAWB0awg (envelope-from ) for ; Fri, 03 Feb 2023 07:01:17 -0500 Received: by simark.ca (Postfix, from userid 112) id 78D081E128; Fri, 3 Feb 2023 07:01:17 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=di22hQEU; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.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 CF59A1E110 for ; Fri, 3 Feb 2023 07:01:16 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F372C385842D for ; Fri, 3 Feb 2023 12:01:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F372C385842D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675425676; bh=A8t/D1becrumJEdsQf9PcwCixXtOo1EygK9f/w6JfhM=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=di22hQEUCnDTp2Fgr332VoIoRZDtM7ypI25oOgJTnX+sPXaLZOLdrHYFDnR9Zp3GJ 6qGxU5znxCH9B3cG8pg2rY72EMhauAGTGE+IWK2Jcq5XNaH+ntamaNJqAeN+0RrUkD RiXmAdcHQhcfdA5a7AXn6gr4P3ni2EBhk3jV3Fw0= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E2D1F3858D20 for ; Fri, 3 Feb 2023 12:00:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E2D1F3858D20 Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-306-rgSRNnZjMG2_QDMgpDPLfQ-1; Fri, 03 Feb 2023 07:00:52 -0500 X-MC-Unique: rgSRNnZjMG2_QDMgpDPLfQ-1 Received: by mail-qt1-f199.google.com with SMTP id f22-20020a05622a1a1600b003b8674f2302so2508137qtb.7 for ; Fri, 03 Feb 2023 04:00:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=A8t/D1becrumJEdsQf9PcwCixXtOo1EygK9f/w6JfhM=; b=jSpHlvX9IlZ+6Mj/9SO0T0RUUNFZtZzmwiqmG7wHQBKs1y07y7X2iRr9u2efR6X0aL LRqglpvjnXNPG5NPwzAyDa5nUlZKjXfNVTNr+1tJOND5DU91RudE97txgh5lxLyWvE8K 9KHt4/5Fvupdc6Voqlz/wPcd/FMmwulhu3yknnBGpx6aAUfbGq7YqNKpuZuRyGld5wJu FrBcnIGfe4WE8spqSvz2X0mc8IGdxLa2gfBDAuxfj1qEC8D0KbX7fxMq3eHUWH349QxM 5H7ooRk/kdPQR62HdeKGmzdyfG/pJWJcwnbiVBACJ4aRDH+fJkn5w9CLg5X4R1ZHAGNt FG0A== X-Gm-Message-State: AO0yUKXCx/Z3y6GJFizxrAtDA46u56IoKjekFkbktX7NxMdU9tQmUuLG vea5gTg8yvgBXxwgEsPkZGP0NJpjv2kOJdXmc+rYEVtSo3G9DAzBezcvAO14oplYf75VU6UItLP kI+A6i9FmU5QDCZ8e9BhvLQ== X-Received: by 2002:a05:6214:2d01:b0:537:633e:b13c with SMTP id mz1-20020a0562142d0100b00537633eb13cmr15013205qvb.41.1675425652006; Fri, 03 Feb 2023 04:00:52 -0800 (PST) X-Google-Smtp-Source: AK7set91FKCvsxlLaxQ9ktEvtoSraY/uFtWWrhEHVfWaJvqKqNMsOOLuwCNkjO6Trl/c+kW1EQltDQ== X-Received: by 2002:a05:6214:2d01:b0:537:633e:b13c with SMTP id mz1-20020a0562142d0100b00537633eb13cmr15013166qvb.41.1675425651629; Fri, 03 Feb 2023 04:00:51 -0800 (PST) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id d8-20020ac85348000000b003b835e7e283sm1427026qto.44.2023.02.03.04.00.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 04:00:51 -0800 (PST) To: Pedro Alves , gdb-patches@sourceware.org Subject: Re: [PATCH 02/31] linux-nat: introduce pending_status_str In-Reply-To: <20221212203101.1034916-3-pedro@palves.net> References: <20221212203101.1034916-1-pedro@palves.net> <20221212203101.1034916-3-pedro@palves.net> Date: Fri, 03 Feb 2023 12:00:49 +0000 Message-ID: <87cz6rrma6.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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: Andrew Burgess via Gdb-patches Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Pedro Alves writes: > I noticed that some debug log output printing an lwp's pending status > wasn't considering lp->waitstatus. This fixes it, by introducing a > new pending_status_str function. This patch looks fine. I had one slightly related question: I took a look at the comment on lwp_info::waitstatus in linux-nat.h, which says: /* If WAITSTATUS->KIND != TARGET_WAITKIND_SPURIOUS, the waitstatus for this LWP's last event. This may correspond to STATUS above, or to a local variable in lin_lwp_wait. */ struct target_waitstatus waitstatus; Am I right in thinking that this comment is wrong; it should say TARGET_WAITKIND_IGNORE, not TARGET_WAITKIND_SPURIOUS, right? Thanks, Andrew > > Change-Id: I66e5c7a363d30a925b093b195d72925ce5b6b980 > --- > gdb/linux-nat.c | 19 ++++++++++++++++--- > 1 file changed, 16 insertions(+), 3 deletions(-) > > diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c > index 17e5dce08c3..9b78fd1f8e8 100644 > --- a/gdb/linux-nat.c > +++ b/gdb/linux-nat.c > @@ -256,6 +256,19 @@ is_leader (lwp_info *lp) > return lp->ptid.pid () == lp->ptid.lwp (); > } > > +/* Convert an LWP's pending status to a std::string. */ > + > +static std::string > +pending_status_str (lwp_info *lp) > +{ > + gdb_assert (lwp_status_pending_p (lp)); > + > + if (lp->waitstatus.kind () != TARGET_WAITKIND_IGNORE) > + return lp->waitstatus.to_string (); > + else > + return status_to_str (lp->status); > +} > + > > /* LWP accessors. */ > > @@ -1647,8 +1660,8 @@ linux_nat_target::resume (ptid_t scope_ptid, int step, enum gdb_signal signo) > this thread with a signal? */ > gdb_assert (signo == GDB_SIGNAL_0); > > - linux_nat_debug_printf ("Short circuiting for status 0x%x", > - lp->status); > + linux_nat_debug_printf ("Short circuiting for status %s", > + pending_status_str (lp).c_str ()); > > if (target_can_async_p ()) > { > @@ -3137,7 +3150,7 @@ linux_nat_wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus, > if (lp != NULL) > { > linux_nat_debug_printf ("Using pending wait status %s for %s.", > - status_to_str (lp->status).c_str (), > + pending_status_str (lp).c_str (), > lp->ptid.to_string ().c_str ()); > } > > -- > 2.36.0