public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Project Archer <archer@sourceware.org>
Subject: python and structured output
Date: Wed, 30 Jun 2010 17:30:00 -0000	[thread overview]
Message-ID: <m3eifosa0p.fsf@fleche.redhat.com> (raw)

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

                 reply	other threads:[~2010-06-30 17:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=m3eifosa0p.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=archer@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).