From patchwork Mon Dec 12 20:30:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 61823 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BAF37384C346 for ; Mon, 12 Dec 2022 20:31:21 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by sourceware.org (Postfix) with ESMTPS id 3F838384E200 for ; Mon, 12 Dec 2022 20:31:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3F838384E200 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-f45.google.com with SMTP id v124-20020a1cac82000000b003cf7a4ea2caso6235521wme.5 for ; Mon, 12 Dec 2022 12:31:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r5WAd+MFSJx/2vL/WA1nZBUSn/EC1WtGHCsOO6tAPFk=; b=ThYB/NK40xvye/GHoKih6QtfxIZUCjrUZQYgYkCGdkbPkrGsMNqQ/lc5bF711LL3NN FXH30786l+GYoIxrc6xPhowTXzUl42fg1DeXFhLIVt5kOioQAbe1wH8FaPmJWm1fXJ/r cklhyoah6Zhqyahr8wZ1jDPGpZn8JFVT/Ahr+sBFoNcYF32xESCi9qJMYgAkw8kNafyG XIIgRets3zmm+2nQGpty3r3Z2j6t6Zm0434wmHNlPHpQi/dTYCDl0yPWXo3HTkDZm5VP TnFPMvclda2OMfoHF+cFut8HMC8/igGFqknHVpzmw2JahkcVQROB1L8snvfLMCgA62EI X/OQ== X-Gm-Message-State: ANoB5pkE3Nt7iSWezrcPAIRYKwQyz6kFne5nev/hC4mWSNayr9cLfGqR aVs2wosd/AO9s0VAsGtxm9ApLdJtr5oelw== X-Google-Smtp-Source: AA0mqf6xvugbjNIUMbirciV9wrUTPU98JtxwL/F75YE7k1PBgzx4J41q/IvDbWqDVkgKF7wKpXYkhQ== X-Received: by 2002:a1c:4b0d:0:b0:3c6:e60f:3f63 with SMTP id y13-20020a1c4b0d000000b003c6e60f3f63mr13872665wma.26.1670877059968; Mon, 12 Dec 2022 12:30:59 -0800 (PST) Received: from localhost ([2001:8a0:f912:6700:afd9:8b6d:223f:6170]) by smtp.gmail.com with ESMTPSA id g23-20020a05600c4c9700b003cf4ec90938sm9908243wmp.21.2022.12.12.12.30.59 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Dec 2022 12:30:59 -0800 (PST) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 02/31] linux-nat: introduce pending_status_str Date: Mon, 12 Dec 2022 20:30:32 +0000 Message-Id: <20221212203101.1034916-3-pedro@palves.net> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20221212203101.1034916-1-pedro@palves.net> References: <20221212203101.1034916-1-pedro@palves.net> MIME-Version: 1.0 X-Spam-Status: No, score=-10.1 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 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: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" 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 Reviewed-By: Andrew Burgess --- 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 ()); }