From: Michel METZGER <michel.metzger@st.com>
To: Jeroen Dobbelaere <jeroen.dobbelaere@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: gdb python and 'complete'
Date: Wed, 24 Mar 2010 15:54:00 -0000 [thread overview]
Message-ID: <4BAA35AD.1090809@st.com> (raw)
In-Reply-To: <325e93671003240824t3e940773ned358335b9fe1f40@mail.gmail.com>
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
>
next prev parent reply other threads:[~2010-03-24 15:54 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 [this message]
2010-03-24 16:35 ` Jeroen Dobbelaere
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=4BAA35AD.1090809@st.com \
--to=michel.metzger@st.com \
--cc=gdb@sourceware.org \
--cc=jeroen.dobbelaere@gmail.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