This is the mail archive of the
mailing list for the GDB project.
Re: capturing command output to a variable
- From: Tom Tromey <tromey at redhat dot com>
- To: "Mathew Yeates" <mat dot yeates at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Sun, 11 Jan 2009 15:37:26 -0700
- Subject: Re: capturing command output to a variable
- References: <firstname.lastname@example.org>
- Reply-to: tromey at redhat dot com
>>>>> "Mathew" == Mathew Yeates <email@example.com> writes:
Mathew> I understand that turning on logging will allow me to save command
Mathew> output to a file. But what if I want to save the output in a
Mathew> convenience variable??
As far as I know, with cvs gdb this can only be done with difficulty.
For example, you could log the output of the command to a file, then
use 'shell' to run sed on the file to turn it into a gdb command which
sets the convenience variable, and then finally 'source' the result.
The Python integration will make this sort of thing much simpler,
though it occurs to me that we haven't done full I/O integration yet,
so this example remains difficult there. (I do have most of a patch
to add ui-file wrappers to Python... I guess I ought to finish that.)