From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id BE618385AC1E for ; Wed, 10 Nov 2021 14:09:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BE618385AC1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from tarox.wildebeest.org (83-87-18-245.cable.dynamic.v4.ziggo.nl [83.87.18.245]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 79B8F302FBAB; Wed, 10 Nov 2021 15:09:05 +0100 (CET) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 0ACB7413CC9A; Wed, 10 Nov 2021 15:09:05 +0100 (CET) Message-ID: <09b881f7d70ea379a476898dbb01e812b1490bbd.camel@klomp.org> Subject: Re: unwind non-PC registers using elfutils From: Mark Wielaard To: Jacob Burkholder , elfutils-devel@sourceware.org Date: Wed, 10 Nov 2021 15:09:04 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Evolution 3.28.5 (3.28.5-10.el7) Mime-Version: 1.0 X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Nov 2021 14:09:09 -0000 Hi Jacob, On Sun, 2021-10-03 at 09:38 -0700, Jacob Burkholder via Elfutils-devel wrot= e: > Hi, I'm trying to figure out how to unwind registers other than the PC > using elfutils. I can use dwfl_module_register_names to get the register > names, and then I'm trying to use dwarf_frame_register to get the registe= r > values for a given frame. I looked at the code in __libdwfl_frame_unwind > and there's another example in addrcfi.c. dwarf_frame_register seems > quite a low level dwarf API, I'm not sure how to use the ops that are > returned, also the code used by __libdwfl_frame_unwind to evaluate the op= s > is all static or internal so not callable. Any guidance? Do I need to > basically interpret the dwarf atoms in the ops returned by > dwarf_frame_register? Any plans to make code like > frame_unwind.c:expr_eval() used by frame_unwind.c:handle_cfi externally > accessible? Sorry for the late reply. I missed this message earlier. As you correctly observe the public API only supports unwinding of threads for backtraces with just the PC. Internally most of the logic of unwinding other registers is there, but we don't have a public API for it. We really should. I filed: https://sourceware.org/bugzilla/show_bug.cgi?id=3D28579 Could you add some requirements there? The hard part is making sure the interface is actually useful. What information do you have and what information do you want to get out? Thanks, Mark