From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +LfwHWE0K2hiOCoAWB0awg (envelope-from ) for ; Mon, 19 May 2025 09:38:41 -0400 Received: by simark.ca (Postfix, from userid 112) id 746E91E11C; Mon, 19 May 2025 09:38:41 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-9.0 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.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 ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id F24E41E102 for ; Mon, 19 May 2025 09:38:40 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AB6C33858415 for ; Mon, 19 May 2025 13:38:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AB6C33858415 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by sourceware.org (Postfix) with ESMTPS id C82683858D33 for ; Mon, 19 May 2025 13:25:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C82683858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C82683858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1747661133; cv=none; b=SE3X2D2KC8DZqPBH82GtUmtvLLMu9blm6Q8ZNWK7FjPEevAUL2xnMQgmbScn2z51keAUQP+0Q2gp4buN9meANB9ocJKHoZZS02Hblnho3Jrr4zyitf17P/RG6ZJoRbYknQui70wsIqhJ9aRl4MBOic0bea6T3G8v93nTPIMAWWM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1747661133; c=relaxed/simple; bh=0Lj4AUn76k2dM+eIyX82AsPY2lNdOvLvX/SNb5QIYck=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Gvt9k7FEzhx2q3J/Sy7cjrwFtjE7qREbw8+e5IX3gECkGhdYLNnAQloQ3KgKO8KVKv7wSXWhTzypqUuXrzMR9V16Aq/h7SBek4QiutS2b03JzfyXO3IQSgzUUwp+Jv3wrg/VKwePX0KJORwzxV24Btrbs8q4HlklNcBturGRNzo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C82683858D33 Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-3a375e72473so335798f8f.0 for ; Mon, 19 May 2025 06:25:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747661131; x=1748265931; 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=2lQOcFkfkSKF8i7M10lziLIp3MQne6bNvXLdmHALYP8=; b=whfbvH/1JtZliMQvkh0OUP/TyWlN9PBhn8bZzWXzEmyosVZ0TwO84ALxVgr95lER3u C8YCf+ikFOUuOQhqCXgqpyNY9N1gpFxwnb30xXyb6Cwf+VXLPIfQmQYY5rn01w7bRw0o Qx/iJG7iImM4fkbCjwRRY1z0SBKdES/QwPbQ71ySf5PvOlQYjAL3Luc0Fo4hNq08EijK NC2EYPoPcfP7+CX9n2lQivqlhV1NSowpERXrAJsYLaUVxtYyjN3WsHxDGKS9Zf9+lcd+ GCpfsSYHsDZOx771tuF5N2dQi8e1PE2vdEZsufkdCluDCTz5XXxgLkqliET9L3h/N+5h pn9g== X-Gm-Message-State: AOJu0YzB5MQY3CvB2b0U5psN3kz9HdzjOmwdhSqKB0Y2/UkN68zSy6aC ml+ZYmkcVySVJhjgbv8kOKs6oQuCB44B/hKM/eSqdYKBPYnr156knk58cd8/imzP X-Gm-Gg: ASbGncs+Z1gMlUCOGLmM/vc/pihlzkVLBhPDB66BieYtfGWiDT7hk1DxsEE6f1k+fK0 Y7kkCoygGhNJeuPjccQ6RJJ/2N7iEZUKaVkXN/T4ZSozhzuC/BNx0dmcTL+sxYRirAOtcCwIwsT Xf4U60foeApOXd1J/u5Uxzhpsb3JA86wj+1uin7bJs4IfOgpOQ09G9ZQSFoHrFwCtIPcSe3G7AW 6l2XkLOVou8mxSYb6jxWk0eFeU3kJI+izzY4XQpP8k4524sQjCQZCwIhzNtgbRG7aNToaXOASfC HX51YNMy9joj34ogNUtTFQQMetpNIGhXkA8NCFp17HjzICfzeB4= X-Google-Smtp-Source: AGHT+IFDjyPfcVEOOX6+alkoSKAPSMDsscxgrphwxniiZS7sMvMczKp/SFrSgVGYDOh7/aZSkMVJ7Q== X-Received: by 2002:adf:f44c:0:b0:3a3:622a:dc5a with SMTP id ffacd0b85a97d-3a3622adc6fmr7833794f8f.38.1747661131415; Mon, 19 May 2025 06:25:31 -0700 (PDT) Received: from localhost ([2001:8a0:4fe9:b400:8d90:6f0d:36bf:32df]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-442f39ef87asm207653355e9.36.2025.05.19.06.25.30 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 May 2025 06:25:31 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 43/47] Windows gdb: extra thread info => show exiting Date: Mon, 19 May 2025 14:23:04 +0100 Message-ID: <20250519132308.3553663-44-pedro@palves.net> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250519132308.3553663-1-pedro@palves.net> References: <20250519132308.3553663-1-pedro@palves.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Now that we have easy access to each thread's last event, we can easily include some extra info in "info threads" output related to each thread's last event. This patch makes us show whether the thread is exiting, or causing a whole-process exit. This is useful when multiple threads hit events at the same time, and the thread/process exit events are still pending until the user re-resumes the program. This is similar to how linux-thread-db.c also shows "Exiting" in its target_extra_thread_info implementation. This will be relied on by the testcase added by the following patch. Change-Id: I493b7ea3e14574dc972b1341eb5062fbbfda1521 --- gdb/windows-nat.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 71ef26501de..830ed0e381f 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -528,6 +528,8 @@ struct windows_nat_target final : public x86_nat_target bool thread_alive (ptid_t ptid) override; + const char *extra_thread_info (thread_info *info) override; + std::string pid_to_str (ptid_t) override; void interrupt () override; @@ -4085,6 +4087,26 @@ windows_nat_target::thread_name (struct thread_info *thr) return th->thread_name (); } +/* Implementation of the target_ops::extra_thread_info method. */ + +const char * +windows_nat_target::extra_thread_info (thread_info *info) +{ + windows_thread_info *th = windows_process.find_thread (info->ptid); + + if (!th->suspended) + return nullptr; + + if (th->pending_status.kind () == TARGET_WAITKIND_THREAD_EXITED + || th->last_event.dwDebugEventCode == EXIT_THREAD_DEBUG_EVENT) + return "exiting"; + else if (th->pending_status.kind () == TARGET_WAITKIND_EXITED + || th->pending_status.kind () == TARGET_WAITKIND_SIGNALLED + || th->last_event.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT) + return "exiting process"; + + return nullptr; +} /* Implementation of the target_ops::supports_non_stop method. */ -- 2.49.0