public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
* python and structured output
@ 2010-06-30 17:30 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2010-06-30 17:30 UTC (permalink / raw)
  To: Project Archer

I've been thinking for a while about a way to reuse the ui_out machinery
in gdb to get structured Python objects as output from gdb commands.
This in itself is easy enough to do, but documenting it seems hard.  I
recently hit on the idea of reusing MI commands -- and thus MI
documentation -- do accomplish this.

The full plan would be something like this:

* Write a new ui_out object that creates Python objects.

* Make a few new Python modules: gdb.mi1, gdb.mi2, gdb.mi3 (and an alias
  gdb.mi).  Each module would export all the relevant MI commands to
  Python.  The commands would have to be renamed a little, to account
  for MI/Python syntax differences.

* All the functions would share a single implementation, which would
  convert its arguments to strings, install a new python ui_out object,
  and then call the underlying MI command.

  It is possible that we'd need some changes in the MI code to make this
  as nice as possible.  I am not sure.

* Ideally we would not have to register all these new Python commands
  ahead-of-time, but rather do lookups on demand.

I think we'd still need some kind of event module, a la Oguz's work, to
deal with inferior state changes.

This approach is not quite as nice as custom API for each module -- and
we would still need that in places -- but it would open up a lot more of
gdb with little effort.

Tom

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-06-30 17:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-30 17:30 python and structured output Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).