From: Tom Tromey <tromey@redhat.com>
To: Phil Muldoon <pmuldoon@redhat.com>
Cc: GDB Development <gdb@sourceware.org>
Subject: Re: Python API plans
Date: Wed, 25 Aug 2010 16:41:00 -0000 [thread overview]
Message-ID: <m339u2lk59.fsf@fleche.redhat.com> (raw)
In-Reply-To: <4C753A8C.3060602@redhat.com> (Phil Muldoon's message of "Wed, 25 Aug 2010 16:45:16 +0100")
>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
Phil> There are two areas I would like to see improved beyond the initial
Phil> patch. I have no opinion whether these can be incrementally improved
Phil> after submission, or if we should hack on them first.
These look good. I think it is a good idea for the first commit of a
few feature to be as "API-complete" as we can make it: that is, we
should try to reduce the number of future changes to which a user must
adapt. E.g., changing the return type of a method is hard to adapt to,
but adding a new method to a class is easy to adapt to. In this
particular case, I think it is best to try to make the events as
expressive as possible first; but the details of how events are
implemented (Python or C) are not important provided they are
future-proof.
Phil> I agree about the eager loading. It might amount to nothing at all.
Phil> If it does turn out to be expensive, what about having commands
Phil> register themselves against a global Python list? This would be
Phil> similar to how pretty-printers work. We could defer loading until the
Phil> command is needed, but still (with some alteration to the completion
Phil> code) allow the user to see the command-list in 'help 'and make the
Phil> commands available for tab-completion?
I think there is a simpler way that we could try first:
http://sourceware.org/ml/gdb-patches/2010-07/msg00201.html
This wouldn't require any changes to the gdb core.
Tom> * Sometimes it would be nice to write a command with the same name as
Tom> an existing command, but then delegate to the existing command (say,
Tom> via a super call).
Phil> Do you mean purely Python commands overriding other Python commands, or
Phil> in-built commands as well?
I meant built-in commands, but being generic would not be bad.
Phil> I'm not sure if you can run arbitrary Python code in a condition
Phil> though (i.e., .condition("python if somePythonFunction() ==
Phil> True").
Yeah, you can via a convenience function. That is pretty ugly though.
Phil> Ideally I'd like the Python API to be fully aware of the state of the
Phil> inferior. On the flip-side I'd also to be able to control the
Phil> inferior in a more atomic way than issuing gdb.execute("step")
Phil> commands and guessing if the inferior did as expected.
The dreaded MI wrappers would achieve this ;-)
I'm mildly concerned about writing a bunch of wrappers for these
commands that work either synchronously or asynchronously, depending on
the non-stop setting. It seems like it would be preferable to make them
always async, with some kind of completion hook. But, I think that may
require a big gdb change, like always enabling non-stop or something
along those lines.
So, I think we should defer explicit support for step/next/etc until we
have a bit more clarity about long term goals here. (I don't really
consider the MI wrapper project as "explicit" -- since that is more
like, do one change and get a bunch of stuff "for free", even if some of
what you get is useless or doesn't really make sense.)
Phil> * Python breakpoints to support 'catch' breakpoints (especially the
Phil> system-call variety).
Sounds good.
Phil> * Make it so that tab completion knows about Python API
Phil> completions. So (gdb) gdb.<TAB> would list all of the available
Phil> Python bits associated with the GDB module.
Make this lower priority. It might be nice to have but I think basic
functionality is more important.
Phil> * Python representation of a target.
I think the note on the wiki was about letting people write new targets
in Python. This might be interesting but I think it is a very low
priority.
If there are parts of the target or gdbarch that are needed for generic
scripting stuff, then we should export those via some read-only
interface.
Phil> * Allow Python scripts to control start-up of GDB so it allows the
Phil> equivalent of gcore like commands.
I pushed this kind of scripting/tracing idea for a while. And, I do
still like it. But I also think that, for us, systemtap fills the
non-interactive tracing role quite well.
So, I think we should focus more on gdb's interactive functionality.
I'd like to do some deeper systemtap integration with gdb, too, but that
isn't on this list since it isn't related to Python.
Tom
prev parent reply other threads:[~2010-08-25 16:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-24 1:06 Tom Tromey
2010-08-24 9:39 ` André Pönitz
2010-08-24 20:06 ` Tom Tromey
2010-08-25 15:45 ` Phil Muldoon
2010-08-25 16:41 ` Tom Tromey [this message]
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=m339u2lk59.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb@sourceware.org \
--cc=pmuldoon@redhat.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