This is the mail archive of the mailing list for the Archer project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

python and structured output

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]