Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jeroen Dobbelaere <jeroen.dobbelaere@gmail.com>
To: Michel METZGER <michel.metzger@st.com>
Cc: gdb@sourceware.org
Subject: Re: gdb python and 'complete'
Date: Wed, 24 Mar 2010 16:35:00 -0000	[thread overview]
Message-ID: <325e93671003240935w7bd6c5d3x432f5982b5461805@mail.gmail.com> (raw)
In-Reply-To: <4BAA35AD.1090809@st.com>

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 <michel.metzger@st.com> wrote:
> Hi,
>
> You could used the lookup_type method.
> Something like:
>
> type = 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):
>> ...
>>
>>   def retrieveFunctionSummary(self):
>>      member_list=gdb.execute("complete b 'MyClass::").split("\n")
>>      ....
>>
>> 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
>>
>
>



-- 
Jeroen Dobbelaere


  reply	other threads:[~2010-03-24 16:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-24 15:24 Jeroen Dobbelaere
2010-03-24 15:54 ` Michel METZGER
2010-03-24 16:35   ` Jeroen Dobbelaere [this message]
2010-03-24 17:16 ` Daniel Jacobowitz
2010-03-24 17:59 ` Tom Tromey
2010-03-24 22:02   ` Jeroen Dobbelaere
2010-03-24 22:55     ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=325e93671003240935w7bd6c5d3x432f5982b5461805@mail.gmail.com \
    --to=jeroen.dobbelaere@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=michel.metzger@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox