From: Tom Tromey <tromey@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: gdb@sourceware.org
Subject: Re: container_of equivalent in gdb-python script
Date: Wed, 10 Jun 2009 18:57:00 -0000 [thread overview]
Message-ID: <m3prdbgbnc.fsf@fleche.redhat.com> (raw)
In-Reply-To: <4A2FE5AB.4060707@siemens.com> (Jan Kiszka's message of "Wed\, 10 Jun 2009 18\:56\:11 +0200")
>>>>> "Jan" == Jan Kiszka <jan.kiszka@siemens.com> writes:
Jan> I'm at the point where I would apply a standard container_of()
Jan> macro in C: convert the list entry into a gdb.Value that
Jan> describes the containing object.
Jan> Of course, I can implement container_of as a gdb expression, print the
Jan> result and drag it in via gdb.history(). Done that already, basically
Jan> works. But it is fairly ugly as the print output will flood the screen.
I would say that the usual approach would be to reimplement the macro
in Python. The Python Value API is reasonably robust and can usually
be used for this. If you post the macro definition maybe I could help
with that. More details wouldn't hurt, either... are you writing a
pretty-printer? A new command? A convenience function?
Tom
next prev parent reply other threads:[~2009-06-10 18:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-10 16:56 Jan Kiszka
2009-06-10 18:57 ` Tom Tromey [this message]
2009-06-10 20:10 ` Jan Kiszka
2009-06-10 20:37 ` Tom Tromey
2009-06-10 21:06 ` Jan Kiszka
2009-06-10 20:42 ` Daniel Jacobowitz
2009-06-10 21:33 ` Jan Kiszka
2009-06-10 21:42 ` Tom Tromey
2009-06-10 22:13 ` Jan Kiszka
2009-06-10 22:17 ` Tom Tromey
2009-06-11 9:51 ` Jan Kiszka
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=m3prdbgbnc.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb@sourceware.org \
--cc=jan.kiszka@siemens.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