From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Qg6vENdxAWg/4TgAWB0awg (envelope-from ) for ; Thu, 17 Apr 2025 17:25:43 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Q3JYcyZU; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 3337A1E0C3; Thu, 17 Apr 2025 17:25:43 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 389C41E05C for ; Thu, 17 Apr 2025 17:25:42 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9F898385701C for ; Thu, 17 Apr 2025 21:25:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9F898385701C Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Q3JYcyZU Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 3FFA23858D39 for ; Thu, 17 Apr 2025 21:25:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3FFA23858D39 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3FFA23858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744925109; cv=none; b=jv0RBjxHrj5LnhJ2DqpEWkLzzQyZbbEXSoXsahYdrahrH6Fiy1jy7u5lw1fkh94a/sKC6VHD2bP/8DG0lm7Hlt+l0dIHY+QRsAmxOEtKZ6DQWFP5inqM/EpgpbDaiQ6AdMYR1m6uA4bviXxF//rDak8KUQcY7dC/dpMcpPf3e0o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744925109; c=relaxed/simple; bh=g3cFm5+0jrkbBIyT4FS7vZVGKjzqZu0UecLhoOkPJog=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=sZjlSDKUR9FAXVclO0LAnCPI8e4i1gQLob9gXaJTAVi9L62XaRRK2IJaMvPZZVVvli0T1DJyqoL1Kg8DBN9hWi7DYsiav1226yzsAilpwDw1MYGCv8G3P2JAlnyv3N8hYxZFml45IHQrTTXidjZ2m72/A/R+27l/JkATNNW/r7I= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3FFA23858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1744925109; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/WOvsgODgOhJfpRVdZ7dl1ksLRYkg3zFr8Hx1zjg8yY=; b=Q3JYcyZURWMpGa5wIOzpN18On5t0w7HcUmfL3mao3Pd/PnMw8fINc2ITWsyw3xp88dT1Z1 X5nJcolp/dFgtuErRET8ysCslEBIZbV08EWnA9XwFFD924JzNI/F8REd6C8HoO3l/hHIwJ kPCg1FFk5DhQ921+eaDweKlLIeq9c20= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-120-hCe_wyKfMYymWDw7VMNWPA-1; Thu, 17 Apr 2025 17:25:07 -0400 X-MC-Unique: hCe_wyKfMYymWDw7VMNWPA-1 X-Mimecast-MFC-AGG-ID: hCe_wyKfMYymWDw7VMNWPA_1744925106 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2AA03180048E; Thu, 17 Apr 2025 21:25:06 +0000 (UTC) Received: from f41-zbm-amd (unknown [10.22.80.11]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 03F9618001D7; Thu, 17 Apr 2025 21:25:04 +0000 (UTC) Date: Thu, 17 Apr 2025 14:25:02 -0700 From: Kevin Buettner To: Disconnect3d Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v2] gdb/linux-tdep: use thread lwp instead of pid for info proc Message-ID: <20250417142502.429d54e3@f41-zbm-amd> In-Reply-To: <20250412201140.31510-1-dominik.b.czarnota@gmail.com> References: <20250412201140.31510-1-dominik.b.czarnota@gmail.com> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: LGih_HgPkCa0AEo7cfinTU_HyRlrkKpnpn8gXk-XznE_1744925106 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 A couple of nits - 1) add a Bug tag/line to the commit message, and 2) I got some whitespace nits when applying this patch. See below. On Sat, 12 Apr 2025 22:11:41 +0200 Disconnect3d wrote: > This commit fixes bug #31207 where GDB shows an empty result > of `info proc mappings` when we debug a non-main thread of a Linux > process while the main thread has exitted. In such a case, the > `/proc//maps` file renders an empty file and `/proc//maps` > should be used instead. > > It is worth noting that the `/proc//` directories are not > rendered by the Linux kernel when listing the procfs directory > but they can be opened and they contain the usual procfs entries, > just for the pid of the thread. Please add: Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31207 > Signed-off-by: Disconnect3d > --- > gdb/linux-tdep.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c > index 141c1199c8a..c141c9c6701 100644 > --- a/gdb/linux-tdep.c > +++ b/gdb/linux-tdep.c > @@ -842,7 +842,11 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args, > if (current_inferior ()->fake_pid_p) > error (_("Can't determine the current process's PID: you must name one.")); > > - pid = current_inferior ()->pid; > + /* Use the thread's LWP ID instead of process ID when accessing procfs, > + since the LWP-specific entries provide more useful information. > + For example, /proc//maps may be empty if the current thread has exited. When applying this patch, "git am" complained that spaces were being used instead of a tab for the above two lines. > + */ > + pid = inferior_thread ()->ptid.lwp (); > } > > args = skip_spaces (args); With those nits fixed, it's okay to push: Approved-by: Kevin Buettner