From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30718 invoked by alias); 17 Jun 2009 05:51:39 -0000 Received: (qmail 30707 invoked by uid 22791); 17 Jun 2009 05:51:38 -0000 X-SWARE-Spam-Status: No, hits=0.5 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_54,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-qy0-f191.google.com (HELO mail-qy0-f191.google.com) (209.85.221.191) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 17 Jun 2009 05:51:30 +0000 Received: by qyk29 with SMTP id 29so204062qyk.12 for ; Tue, 16 Jun 2009 22:51:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.73.5 with SMTP id o5mr6439143vcj.112.1245217888331; Tue, 16 Jun 2009 22:51:28 -0700 (PDT) In-Reply-To: References: <629542d40906142322h733ad7ffr3d6daeb7b306ff7a@mail.gmail.com> Date: Wed, 17 Jun 2009 05:51:00 -0000 Message-ID: <629542d40906162251v4a4723f3l9423eec5998d0ee6@mail.gmail.com> Subject: Re: Modify address of a gdb.Value From: Niko Sams To: gdb Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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/msg00178.txt.bz2 > newval =3D (val.cast(Type('char').pointer()) - payload).cast(val.type) that is working, thanks. > Nobody has implemented inferior function calls using Value yet. > So the payload() part is not implementable. > > If you know what it returns, or you can compute it in Python, then > this is no big deal. =A0You can use Value.cast to cast to some other > type, then do pointer math. I tried to implement this payload method in python, the c++ code is the following: template struct QMapPayloadNode { Key key; T value; QMapData::Node *backward; }; static inline int payload() { return sizeof(PayloadNode) - sizeof(QMapData::Node *); } the obvious solution would be gdb.lookup_type('QMapPayloadNode<%s, %s>' % (self.ktype, self.vtype)).sizeof but that doesn't work, i get this error: RuntimeError: No type named QMapPayloadNode This is because that QMapPayloadNode is not instanciated, it's only used for this sizeof. So any idea how i can compute the payload? Niko