From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by sourceware.org (Postfix) with ESMTPS id 4FD4E385C312 for ; Mon, 20 Jun 2022 22:54:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4FD4E385C312 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f44.google.com with SMTP id a10so6537136wmj.5 for ; Mon, 20 Jun 2022 15:54:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fMyAyzwK6LGTCReSy11DVTUK7fpctKe5lq1zcxqdnAY=; b=sSgQJsRx2PwjYqjrwiinof3cgdhrOi/5Naf6tkeffGsP4glIcsoBHNLHVg5Vlxhk5i ma6Np1qKeozikd9xcuyBTLsJAY3xUIEE9S/AEksqJmtbwI6Myc8hAYhtjNh238RAxjk1 QdVKiIex+7QcxhJcncFNktsyZ2B5ljpzsNIMKL5dypxGMEiry9CA3/xfU3j8fUl80Ec/ Oy5e1z3mMgyrSauFQDBtQtzSgxqJb9Fwyy6NWVN87OBKhcPYn7Lo7e9xLsNrzL6eGLld Aq9kyWYf7ddysrVS5YiIYDAb8bBDakxuHjFC83+11JTZb9ysXonSXbPXbcVezb3sz6ar Yovg== X-Gm-Message-State: AOAM531L1HviAVafCFG47YL89AVbR6ucAatzC7EhgnTyLdCHqoqRR1S+ K72D+Qnm54Q2GoPGoGfla4jgn2iVhrw= X-Google-Smtp-Source: ABdhPJwl1eyhr7pcPxdd+0mN9u48WoXPXeRf/UKxTpX6YIpCTmlTxxoB4XJQW3r+3FUW8qJ+HLdKcQ== X-Received: by 2002:a05:600c:4e91:b0:39c:7f1e:fb00 with SMTP id f17-20020a05600c4e9100b0039c7f1efb00mr37559385wmq.81.1655765668600; Mon, 20 Jun 2022 15:54:28 -0700 (PDT) Received: from localhost ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id w5-20020a7bc105000000b003976fbfbf00sm15830911wmi.30.2022.06.20.15.54.27 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Jun 2022 15:54:27 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 03/25] linux-nat: introduce pending_status_str Date: Mon, 20 Jun 2022 23:53:57 +0100 Message-Id: <20220620225419.382221-4-pedro@palves.net> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220620225419.382221-1-pedro@palves.net> References: <20220620225419.382221-1-pedro@palves.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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, 20 Jun 2022 22:54:31 -0000 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. Change-Id: I66e5c7a363d30a925b093b195d72925ce5b6b980 --- gdb/linux-nat.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index b9164e621db..1a6ae7b44c0 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -255,6 +255,17 @@ 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) +{ + if (lp->waitstatus.kind () != TARGET_WAITKIND_IGNORE) + return lp->waitstatus.to_string (); + else + return status_to_str (lp->status); +} + /* LWP accessors. */ @@ -1647,8 +1658,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 +3148,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