From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21142 invoked by alias); 31 Oct 2019 16:40:52 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 21131 invoked by uid 89); 31 Oct 2019 16:40:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-6.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=Later, funny X-Spam-Status: No, score=-6.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: gnu.wildebeest.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (212.238.236.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 31 Oct 2019 16:40:51 +0000 Received: from tarox.wildebeest.org (tarox.wildebeest.org [172.31.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 06EF3302AB34; Thu, 31 Oct 2019 17:40:48 +0100 (CET) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id B422042CED16; Thu, 31 Oct 2019 17:40:48 +0100 (CET) Message-ID: <471226e46b371ec209f81898b9d3ccd5ed52eb89.camel@klomp.org> Subject: Re: [PATCH 5/5] libdwfl: add interface for evaluating DWARF expressions in a frame From: Mark Wielaard To: Omar Sandoval Cc: elfutils-devel@sourceware.org Date: Thu, 31 Oct 2019 16:40:00 -0000 In-Reply-To: <20191030235945.GK326591@vader> References: <340240576c11f97cd326f76b7decd9164c74e91e.1570438723.git.osandov@fb.com> <7bb91fd1006b5346013093bfaa6c6981035588e4.camel@klomp.org> <20191030235945.GK326591@vader> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Evolution 3.28.5 (3.28.5-5.el7) Mime-Version: 1.0 X-Spam-Flag: NO X-IsSubscribed: yes X-SW-Source: 2019-q4/txt/msg00094.txt.bz2 On Wed, 2019-10-30 at 16:59 -0700, Omar Sandoval wrote: > On Wed, Oct 30, 2019 at 02:23:06PM +0100, Mark Wielaard wrote: > > Having some examples/testcases would also show how/where to get the > > DWARF expressions to use with this new function. >=20 > Sounds good, I'll put some examples/test cases together. FWIW, I'm using > it in drgn to get register values like so: >=20 > LIBDRGN_PUBLIC struct drgn_error * > drgn_stack_frame_register(struct drgn_stack_frame frame, > enum drgn_register_number regno, uint64_t *ret) > { > const Dwarf_Op op =3D { .atom =3D DW_OP_regx, .number =3D regno, }; > Dwarf_Addr value; >=20 > if (!dwfl_frame_eval_expr(frame.trace->frames[frame.i], &op, 1, &value)) > return drgn_error_libdwfl(); > *ret =3D value; > return NULL; > } O! I hadn't even thought of that. Funny using it with "hand constructed" DWARF expressions. > Later, I plan to use this for location expressions for local variables > that I get out of DWARF. Yes, that was what I assumed you were using it for already. I think it will work for that. But it would be nice to have some code/example that actually does it. Thanks, Mark