From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26451 invoked by alias); 16 Sep 2010 11:56:36 -0000 Received: (qmail 26432 invoked by uid 22791); 16 Sep 2010 11:56:35 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-wy0-f169.google.com (HELO mail-wy0-f169.google.com) (74.125.82.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Sep 2010 11:56:31 +0000 Received: by wyb36 with SMTP id 36so1551460wyb.0 for ; Thu, 16 Sep 2010 04:56:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.227.72.200 with SMTP id n8mr2591672wbj.223.1284638189059; Thu, 16 Sep 2010 04:56:29 -0700 (PDT) Received: by 10.216.70.81 with HTTP; Thu, 16 Sep 2010 04:56:29 -0700 (PDT) In-Reply-To: <201009161148.37670.andre.poenitz@nokia.com> References: <201009161148.37670.andre.poenitz@nokia.com> Date: Thu, 16 Sep 2010 11:56:00 -0000 Message-ID: Subject: Re: Python API questions and use cases From: =?ISO-8859-1?Q?Joel_Borggr=E9n=2DFranck?= To: =?ISO-8859-1?B?QW5kcukgUPZuaXR6?= Cc: gdb@sourceware.org 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: 2010-09/txt/msg00095.txt.bz2 On Thu, Sep 16, 2010 at 11:48 AM, Andr=E9 P=F6nitz wrote: > On Thursday 16 September 2010 09:32:31 ext Joel Borggr=E9n-Franck wrote: >> > I think the tricky part is getting a Value holding the appropriate >> > constant. =A0For that you might not have anything better, at present, = than >> > parse_and_eval. >> >> True. Then I think this would be useful: >> >> gdb.new_address(addr) - returns a new gdb.Value (of type (void *)) point= ing >> to addr. addr is checked to be within bounds of the address space of the >> inferior upon creation. > > > gdb.Value(addr).cast(gdb.lookup_type('void').pointer()) should do the tri= ck. > This might be a case of missing (or obscure) documentation. Is there a place (other than the C impl.) where I can find documentation for the constructors/inits for the different gdb.XYZ types? With your example I can turn a string into an address without escaping to gdb-script. That is good enough for me, I can just roll my own helpers on top of that (which is the primary benefit of using Python imho). Cheers /Joel