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 [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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675425653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=U0ukp25v++ue0XBpN9FPQZ2BIy8rYEo8QVJXuSecmug=; b=b0CVTDwt3/OHlJs8EzO8EhNS9wgXZV/hjoGkIc8PJ+yMWl5nh07469o+bT39C2im+E+KzU l0eL8O6IVf7FEqy7Yub9OFgE4TcqHWllgF6NLSbq1Y5H7vfydvDlY2d9uEEoISe1TtUndD fIX2u1Rbr7dUxm9/pJEtaiPJ+lK5AVU= 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) From: Andrew Burgess 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-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIM_INVALID,DKIM_SIGNED,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,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: 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