From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id gCvKLdd3JGkbUikAWB0awg (envelope-from ) for ; Mon, 24 Nov 2025 10:20:55 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=kZgd2sMa; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id ADE361E08D; Mon, 24 Nov 2025 10:20:55 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED 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 93D541E08D for ; Mon, 24 Nov 2025 10:20:54 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 24D5C3858406 for ; Mon, 24 Nov 2025 15:20:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 24D5C3858406 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1763997653; bh=IQjOPeq7sBX2PcqxlsXIqQjd5dakMbWJZn0+JHgXxmg=; h=Subject:To:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=kZgd2sMaZsxSpyHXIDiSldOyU3VAijqZF7Er4eoWGoNhgQghvjipCQla2KVyK3blf i/A6Q6wtTJqtWK1FOLVORdpAcLl0P+Phqd2DYHnnVL/gcgg/XcFDfpYyI/68oaLi8m 3mnCu8BaNibI/H/tvLwvpRcyeODogUilPYvwaXOM= Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id C063D3858C2C for ; Mon, 24 Nov 2025 15:19:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C063D3858C2C ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C063D3858C2C ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763997562; cv=none; b=F725wrgq9QslqtPh0qsU3ETJi3FLUQJJkeocwcm+0doK46uuEqh0nh7dTvo3ZwgM96ERbZJYxyrUNk3a9wzp+6Px//kBqfc4P+GTniFK/QAtg5UDyLDVZWnQU/87TTXgUuqh3LaSrt5/iPdbpEpiixifG7vfn4YYUvTW+HcumVY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763997562; c=relaxed/simple; bh=C4IptJ2fnL4poWYDde4Y//w9Zjp60jmBEabflFg5eEA=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=gKoDV+yNsuu48XkSfe4T+qP7v6W8n1mcXMRgaolB7nn5PczFFWBRCrMDG7yrt3sebFbmjcuTpWcQ6SD2o2+I371uA1r5J4n9Ua+x5uqhUxt/SOHBArSgaPvirdnVfMekm/zqRxj2xmIHKhJq7ZpIpIJMcOcXxbMsa+e5J7PLaYs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C063D3858C2C Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vNYLY-0004lq-Qw for gdb@sourceware.org; Mon, 24 Nov 2025 10:19:22 -0500 Message-ID: <5fca00492270f2d2594e85ec4cd7ff1384b3a5a9.camel@gnu.org> Subject: Re: GDB 15/16 crashing in add_thread_silent() To: gdb@sourceware.org Date: Mon, 24 Nov 2025 10:19:17 -0500 In-Reply-To: References: <78bf54fc9dfbb57d3434d8435e94b091e1fa6785.camel@gnu.org> <9a1b77f25cab8eb7433476918a9c5be29091856c.camel@gnu.org> Organization: GNU's Not UNIX! Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.1 (by Flathub.org) MIME-Version: 1.0 X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Paul Smith via Gdb Reply-To: psmith@gnu.org Errors-To: gdb-bounces~public-inbox=simark.ca@sourceware.org Sender: "Gdb" On Fri, 2025-11-21 at 12:59 +0100, Tom de Vries wrote: > On 11/14/25 8:38 PM, Paul Smith via Gdb wrote: > > However, if I use the native GDB 8.2 that comes with Rocky Linux, > > then > > it will open the core file without these errors, and even show me > > the > > backtrace for all threads. >=20 > An interesting thing to know here would be the size of the PRSTATUS > note: > ... > $ eu-readelf -n core | grep -i prstatus > =C2=A0=C2=A0 CORE=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 336=C2=A0 PRSTATUS > $ readelf -n core | grep -i prstatus > =C2=A0=C2=A0 CORE=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 0x00000150 NT_PRSTATUS (prstatus= structure) > ... >=20 > AFAIU, the note should be grokked by elf_x86_64_grok_prstatus, which=20 > bails out unless the size is either 296 (x32 abi) or 336. I did have some time to look at this over the weekend, but not as much as I'd like so I don't have too much to share. I did find a few interesting things. First, thank you Tom for your message that was extremely enlightening. I discovered that yes indeed for this core the PRSTATUS note size is not as expected: $ readelf -n core | grep -i prstatus | sort -u CORE 0x00000188 NT_PRSTATUS (prstatus structure) If I look at some other cores (generated from different systems) that work with unpatched GDB I see that the size for those is as expected (0x150). So, that's suspicious at least. Based on your email I decided to first build a vanilla GDB 8.2 and try that. It failed in the same way as the latest GDB (minus the bug regarding the incorrect PID value that causes GDB to crash): warning: Couldn't find general-purpose registers in core file. warning: Unexpected size of section `.reg2' in core file. Cannot access memory at address 0x8ab31264 Cannot access memory at address 0x8ab31260 Core was generated by `myprog'. warning: Couldn't find general-purpose registers in core file. warning: Unexpected size of section `.reg2' in core file. #0 in ?? () (gdb) bt #0 in ?? () Backtrace stopped: not enough registers or memory available to unwind fur= ther So, this implies there's some fix added by Red Hat that is needed, for at least some kernels, but has not been upstreamed for some reason. I then tried to apply the patches by hand (there are about 200 patches) but this didn't work well. So I used the Red Hat rpmbuild tool to generate a GDB 8.2 fully patched and built the same way as the Red Hat /bin/gdb. The GDB binary created by rpmbuild worked just as well as /bin/gdb, so that's good! I did grep the 200 patches and didn't find any patches obviously related to prstatus or grok: there are some "grok" patches adding/updating support for PPC and ARM but I didn't see anything for Intel/AMD (but could well have missed it). Unfortunately I ran out of time here. My next steps are to investigate the configure options used when compiling the RedHat /bin/gdb, and compare the source code as one big diff rather than 200 small diffs.