From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1995 invoked by alias); 24 Mar 2010 16:35:53 -0000 Received: (qmail 1985 invoked by uid 22791); 24 Mar 2010 16:35:53 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40 X-Spam-Check-By: sourceware.org Received: from mail-ew0-f214.google.com (HELO mail-ew0-f214.google.com) (209.85.219.214) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 24 Mar 2010 16:35:49 +0000 Received: by ewy6 with SMTP id 6so1859323ewy.4 for ; Wed, 24 Mar 2010 09:35:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.213.35.10 with HTTP; Wed, 24 Mar 2010 09:35:46 -0700 (PDT) In-Reply-To: <4BAA35AD.1090809@st.com> References: <325e93671003240824t3e940773ned358335b9fe1f40@mail.gmail.com> <4BAA35AD.1090809@st.com> Date: Wed, 24 Mar 2010 16:35:00 -0000 Received: by 10.213.69.17 with SMTP id x17mr2184927ebi.91.1269448546556; Wed, 24 Mar 2010 09:35:46 -0700 (PDT) Message-ID: <325e93671003240935w7bd6c5d3x432f5982b5461805@mail.gmail.com> Subject: Re: gdb python and 'complete' From: Jeroen Dobbelaere To: Michel METZGER 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-03/txt/msg00196.txt.bz2 Hi, that will indeed give me the data members. Is there also a way to retrieve the available methods ? Thanks, Jeroen On Wed, Mar 24, 2010 at 4:54 PM, Michel METZGER wro= te: > Hi, > > You could used the lookup_type method. > Something like: > > type =3D gdb.lookup_type("MyClass") > > and then iterate over the type.field() collection. > Take a look at section 23.2.2.5 of the GDB doc to see what is available in > the Field object. > > Regards, > > Michel Metzger. > > > Jeroen Dobbelaere wrote: >> >> Hi, >> >> I am trying to create some helper commands using python with gdb-7.1. >> >> One of the things I want to do, is to retrieve the members of a c++ >> class, do some filtering and >> present the result in a nice way. >> >> I tried doing this, by delegating part of the request to the >> 'complete' command, like in : >> >> class ShowNiceRepresentation(gdb.Command): >> ... >> >> =A0 def retrieveFunctionSummary(self): >> =A0 =A0 =A0member_list=3Dgdb.execute("complete b 'MyClass::").split("\n") >> =A0 =A0 =A0.... >> >> Now, the 'complete' command is indeed retrieving all the member >> functions, but it will output them in the terminal in stead of feeding >> it back to 'member_list'. >> >> Is there a way to redirect the output, so that the python program can >> investigate it ? >> Or is there a more appropriate way to access the members of a c++ >> class form within python ? >> >> Greetings, >> >> Jeroen Dobbelaere >> > > --=20 Jeroen Dobbelaere