From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id TwJkGPSsFGmYGDoAWB0awg (envelope-from ) for ; Wed, 12 Nov 2025 10:51:16 -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=wkhWZd8i; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 533011E057; Wed, 12 Nov 2025 10:51:16 -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 AB12C1E057 for ; Wed, 12 Nov 2025 10:51:12 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 293303858C50 for ; Wed, 12 Nov 2025 15:51:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 293303858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1762962672; bh=7nbjGYV0135Xx1EVZM1CPKzGZ2SB79BEaXJbzSz31js=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=wkhWZd8iugVm5+GZtlU95FmlTv28lfMeohijf/Nj0U88ZjYUMxtO5vaqMNuBtVnqu 0nLhV6tyKsz56LtMqrsshRTBjm20c3b92T2bZUmRTQIVw7cb1/gsPaCab+BssMzfJ4 860ZEaDHWadzzdAS6HAl4AIGI6qY8jem3SvzUxe8= Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 7C4103858D2A for ; Wed, 12 Nov 2025 15:50:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7C4103858D2A ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7C4103858D2A ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1762962623; cv=none; b=JlwyxrIW0o8gqKCNPmNjT4Q5PQc687xj+Uhjmq9hGRSY4/Txuiu/rCXsZia6GCHcGFwiq535/E1Ss7U8d3HZ3HBVNd5hhd1uoxNtxgJmNp/+ueqYOJKBOCVXYyLCubFlnLH9xoCNSPiDI/I6hR0mfAUKOKH6J6j7/+ZK6NIkhjs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1762962623; c=relaxed/simple; bh=6KsA0rYxHV55oW2OcWKkCFX0/98le6mXvA9sQmDuKDs=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=Eudg7O1RMufLNpBsNk+XcofqsiCLvp8Ld1LuxqMlqXrpEGxxvdvRxCKSnF+xlNfe6carmle1NEewpFv598QD4UaK9/PNIOFYZHfvD7NE8/BR99dJCOuClnCdzX8Tib/B6PNcsfeZH5dpEOusihTUQoRGlafncScGVA71lHP6Ud4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7C4103858D2A Received: by simark.ca (Postfix) id AC45D1E057; Wed, 12 Nov 2025 10:50:22 -0500 (EST) Message-ID: <3057aed7-aa44-4d54-8d61-a324bc974bdb@simark.ca> Date: Wed, 12 Nov 2025 10:50:22 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: GDB-JIT: why would my 'unwind' not be invoked on crash? To: K , Tom Tromey Cc: K via Gdb References: <87ikfgxnva.fsf@tromey.com> Content-Language: fr In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: Simon Marchi via Gdb Reply-To: Simon Marchi Errors-To: gdb-bounces~public-inbox=simark.ca@sourceware.org Sender: "Gdb" On 11/11/25 9:00 PM, K via Gdb wrote: >> >> Could you say more about what exactly you're doing? >> >> Like are you writing an unwinder in gdb? Or writing one in Python? >> >> > I'm implementing an unwinder via the GDB-JIT C API for JIT code where > generating custom ELF debug information is too onerous. > The first article I read on it, by the implementor Sanjoy D(?) mentioned > your name as originating the approach! > So I'm just providing the functions called for by the struct in the API - > unwind and get-frame-id (plus the function name/line number info > separately). > > So gdb has no ELF info to look at (other than of the binary that is > generating the JIT code), so I was expecting gdb to immediately defer > to the jit-reader.so loaded into itself with the defined unwind function > which has a few printf statements so I know when it runs ... > and it isn't being called until 2 lines of backtrace have already been > emitted, and only then on garbage data because it has already gone awry > interpreting the stack contents/frame (with those first 2 lines above). I don't have first hand experience in writing one of these, so I can't help you directly. So as Tom said, I would probably end up debugging GDB itself as well (which is an easy thing to say, given we're GDB devs). The functions involved in finding the appropriate unwinder are frame_unwind_find_by_frame and frame_unwind_try_unwinder, here: https://gitlab.com/gnutools/binutils-gdb/-/blob/30f6e34f1fad35f9e8a3230adf2b7268b2a5229f/gdb/frame-unwind.c#L187 The JIT support code prepends its unwinder here: https://gitlab.com/gnutools/binutils-gdb/-/blob/30f6e34f1fad35f9e8a3230adf2b7268b2a5229f/gdb/jit.c#L1142 So when frame_unwind_try_unwinder runs with "set debug frame 1", trying to find an unwinder for frame 0, I would expect to see a message like `Trying unwinder "jit"`. And then your code should be called. This is where I would start investigating. Simon