From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ylyMG6exFmn1KQAAWB0awg (envelope-from ) for ; Thu, 13 Nov 2025 23:35:51 -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=onxikx6A; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 637181E04C; Thu, 13 Nov 2025 23:35:51 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, MISSING_HEADERS,RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=no 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 4EC1E1E04C for ; Thu, 13 Nov 2025 23:35:50 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4F8AA385841E for ; Fri, 14 Nov 2025 04:35:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4F8AA385841E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1763094949; bh=jrtOMMuU8f3jVNdP2NO7DI0qkqWiaR+6eDMhVlZxPYM=; h=References:In-Reply-To:Date:Subject:Cc:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=onxikx6A8z+fitcSqTXp7W6qNnSi/ZF99rZsZsh36qNhIBwwMURfUxhZqpnAc+hkF mfet679oIM+Tq9Wa/Xa7ddtfW/qBy5RldxFtsphyCgglM3p0WYvn0eqfBXtUq9MOKj CClH3tQfsr6V3DYerPcIIg6ytEzBgiNxi30c3w0k= Received: from mail-yw1-x112a.google.com (mail-yw1-x112a.google.com [IPv6:2607:f8b0:4864:20::112a]) by sourceware.org (Postfix) with ESMTPS id B97173858C41 for ; Fri, 14 Nov 2025 04:35:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B97173858C41 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B97173858C41 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763094907; cv=none; b=FkY12Ne3lRogrWDK+6PO1eEuJyeStlyQbHn5vFWWyslEwrbA/z9ULCMN4ua8bpezE7Vuhe5Ukc7YJ2FMutsBopBC7zn6uiaNmSX8qVM8djsBb4vIM7m6tnlgHSqduxNvwaTVS+cHjBT2lqK2YIScifAelueD5KW6pmIjwGfKVJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763094907; c=relaxed/simple; bh=5LJgUrXkxMuloPFX+K0Zg2RpMzS7Ny3KVPj6tqXeTEo=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject; b=k80uephuPialUvcRfPfSX6RKc6lTI7oU3+a/8VLdnaZjmH/28L9VnWh3v19WoKws+NTxheF53PVJbD6/ousOM43nvcZ0zcoK27RnAxmnb7evAuQ7ibwtsVHsFSkAoCBK3u12SFqnlOSifG183jnaP1/glNq4+b3PIxQ84GWoyKY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B97173858C41 Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-787eb2d8663so22609147b3.0 for ; Thu, 13 Nov 2025 20:35:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763094907; x=1763699707; h=cc:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zUvpClKgB72CDKiJa90BTVrUqZROqKp+Z8eX81Rg7xw=; b=c5MXV0Epj3Y/J5XLayzT/tde6JTBVFoRtJkqaEhZeo1EQl2DbCPxyK61OPs3dpGHOn 2eXeQCLmlp5VzY/SgYrgwak4US0HcXekdGOc1+IfM0yf23QN9yrddg+tIAWvZPAF9vBN qAtVgfuGIxMi7Q+tMwFUQttf3tBCkH8ruGLlIMXskLxmkc/+vxRWHHIN1Nw5DGMTgiP2 1+49qbDaSa30DilFh14H6wQAdBMXM9yUE6n91Et6rSYfEPymAMebaT4VyM9RrSFktDRt spR4TLFJaZebUuEUHdhlP5gQY5rQt2Sb+Mz35NG+Hk05B5IO294Sr5TlGqgryvkGsdMB ENEw== X-Gm-Message-State: AOJu0Yw9iz1G8EPviiQ+J9pW45DFDsC7cpAHOT3EH18GJh1n6mzX7zvh n3bFULUqG+PygzN0qzrjRkbZhnn+tdvQoKiA/fnWq3odxrt35z/Rkg1hxL4bjMXPui77SBd8c0s yVscjsIRiwgWUlR4iJkn2AqpJy6AlzuzK8Q== X-Gm-Gg: ASbGnctbO5Ujg9qzb2MURFMKkz5SykRspJoMBdLIUNF/LuQgZ/WgF1oKDQHEO+MFoe+ JZP+lVGu0Ge8nGV4JlDkI1ona+IMYVsPb3VhrCdOSxdo4bu2Gb98mr3M+vGIudNFBv4Db+BPWZG BqzPPH+ssNi1wz+zWrJuUyFtx2c+2LLsAwaTpwlBUVIPcIHquCOZJ7kAAXR6EFNiv0A3TiIEmBk DRMiZNjqJxoYQi0hIQ8u8Zwc+sOEnpX/GoeinogifoSoUlYWNB8Q7YG2ohf2wHFp6MAFhAi X-Google-Smtp-Source: AGHT+IHgiMdv/TSzWN3VVG4OmtNK4VLtiO9SvAyogjHjWe/MbplUiT37bsQyBAlEIxctdl3ZNZQXzSQH7JY8/8JpJV0= X-Received: by 2002:a05:690c:f81:b0:787:d09e:88fa with SMTP id 00721157ae682-7882067d619mr47701287b3.21.1763094907064; Thu, 13 Nov 2025 20:35:07 -0800 (PST) MIME-Version: 1.0 References: <87ikfgxnva.fsf@tromey.com> <3057aed7-aa44-4d54-8d61-a324bc974bdb@simark.ca> In-Reply-To: <3057aed7-aa44-4d54-8d61-a324bc974bdb@simark.ca> Date: Fri, 14 Nov 2025 07:33:06 +0100 X-Gm-Features: AWmQ_bmo1jDtnfoKuPIprbNr9MFZMmnUvVNw3--3-6pTVd_FD9ExpP12krnSzaw Message-ID: Subject: Re: GDB-JIT: why would my 'unwind' not be invoked on crash? Cc: K via Gdb Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.30 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: K via Gdb Reply-To: K Errors-To: gdb-bounces~public-inbox=simark.ca@sourceware.org Sender: "Gdb" the debug shows gdb's own "aarch64 prologue" is matching first. and it isn't wrong - I verified the first backtrace entry as correct. I can't get into the gdb codebase though to find out why it unravels from that point on. I have the immediate source of my segfault and will run with that. In the matter of aarch64's program counter: anyone know how to get this out of the gdb-jit interface given that the pc is not in a register? On Wed, 12 Nov 2025 at 16:50, Simon Marchi wrote: > 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 >