Bug 10808 - Allow GDB/Python API to capture and store GDB output
Summary: Allow GDB/Python API to capture and store GDB output
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: python (show other bugs)
Version: archer
: P2 enhancement
Target Milestone: 7.2
Assignee: Tom Tromey
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-19 10:30 UTC by Phil Muldoon
Modified: 2010-06-25 18:16 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2010-06-10 19:55:33


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Muldoon 2009-10-19 10:30:03 UTC
Daniel Jacobowitz wrote about some Python/GDB experiences and bugs in the email:

http://sourceware.org/ml/archer/2009-q4/msg00008.html

This bug (and others in their own bugs) is extracted from that email to track
the issue:

* It would be really useful to temporarily redirect GDB output to a
memory buffer, i.e. a version of gdb.execute that captured the
command's output.  Especially where there aren't specific Python
bindings for what I wanted.
Comment 1 Tom Tromey 2010-06-10 19:55:33 UTC
Testing a patch.
Comment 2 Sourceware Commits 2010-06-25 18:15:40 UTC
Subject: Bug 10808

CVSROOT:	/cvs/src
Module name:	src
Changes by:	tromey@sourceware.org	2010-06-25 18:15:21

Modified files:
	gdb            : ChangeLog 
	gdb/doc        : ChangeLog gdb.texinfo 
	gdb/python     : python.c 
	gdb/testsuite  : ChangeLog 
	gdb/testsuite/gdb.python: python.exp 

Log message:
	gdb
	PR python/10808:
	* python/python.c (execute_gdb_command): Add keywords.  Accept
	"to_string" argument.
	(struct restore_ui_file_closure): New.
	(restore_ui_file): New function.
	(make_cleanup_restore_ui_file): Likewise.
	(GdbMethods) <execute>: Update.
	gdb/doc
	PR python/10808:
	* gdb.texinfo (Basic Python): Document new gdb.execute argument.
	gdb/testsuite
	PR python/10808:
	* gdb.python/python.exp: Add new tests.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.11931&r2=1.11932
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/doc/ChangeLog.diff?cvsroot=src&r1=1.1076&r2=1.1077
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/doc/gdb.texinfo.diff?cvsroot=src&r1=1.730&r2=1.731
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/python/python.c.diff?cvsroot=src&r1=1.42&r2=1.43
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.2352&r2=1.2353
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.python/python.exp.diff?cvsroot=src&r1=1.8&r2=1.9

Comment 3 Tom Tromey 2010-06-25 18:16:27 UTC
Fix checked in.