public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: RFA: add to_string argument to gdb.execute
Date: Thu, 10 Jun 2010 20:55:00 -0000	[thread overview]
Message-ID: <AANLkTikloPg4mFEk5fsA3sL6v13bEjid55seSprXyLmf@mail.gmail.com> (raw)
In-Reply-To: <m3d3vy8whn.fsf@fleche.redhat.com>

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.

  reply	other threads:[~2010-06-10 20:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-10 20:27 Tom Tromey
2010-06-10 20:55 ` Doug Evans [this message]
2010-06-10 21:06   ` Tom Tromey
2010-06-10 21:19     ` Doug Evans
2010-06-11 15:29 ` Daniel Jacobowitz
2010-06-17 20:25 ` Tom Tromey
2010-06-25 16:55   ` Tom Tromey
2010-06-25 17:04     ` Eli Zaretskii

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=AANLkTikloPg4mFEk5fsA3sL6v13bEjid55seSprXyLmf@mail.gmail.com \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).