From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id kTdNLP7WDWo6dAoAWB0awg (envelope-from ) for ; Wed, 20 May 2026 11:45:02 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=gnu.org header.i=@gnu.org header.a=rsa-sha256 header.s=fencepost-gnu-org header.b=qYLiBKME; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id AE1521E098; Wed, 20 May 2026 11:45:02 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.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,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 vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (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 2E45F1E024 for ; Wed, 20 May 2026 11:45:01 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 900494BA23DD for ; Wed, 20 May 2026 15:45:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 900494BA23DD Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gnu.org header.i=@gnu.org header.a=rsa-sha256 header.s=fencepost-gnu-org header.b=qYLiBKME Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 3057B4BA2E06 for ; Wed, 20 May 2026 15:44:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3057B4BA2E06 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3057B4BA2E06 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779291877; cv=none; b=MCnuVoSJNqfR7fS/8+ddKa+T/qdtUoReOWDpdxkpq6u5dYdY/36fXxWOS3Xwyi3AJi8vW0kp5RpWvr7VkIVKA+HGOKW5Qph87s9UywSqN2y0xOzhERDk8VpfMewvgfTRYOlyiZNgZYCktXINycvkSyp96tkp+r6cOpLDEX3UuEs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779291877; c=relaxed/simple; bh=LO4YfyrBJ6sVqjML6wZWgiyenycggXLvGIhwjeRoY5Q=; h=DKIM-Signature:Date:Message-Id:From:To:Subject; b=LU425rBDay8kIU4ht2n+OHGEqHc+KvpqdTqSw98OFst4M2U30ZgPK7BcSiPorKGRxIoYx7OwzJqcWnjzeJQ4qE8H5EFEKuk5efm2L7HZc3jAxCAy41cGS9F01x8Ifqi4CqX2vOgAFpLkjjXX4MJOAvPTeHUsdH6U3Erle6qfA4g= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gnu.org header.i=@gnu.org header.a=rsa-sha256 header.s=fencepost-gnu-org header.b=qYLiBKME DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3057B4BA2E06 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 1wPj64-0001cE-Gv; Wed, 20 May 2026 11:44:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=ooJYv7QyFoATJLENuxSAfNvS2K4TO7d1BLr6bG1MmMA=; b=qYLiBKMEBzSl RCIxqVO5kijbcwM83EH7+Bb8C5EMHwSyS7aJ84MVLcJb4goyurs80DUVLvSqinqEgriGyn8pVgZnP xXBs5zyCE/1IahKGRx2Ly70mJhYhsXNHtAcdBZPaX1mK705T7OuYbnyKeD4XdZnu9VYfdV2y9wg0N ySZLkDREzkAU/9d5PHqBv2ViNN25ETuScmwqs97rQRSxQsUqFZiAv5Wwl0yjtp45G+kTCTmUpFJrD Mg1LdOmMXP7K4LUbbZdRsz0v1J4hHr6BWfLK0SWgWiLcCdY5F2ra9sFQ67Bdet+cRC3WhM8c0zSaY dbVlOLgteP8y0MEGnowsag==; Date: Wed, 20 May 2026 18:44:29 +0300 Message-Id: <86zf1uytk2.fsf@gnu.org> From: Eli Zaretskii To: Craig Blackmore Cc: gdb-patches@sourceware.org, aburgess@redhat.com In-Reply-To: <20260520131607.32885-2-craig.blackmore@embecosm.com> (message from Craig Blackmore on Wed, 20 May 2026 14:16:07 +0100) Subject: Re: [PATCH v4 1/1] gdb: Add python support for demangling register unwind values References: <20260430153155.979053-1-craig.blackmore@embecosm.com> <20260520131607.32885-1-craig.blackmore@embecosm.com> <20260520131607.32885-2-craig.blackmore@embecosm.com> 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 > From: Craig Blackmore > Cc: aburgess@redhat.com, > eliz@gnu.org, > Craig Blackmore > Date: Wed, 20 May 2026 14:16:07 +0100 > > This patch addresses the scenario where a register value is saved in > some mangled form on the target and gdb does not have sufficient > information to demangle it. > > After getting a register value from an unwinder, gdb will call out to > extension languages to allow the value to be demangled. This avoids > having to write a new unwinder and allows the standard unwinders to be > used. > > This patch adds the python class > `gdb.unwinder.UnwindRegisterValueTransformer` which is the base class > for transformers which provide methods for transforming unwind register > values. Currently one such method is supported, `demangle`. There is > no similar support for mangling values being written back to the target > as this was not something I needed to be able to do. Such support can > be added to the python API in future by supporting a `mangle` method. > Currently writing back to a demangled register will produce an "Attempt > to assign to an unmodifiable value" error. > > Only one transformer can be registered globally at any one time. > Attempting to register more than one transformer or to any other locus > produces an error. The function for registering transformers takes a > locus to allow other loci to be supported in future. Registered > transformers are stored in a list so that registering multiple > transformers may be supported in future. > > `gdbpy_get_register_descriptor` is now externally visible as it is used > to create a gdb.RegisterDescriptor object to pass to the `demangle` > method. > > This patch adds read-only attribute `gdb.Value.lval_type` which > transformer methods can use to decide to skip modifying values that did > not come directly from the target and may not need transforming, for > example, values taken directly from DWARF. > --- > gdb/NEWS | 20 +++ > gdb/doc/python.texi | 93 ++++++++++ > gdb/extension-priv.h | 8 + > gdb/extension.c | 35 ++++ > gdb/extension.h | 6 + > gdb/frame.c | 9 + > gdb/guile/guile.c | 2 + > gdb/python/lib/gdb/__init__.py | 21 +++ > gdb/python/lib/gdb/unwinder.py | 89 ++++++++- > gdb/python/py-registers.c | 2 +- > gdb/python/py-unwind.c | 169 ++++++++++++++++++ > gdb/python/py-value.c | 21 +++ > gdb/python/python-internal.h | 3 + > gdb/python/python.c | 4 +- > .../gdb.python/py-unwind-transformer-error.py | 33 ++++ > .../gdb.python/py-unwind-transformer.c | 80 +++++++++ > .../gdb.python/py-unwind-transformer.exp | 115 ++++++++++++ > .../gdb.python/py-unwind-transformer.py | 48 +++++ > gdb/testsuite/gdb.python/py-value.exp | 8 + > 19 files changed, 763 insertions(+), 3 deletions(-) > create mode 100644 gdb/testsuite/gdb.python/py-unwind-transformer-error.py > create mode 100644 gdb/testsuite/gdb.python/py-unwind-transformer.c > create mode 100644 gdb/testsuite/gdb.python/py-unwind-transformer.exp > create mode 100644 gdb/testsuite/gdb.python/py-unwind-transformer.py Thanks, the documentation parts are okay, with one minor comment: > +gdb.unwinder.register_unwind_register_value_transformer(None, my_transformer, False) This line is too long, please break it in two. Reviewed-By: Eli Zaretskii