[patch] Fix uiout for execute_command_to_string
Paul Bolle
pebolle@tiscali.nl
Sat Sep 4 15:36:00 GMT 2010
On Fri, 2010-09-03 at 20:06 +0200, Jan Kratochvil wrote:
> Redirected there also gdb_stdlog as it seems appropriate to me. That is
> remain unredirected gdb_stdin, gdb_stdtargin, gdb_stdtarg and gdb_stdtargerr,
> I do not much understand gdb_stdtarg* but it seems to +/- match other
> redirections in GDB.
It seems I need the (trivial) patch below (to be applied on your recent
work) to also get the output from remote commands invoked by the python
command redirected to a string. Example:
foo = gdb.execute("monitor foo", to_string=True)
I can't recall exactly why this is needed. (It's about a week ago that I
noticed this, while trying to understand
https://bugzilla.redhat.com/show_bug.cgi?id=627506 ).
Paul
---
diff -up gdb-7.1.90.20100806/gdb/top.c.gdbstdt_arg gdb-7.1.90.20100806/gdb/top.c
--- gdb-7.1.90.20100806/gdb/top.c.gdbstdt_arg 2010-09-03 23:01:23.000000000 +0200
+++ gdb-7.1.90.20100806/gdb/top.c 2010-09-03 23:25:12.000000000 +0200
@@ -480,6 +480,7 @@ execute_command_to_string (char *p, int
make_cleanup_restore_ui_file (&gdb_stdout);
make_cleanup_restore_ui_file (&gdb_stderr);
make_cleanup_restore_ui_file (&gdb_stdlog);
+ make_cleanup_restore_ui_file (&gdb_stdtarg);
if (ui_out_redirect (uiout, str_file) < 0)
warning (_("Current output protocol does not support redirection"));
@@ -489,6 +490,7 @@ execute_command_to_string (char *p, int
gdb_stdout = str_file;
gdb_stderr = str_file;
gdb_stdlog = str_file;
+ gdb_stdtarg = str_file;
execute_command (p, from_tty);
More information about the Gdb-patches
mailing list