Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Rich Lane <rlane@club.cc.cmu.edu>
To: Joseph Garvin <joseph.h.garvin@gmail.com>
Cc: gdb <gdb@sourceware.org>
Subject: Re: Python API problems
Date: Wed, 27 Jan 2010 20:29:00 -0000	[thread overview]
Message-ID: <1264621908-sup-8598@zyrg.net> (raw)
In-Reply-To: <fea8ac9f1001271127w7efe3c38gfcb2a49eca6eb854@mail.gmail.com>

Excerpts from Joseph Garvin's message of 2010-01-27 14:27:05 -0500:
> -That could be worked around if gdb.execute returned a string
> containing what information would otherwise have gone to the console.
> Then we could at least parse the output. This would be nice in general
> for working around API holes until they're filled. Because of this I
> can't even manually search the output from "info functions" (though
> searching that would be slooooooow).

I worked around this with a terrible hack:

def gdbx(cmd):
   fd, filename = tempfile.mkstemp('.gdb-out')
   gdb.execute("set logging off")
   gdb.execute("set logging file" + filename)
   gdb.execute("set logging redirect on")
   gdb.execute("set logging on")
   try:
      gdb.execute(cmd)
   finally:
      gdb.execute("set logging off")
      gdb.execute("set logging redirect off")
      str = os.fdopen(fd).read()
      os.remove(filename)
      return str.strip()

Unfortunately, this doesn't work if you try to use "interpreter-exec mi"
to get easily parseable output.

There's an open bug: http://sourceware.org/bugzilla/show_bug.cgi?id=10808

I'm also very much looking forward to the python API becoming more
complete. It would be useful to have the function parameters in a Frame
object, for example.


  parent reply	other threads:[~2010-01-27 20:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-27 19:27 Joseph Garvin
2010-01-27 19:39 ` Joseph Garvin
2010-01-27 20:29 ` Rich Lane [this message]
2010-01-30  2:23 ` Tom Tromey

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=1264621908-sup-8598@zyrg.net \
    --to=rlane@club.cc.cmu.edu \
    --cc=gdb@sourceware.org \
    --cc=joseph.h.garvin@gmail.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