From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2327 invoked by alias); 10 Jun 2009 21:06:10 -0000 Received: (qmail 2318 invoked by uid 22791); 10 Jun 2009 21:06:10 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from fmmailgate02.web.de (HELO fmmailgate02.web.de) (217.72.192.227) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 10 Jun 2009 21:06:04 +0000 Received: from smtp08.web.de (fmsmtp08.dlan.cinetic.de [172.20.5.216]) by fmmailgate02.web.de (Postfix) with ESMTP id 7CCB01028C947; Wed, 10 Jun 2009 23:06:01 +0200 (CEST) Received: from [88.64.26.191] (helo=[192.168.1.10]) by smtp08.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #277) id 1MEUzh-0002v9-00; Wed, 10 Jun 2009 23:06:01 +0200 Message-ID: <4A302033.90501@web.de> Date: Wed, 10 Jun 2009 21:06:00 -0000 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: tromey@redhat.com CC: gdb@sourceware.org Subject: Re: container_of equivalent in gdb-python script References: <4A2FE5AB.4060707@siemens.com> <4A30133F.9000909@web.de> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigB21E77BEB447687582B37AE7" X-Sender: jan.kiszka@web.de Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-06/txt/msg00098.txt.bz2 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigB21E77BEB447687582B37AE7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-length: 982 Tom Tromey wrote: >>>>>> "Jan" =3D=3D Jan Kiszka writes: >=20 > Jan> I meanwhile discovered (reading testcases and python-*.c) > Jan> gdb.lookup_type() and Value.cast() to make this real. But you see, I > Jan> still need an ugly synthetic Value object which must have a non-'Non= e' > Jan> address to do this calculation. Is there a cleaner, more generic way? >=20 > Yeah, I think the missing piece is "gdb.parse_and_eval", which is on > the archer python branch, but which we haven't pushed upstream into > gdb CVS yet. This takes an expression (a string), parses it, > evaluates it, and returns a Value. It is very convenient when > implementing your own gdb commands. Perfect, that solves the problem! Just checked out and tried successfully. >=20 > I don't think there's any particular problem with submitting this, > just somebody finding the time. >=20 Hopefully before the next release. I would try to help, but I don't have an FSF assignment. Jan --------------enigB21E77BEB447687582B37AE7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" Content-length: 257 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkowIDgACgkQniDOoMHTA+kgeQCfXl1Avlc4lGoLnfI96FhSlUDQ +YAAnRSPfH7aTPb8NcvI4+Kgj4N6iNxO =EQfc -----END PGP SIGNATURE----- --------------enigB21E77BEB447687582B37AE7--