From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id lvLJJvCxJmozITwAWB0awg (envelope-from ) for ; Mon, 08 Jun 2026 08:13:36 -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=G89xTzKd; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 8BE8C1E0A3; Mon, 08 Jun 2026 08:13:36 -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 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 D07F81E062 for ; Mon, 08 Jun 2026 08:13:34 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 50D4D4AA51AE for ; Mon, 8 Jun 2026 12:13:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 50D4D4AA51AE 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=G89xTzKd Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 344234B1969E for ; Mon, 8 Jun 2026 12:13:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 344234B1969E 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 344234B1969E 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=1780920790; cv=none; b=KzqFGd25qGiFRR6sRsHGDZQhP4Glu5Jd/DuYKuagYpZ5A5ykY9eMW38OwBvQjA/X0ZToU8hLAiIqV5/JtCe17u70G+jYRJNjOcpCSfRgjVnfTZ2SKGTD5VGfieGpyRYfmbNeMA8vRYiBJWsPCdSVLFcEqHHC7nkZKfMB+n15gvc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780920790; c=relaxed/simple; bh=YVSe05uP6IlBY9PW7lHcJuecehE4Yqeb8PPL2kzlpiw=; h=DKIM-Signature:Date:Message-Id:From:To:Subject; b=CEOjQU514h5/27Mevpb2kyi2m6nbC2g2FccOOZZ8oGjgEP4GupSXDBYk5vKq0G6jyrAn7jmb2WmzaqhdHKzZNuZ+tBnzGccTwtUX9tX1hCZKXmI0gBGWcTT+EwWeb4Tq1H6GSaZVNcl+0+I3alFggDYru/5EeoNLOxCw/MELadc= 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=G89xTzKd DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 344234B1969E 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 1wWYqr-0003rz-Ew; Mon, 08 Jun 2026 08:13:09 -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=JTmgKZXA0+sMPKPumIm0LLGgzP+NaIgG83PcMPVLSGA=; b=G89xTzKdo1// pANAnpngo7DfH+E9Swnle38jrYJW+wqbAbv6BpKcUI53MHTYBiqy0JSHbvrDOW33mhnjRebSou8zl j4BTrF89c6EoqidsfAKIvzeJs9yMMweaJQMx6vV2KZ1HZHMPTrISJUXwv9waR9HfQHJqewh6iDLSd LR3iFhLWzDc7nm8iYGjH2RP00kCvk34L1DSmav+eeJG3T1RO1DjoJuxSzHcbpn7IqFlQNX5YyS8iq DXtYaXfZbvosxXG4gnY7qhF/vI4EFK5xHA0rUImrCeimYP4+kMGUSOktFk0mqSV/ZusgMKmeifkro rSW3NtZgzRLn6bFqsPPyvA==; Date: Mon, 08 Jun 2026 15:13:05 +0300 Message-Id: <86cxy1jkmm.fsf@gnu.org> From: Eli Zaretskii To: Craig Blackmore Cc: gdb-patches@sourceware.org, aburgess@redhat.com In-Reply-To: <20260608120437.566738-2-craig.blackmore@embecosm.com> (message from Craig Blackmore on Mon, 8 Jun 2026 13:04:37 +0100) Subject: Re: [PATCH v5 1/1] gdb: Add python support for transforming register unwind values References: <20260520131607.32885-1-craig.blackmore@embecosm.com> <20260608120437.566738-1-craig.blackmore@embecosm.com> <20260608120437.566738-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: Mon, 8 Jun 2026 13:04:37 +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 transformed. 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 a `read` method for transforming unwind > register values that have been read. There is no similar support for > transforming 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 `write` method. Currently writing > back to a transformed 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 `read` 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 | 17 ++ > gdb/doc/python.texi | 96 ++++++++++ > gdb/extension-priv.h | 8 + > gdb/extension.c | 35 ++++ > gdb/extension.h | 6 + > gdb/frame.c | 10 ++ > gdb/guile/guile.c | 2 + > gdb/python/lib/gdb/__init__.py | 21 +++ > gdb/python/lib/gdb/unwinder.py | 93 +++++++++- > 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, 768 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. Reviewed-By: Eli Zaretskii