This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

Re: RFA: add to_string argument to gdb.execute


On Thu, Jun 10, 2010 at 1:26 PM, Tom Tromey <tromey@redhat.com> wrote:
> I plan to check this in. ?It needs a doc review.
>
> This adds a to_string argument to gdb.execute, so you can capture
> command output in a python string.
>
> I've gone back and forth on how I wanted to implement this idea, but in
> the end I settled on this approach as very simple and useful.
>
> This patch also adds keyword arguments to gdb.execute. ?I think our rule
> should be that any function with 2 or more arguments should take keyword
> arguments; we violate this in a couple of places.
>
> There is still room for a bigger change, involving structured output
> from gdb. ?My plan there is to expose MI commands to Python, and make a
> new kind of ui_out that creates Python objects. ?I think this approach
> has several nice points: we know it will be fairly complete (because MI
> is), and we already have documentation.

This feels like a with-output-to-string kind-of-problem.
i.e. the wrapping of collecting the output to a string belongs at a
higher level.

Scheme example:

(define x (with-output-to-string (lambda () (display "foo"))))

That way one can wrap anything and have all the gdb output collected
without having to modify all the individual gdb.execute calls inside.
Dunno if it's as easy to implement though.


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