From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1871 invoked by alias); 27 Jan 2010 20:29:34 -0000 Received: (qmail 1863 invoked by uid 22791); 27 Jan 2010 20:29:34 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from PION.CLUB.CC.cmu.edu (HELO pion.club.cc.cmu.edu) (128.237.157.88) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 27 Jan 2010 20:29:29 +0000 Received: from rlane by pion.club.cc.cmu.edu with local (Exim 4.69) (envelope-from ) id 1NaEVy-0006Aj-TQ; Wed, 27 Jan 2010 15:29:26 -0500 Content-Type: text/plain; charset=UTF-8 From: Rich Lane To: Joseph Garvin Cc: gdb Subject: Re: Python API problems In-reply-to: References: Date: Wed, 27 Jan 2010 20:29:00 -0000 Message-Id: <1264621908-sup-8598@zyrg.net> User-Agent: Sup/git Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-01/txt/msg00203.txt.bz2 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.