public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [patch] Fix uiout for execute_command_to_string
@ 2010-09-03 20:03 Jan Kratochvil
  2010-09-04 15:36 ` Paul Bolle
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2010-09-03 20:03 UTC (permalink / raw)
  To: gdb-patches; +Cc: pebolle

Hi,

uiout is currently not redirected in execute_command_to_string.  This function
is currently testable only using python.

(gdb) python gdb.execute("help",to_string=True)
Aliases of other commandsMaking program stop at certain pointsExamining dataSpecifying and examining filesMaintenance commandsObscure featuresRunning the programExamining the stackStatus inquiriesSupport facilitiesTracing of program execution without stopping the programUser-defined commands(gdb) 

Bugreport (with patches posting) by Paul Bolle:
	https://bugzilla.redhat.com/show_bug.cgi?id=627506

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.

No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu.


Thanks,
Jan


gdb/
2010-09-03  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Redirect also uiout in execute_command_to_string.
	* defs.h (struct ui_out, make_cleanup_ui_out_redirect_pop): New
	declarations.
	* top.c (execute_command_to_string): Move make_cleanup_ui_file_delete
	to the top.  Redirect also gdb_stdlog.  Use ui_out_redirect, register
	make_cleanup_ui_out_redirect_pop.
	* utils.c (do_ui_out_redirect_pop, make_cleanup_ui_out_redirect_pop):
	New functions.

gdb/testsuite/
2010-09-03  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.python/python.exp (set height 0, collect help from uiout)
	(verify help to uiout): New tests.

--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -337,6 +337,10 @@ extern struct cleanup *make_cleanup_freeargv (char **);
 struct ui_file;
 extern struct cleanup *make_cleanup_ui_file_delete (struct ui_file *);
 
+struct ui_out;
+extern struct cleanup *
+  make_cleanup_ui_out_redirect_pop (struct ui_out *uiout);
+
 struct section_addr_info;
 extern struct cleanup *(make_cleanup_free_section_addr_info 
                         (struct section_addr_info *));
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -149,6 +149,12 @@ gdb_test_multiple "python print \"\\n\" * $lines" $test {
 }
 gdb_test "q" "Quit" "verify pagination afterwards: q"
 
+gdb_test_no_output "set height 0"
+
+gdb_test_no_output "python a = gdb.execute('help', to_string=True)" "collect help from uiout"
+
+gdb_test "python print a" ".*aliases -- Aliases of other commands.*" "verify help to uiout"
+
 # Start with a fresh gdb.
 clean_restart ${testfile}
 
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -475,12 +475,19 @@ execute_command_to_string (char *p, int from_tty)
 
   str_file = mem_fileopen ();
 
+  make_cleanup_ui_file_delete (str_file);
   make_cleanup_restore_ui_file (&gdb_stdout);
   make_cleanup_restore_ui_file (&gdb_stderr);
-  make_cleanup_ui_file_delete (str_file);
+  make_cleanup_restore_ui_file (&gdb_stdlog);
+
+  if (ui_out_redirect (uiout, str_file) < 0)
+    warning (_("Current output protocol does not support redirection"));
+  else
+    make_cleanup_ui_out_redirect_pop (uiout);
 
   gdb_stdout = str_file;
   gdb_stderr = str_file;
+  gdb_stdlog = str_file;
 
   execute_command (p, from_tty);
 
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -312,6 +312,21 @@ make_cleanup_ui_file_delete (struct ui_file *arg)
 }
 
 static void
+do_ui_out_redirect_pop (void *arg)
+{
+  struct ui_out *uiout = arg;
+
+  if (ui_out_redirect (uiout, NULL) < 0)
+    warning (_("Cannot restore redirection of the current output protocol"));
+}
+
+struct cleanup *
+make_cleanup_ui_out_redirect_pop (struct ui_out *uiout)
+{
+  return make_my_cleanup (&cleanup_chain, do_ui_out_redirect_pop, uiout);
+}
+
+static void
 do_free_section_addr_info (void *arg)
 {
   free_section_addr_info (arg);

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] Fix uiout for execute_command_to_string
  2010-09-03 20:03 [patch] Fix uiout for execute_command_to_string Jan Kratochvil
@ 2010-09-04 15:36 ` Paul Bolle
  2010-09-10 13:02   ` Jan Kratochvil
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Bolle @ 2010-09-04 15:36 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

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);
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] Fix uiout for execute_command_to_string
  2010-09-04 15:36 ` Paul Bolle
@ 2010-09-10 13:02   ` Jan Kratochvil
  2010-09-10 22:05     ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2010-09-10 13:02 UTC (permalink / raw)
  To: Paul Bolle; +Cc: gdb-patches

On Sat, 04 Sep 2010 00:06:31 +0200, Paul Bolle wrote:
> 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)

Updated the patch with this part.  Paul Bolle said he does not have a signed
FSF copyright assignment; if it matters in this case.

Redirected also gdb_stdtargerr although I did not verify that part, IMO FSF
gdbserver cannot send inferior data to it.

No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu.
Only for nat, I did not regression test it against gdbserver, though.

OK to check-in?


Thanks,
Jan


gdb/
2010-09-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
	    Paul Bolle  <pebolle@tiscali.nl>

	Redirect also uiout and stdtarg{,err} in execute_command_to_string.
	* cli-logging.c (struct saved_output_files) <targerr>: New.
	(set_logging_redirect, pop_output_files, handle_redirections):
	Redirect also gdb_stdtargerr.
	* defs.h (struct ui_out, make_cleanup_ui_out_redirect_pop): New
	declarations.
	* event-top.c (gdb_setup_readline, gdb_disable_readline): Redirect
	also gdb_stdtargerr.
	* top.c (execute_command_to_string): Move make_cleanup_ui_file_delete
	to the top.  Redirect also gdb_stdlog, gdb_stdtarg and gdb_stdtargerr.
	Use ui_out_redirect, register make_cleanup_ui_out_redirect_pop.
	* tui/tui-io.c (tui_setup_io): Redirect also gdb_stdtargerr.
	* utils.c (do_ui_out_redirect_pop, make_cleanup_ui_out_redirect_pop):
	New functions.

gdb/testsuite/
2010-09-09  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.python/python.exp (set height 0, collect help from uiout)
	(verify help to uiout): New tests.

--- a/gdb/cli/cli-logging.c
+++ b/gdb/cli/cli-logging.c
@@ -33,6 +33,7 @@ struct saved_output_files
   struct ui_file *err;
   struct ui_file *log;
   struct ui_file *targ;
+  struct ui_file *targerr;
 };
 static struct saved_output_files saved_output;
 static char *saved_filename;
@@ -116,6 +117,7 @@ set_logging_redirect (char *args, int from_tty, struct cmd_list_element *c)
   gdb_stderr = output;
   gdb_stdlog = output;
   gdb_stdtarg = output;
+  gdb_stdtargerr = output;
   logging_no_redirect_file = new_logging_no_redirect_file;
 
   /* There is a former output pushed on the ui_out_redirect stack.  We want to
@@ -154,10 +156,12 @@ pop_output_files (void)
   gdb_stderr = saved_output.err;
   gdb_stdlog = saved_output.log;
   gdb_stdtarg = saved_output.targ;
+  gdb_stdtargerr = saved_output.targ;
   saved_output.out = NULL;
   saved_output.err = NULL;
   saved_output.log = NULL;
   saved_output.targ = NULL;
+  saved_output.targerr = NULL;
 
   ui_out_redirect (uiout, NULL);
 }
@@ -211,11 +215,13 @@ handle_redirections (int from_tty)
   saved_output.err = gdb_stderr;
   saved_output.log = gdb_stdlog;
   saved_output.targ = gdb_stdtarg;
+  saved_output.targerr = gdb_stdtargerr;
 
   gdb_stdout = output;
   gdb_stderr = output;
   gdb_stdlog = output;
   gdb_stdtarg = output;
+  gdb_stdtargerr = output;
 
   if (ui_out_redirect (uiout, output) < 0)
     warning (_("Current output protocol does not support redirection"));
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -337,6 +337,10 @@ extern struct cleanup *make_cleanup_freeargv (char **);
 struct ui_file;
 extern struct cleanup *make_cleanup_ui_file_delete (struct ui_file *);
 
+struct ui_out;
+extern struct cleanup *
+  make_cleanup_ui_out_redirect_pop (struct ui_out *uiout);
+
 struct section_addr_info;
 extern struct cleanup *(make_cleanup_free_section_addr_info 
                         (struct section_addr_info *));
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -1048,6 +1048,7 @@ gdb_setup_readline (void)
   gdb_stderr = stdio_fileopen (stderr);
   gdb_stdlog = gdb_stderr;  /* for moment */
   gdb_stdtarg = gdb_stderr; /* for moment */
+  gdb_stdtargerr = gdb_stderr; /* for moment */
 
   /* If the input stream is connected to a terminal, turn on
      editing.  */
@@ -1106,6 +1107,7 @@ gdb_disable_readline (void)
   ui_file_delete (gdb_stderr);
   gdb_stdlog = NULL;
   gdb_stdtarg = NULL;
+  gdb_stdtargerr = NULL;
 #endif
 
   rl_callback_handler_remove ();
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -149,6 +149,12 @@ gdb_test_multiple "python print \"\\n\" * $lines" $test {
 }
 gdb_test "q" "Quit" "verify pagination afterwards: q"
 
+gdb_test_no_output "set height 0"
+
+gdb_test_no_output "python a = gdb.execute('help', to_string=True)" "collect help from uiout"
+
+gdb_test "python print a" ".*aliases -- Aliases of other commands.*" "verify help to uiout"
+
 # Start with a fresh gdb.
 clean_restart ${testfile}
 
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -475,12 +475,23 @@ execute_command_to_string (char *p, int from_tty)
 
   str_file = mem_fileopen ();
 
+  make_cleanup_ui_file_delete (str_file);
   make_cleanup_restore_ui_file (&gdb_stdout);
   make_cleanup_restore_ui_file (&gdb_stderr);
-  make_cleanup_ui_file_delete (str_file);
+  make_cleanup_restore_ui_file (&gdb_stdlog);
+  make_cleanup_restore_ui_file (&gdb_stdtarg);
+  make_cleanup_restore_ui_file (&gdb_stdtargerr);
+
+  if (ui_out_redirect (uiout, str_file) < 0)
+    warning (_("Current output protocol does not support redirection"));
+  else
+    make_cleanup_ui_out_redirect_pop (uiout);
 
   gdb_stdout = str_file;
   gdb_stderr = str_file;
+  gdb_stdlog = str_file;
+  gdb_stdtarg = str_file;
+  gdb_stdtargerr = str_file;
 
   execute_command (p, from_tty);
 
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -545,6 +545,7 @@ tui_setup_io (int mode)
       gdb_stderr = tui_stderr;
       gdb_stdlog = gdb_stdout;	/* for moment */
       gdb_stdtarg = gdb_stderr;	/* for moment */
+      gdb_stdtargerr = gdb_stderr;	/* for moment */
       uiout = tui_out;
 
       /* Save tty for SIGCONT.  */
@@ -557,6 +558,7 @@ tui_setup_io (int mode)
       gdb_stderr = tui_old_stderr;
       gdb_stdlog = gdb_stdout;	/* for moment */
       gdb_stdtarg = gdb_stderr;	/* for moment */
+      gdb_stdtargerr = gdb_stderr;	/* for moment */
       uiout = tui_old_uiout;
 
       /* Restore readline.  */
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -312,6 +312,21 @@ make_cleanup_ui_file_delete (struct ui_file *arg)
 }
 
 static void
+do_ui_out_redirect_pop (void *arg)
+{
+  struct ui_out *uiout = arg;
+
+  if (ui_out_redirect (uiout, NULL) < 0)
+    warning (_("Cannot restore redirection of the current output protocol"));
+}
+
+struct cleanup *
+make_cleanup_ui_out_redirect_pop (struct ui_out *uiout)
+{
+  return make_my_cleanup (&cleanup_chain, do_ui_out_redirect_pop, uiout);
+}
+
+static void
 do_free_section_addr_info (void *arg)
 {
   free_section_addr_info (arg);

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] Fix uiout for execute_command_to_string
  2010-09-10 13:02   ` Jan Kratochvil
@ 2010-09-10 22:05     ` Tom Tromey
  2010-09-11 18:34       ` Jan Kratochvil
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2010-09-10 22:05 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: Paul Bolle, gdb-patches

>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Jan> Updated the patch with this part.  Paul Bolle said he does not have
Jan> a signed FSF copyright assignment; if it matters in this case.

It doesn't, that patch is short enough.

Jan> 2010-09-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
Jan> 	    Paul Bolle  <pebolle@tiscali.nl>

One nit.

Jan> +struct cleanup *
Jan> +make_cleanup_ui_out_redirect_pop (struct ui_out *uiout)
Jan> +{
Jan> +  return make_my_cleanup (&cleanup_chain, do_ui_out_redirect_pop, uiout);
Jan> +}

The two new functions need header comments.
Ok with that change.

Tom

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] Fix uiout for execute_command_to_string
  2010-09-10 22:05     ` Tom Tromey
@ 2010-09-11 18:34       ` Jan Kratochvil
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Kratochvil @ 2010-09-11 18:34 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Paul Bolle, gdb-patches

On Fri, 10 Sep 2010 22:27:27 +0200, Tom Tromey wrote:
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> Jan> +struct cleanup *
> Jan> +make_cleanup_ui_out_redirect_pop (struct ui_out *uiout)
> Jan> +{
> Jan> +  return make_my_cleanup (&cleanup_chain, do_ui_out_redirect_pop, uiout);
> Jan> +}
> 
> The two new functions need header comments.

Done.

> Ok with that change.

Checked-in.


Thanks,
Jan


http://sourceware.org/ml/gdb-cvs/2010-09/msg00080.html

--- src/gdb/ChangeLog	2010/09/10 16:17:11	1.12170
+++ src/gdb/ChangeLog	2010/09/11 16:00:20	1.12171
@@ -1,3 +1,21 @@
+2010-09-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
+	    Paul Bolle  <pebolle@tiscali.nl>
+
+	Redirect also uiout and stdtarg{,err} in execute_command_to_string.
+	* cli-logging.c (struct saved_output_files) <targerr>: New.
+	(set_logging_redirect, pop_output_files, handle_redirections):
+	Redirect also gdb_stdtargerr.
+	* defs.h (struct ui_out, make_cleanup_ui_out_redirect_pop): New
+	declarations.
+	* event-top.c (gdb_setup_readline, gdb_disable_readline): Redirect
+	also gdb_stdtargerr.
+	* top.c (execute_command_to_string): Move make_cleanup_ui_file_delete
+	to the top.  Redirect also gdb_stdlog, gdb_stdtarg and gdb_stdtargerr.
+	Use ui_out_redirect, register make_cleanup_ui_out_redirect_pop.
+	* tui/tui-io.c (tui_setup_io): Redirect also gdb_stdtargerr.
+	* utils.c (do_ui_out_redirect_pop, make_cleanup_ui_out_redirect_pop):
+	New functions.
+
 2010-09-10  Pierre Muller  <muller@ics.u-strasbg.fr>
 
 	* hppa-tdep.c (unwind_command): Use host_address_to_string function
--- src/gdb/testsuite/ChangeLog	2010/09/10 20:29:25	1.2444
+++ src/gdb/testsuite/ChangeLog	2010/09/11 16:00:26	1.2445
@@ -1,3 +1,8 @@
+2010-09-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.python/python.exp (set height 0, collect help from uiout)
+	(verify help to uiout): New tests.
+
 2010-09-10  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>
 
 	* gdb.base/break-interp.exp (test_ld) <istarget powerpc64-*>: Add
--- src/gdb/defs.h	2010/08/31 18:08:43	1.278
+++ src/gdb/defs.h	2010/09/11 16:00:25	1.279
@@ -337,6 +337,10 @@
 struct ui_file;
 extern struct cleanup *make_cleanup_ui_file_delete (struct ui_file *);
 
+struct ui_out;
+extern struct cleanup *
+  make_cleanup_ui_out_redirect_pop (struct ui_out *uiout);
+
 struct section_addr_info;
 extern struct cleanup *(make_cleanup_free_section_addr_info 
                         (struct section_addr_info *));
--- src/gdb/event-top.c	2010/06/26 06:44:47	1.72
+++ src/gdb/event-top.c	2010/09/11 16:00:25	1.73
@@ -1048,6 +1048,7 @@
   gdb_stderr = stdio_fileopen (stderr);
   gdb_stdlog = gdb_stderr;  /* for moment */
   gdb_stdtarg = gdb_stderr; /* for moment */
+  gdb_stdtargerr = gdb_stderr; /* for moment */
 
   /* If the input stream is connected to a terminal, turn on
      editing.  */
@@ -1106,6 +1107,7 @@
   ui_file_delete (gdb_stderr);
   gdb_stdlog = NULL;
   gdb_stdtarg = NULL;
+  gdb_stdtargerr = NULL;
 #endif
 
   rl_callback_handler_remove ();
--- src/gdb/top.c	2010/08/07 15:00:37	1.183
+++ src/gdb/top.c	2010/09/11 16:00:25	1.184
@@ -475,12 +475,23 @@
 
   str_file = mem_fileopen ();
 
+  make_cleanup_ui_file_delete (str_file);
   make_cleanup_restore_ui_file (&gdb_stdout);
   make_cleanup_restore_ui_file (&gdb_stderr);
-  make_cleanup_ui_file_delete (str_file);
+  make_cleanup_restore_ui_file (&gdb_stdlog);
+  make_cleanup_restore_ui_file (&gdb_stdtarg);
+  make_cleanup_restore_ui_file (&gdb_stdtargerr);
+
+  if (ui_out_redirect (uiout, str_file) < 0)
+    warning (_("Current output protocol does not support redirection"));
+  else
+    make_cleanup_ui_out_redirect_pop (uiout);
 
   gdb_stdout = str_file;
   gdb_stderr = str_file;
+  gdb_stdlog = str_file;
+  gdb_stdtarg = str_file;
+  gdb_stdtargerr = str_file;
 
   execute_command (p, from_tty);
 
--- src/gdb/utils.c	2010/08/07 15:00:37	1.239
+++ src/gdb/utils.c	2010/09/11 16:00:25	1.240
@@ -311,6 +311,26 @@
   return make_my_cleanup (&cleanup_chain, do_ui_file_delete, arg);
 }
 
+/* Helper function for make_cleanup_ui_out_redirect_pop.  */
+
+static void
+do_ui_out_redirect_pop (void *arg)
+{
+  struct ui_out *uiout = arg;
+
+  if (ui_out_redirect (uiout, NULL) < 0)
+    warning (_("Cannot restore redirection of the current output protocol"));
+}
+
+/* Return a new cleanup that pops the last redirection by ui_out_redirect
+   with NULL parameter.  */
+
+struct cleanup *
+make_cleanup_ui_out_redirect_pop (struct ui_out *uiout)
+{
+  return make_my_cleanup (&cleanup_chain, do_ui_out_redirect_pop, uiout);
+}
+
 static void
 do_free_section_addr_info (void *arg)
 {
--- src/gdb/cli/cli-logging.c	2010/09/03 15:42:03	1.25
+++ src/gdb/cli/cli-logging.c	2010/09/11 16:00:26	1.26
@@ -33,6 +33,7 @@
   struct ui_file *err;
   struct ui_file *log;
   struct ui_file *targ;
+  struct ui_file *targerr;
 };
 static struct saved_output_files saved_output;
 static char *saved_filename;
@@ -116,6 +117,7 @@
   gdb_stderr = output;
   gdb_stdlog = output;
   gdb_stdtarg = output;
+  gdb_stdtargerr = output;
   logging_no_redirect_file = new_logging_no_redirect_file;
 
   /* There is a former output pushed on the ui_out_redirect stack.  We want to
@@ -154,10 +156,12 @@
   gdb_stderr = saved_output.err;
   gdb_stdlog = saved_output.log;
   gdb_stdtarg = saved_output.targ;
+  gdb_stdtargerr = saved_output.targ;
   saved_output.out = NULL;
   saved_output.err = NULL;
   saved_output.log = NULL;
   saved_output.targ = NULL;
+  saved_output.targerr = NULL;
 
   ui_out_redirect (uiout, NULL);
 }
@@ -211,11 +215,13 @@
   saved_output.err = gdb_stderr;
   saved_output.log = gdb_stdlog;
   saved_output.targ = gdb_stdtarg;
+  saved_output.targerr = gdb_stdtargerr;
 
   gdb_stdout = output;
   gdb_stderr = output;
   gdb_stdlog = output;
   gdb_stdtarg = output;
+  gdb_stdtargerr = output;
 
   if (ui_out_redirect (uiout, output) < 0)
     warning (_("Current output protocol does not support redirection"));
--- src/gdb/testsuite/gdb.python/python.exp	2010/08/19 17:00:58	1.14
+++ src/gdb/testsuite/gdb.python/python.exp	2010/09/11 16:00:27	1.15
@@ -149,6 +149,12 @@
 }
 gdb_test "q" "Quit" "verify pagination afterwards: q"
 
+gdb_test_no_output "set height 0"
+
+gdb_test_no_output "python a = gdb.execute('help', to_string=True)" "collect help from uiout"
+
+gdb_test "python print a" ".*aliases -- Aliases of other commands.*" "verify help to uiout"
+
 # Start with a fresh gdb.
 clean_restart ${testfile}
 
--- src/gdb/tui/tui-io.c	2010/07/28 11:56:30	1.24
+++ src/gdb/tui/tui-io.c	2010/09/11 16:00:27	1.25
@@ -545,6 +545,7 @@
       gdb_stderr = tui_stderr;
       gdb_stdlog = gdb_stdout;	/* for moment */
       gdb_stdtarg = gdb_stderr;	/* for moment */
+      gdb_stdtargerr = gdb_stderr;	/* for moment */
       uiout = tui_out;
 
       /* Save tty for SIGCONT.  */
@@ -557,6 +558,7 @@
       gdb_stderr = tui_old_stderr;
       gdb_stdlog = gdb_stdout;	/* for moment */
       gdb_stdtarg = gdb_stderr;	/* for moment */
+      gdb_stdtargerr = gdb_stderr;	/* for moment */
       uiout = tui_old_uiout;
 
       /* Restore readline.  */

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-09-11 16:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-03 20:03 [patch] Fix uiout for execute_command_to_string Jan Kratochvil
2010-09-04 15:36 ` Paul Bolle
2010-09-10 13:02   ` Jan Kratochvil
2010-09-10 22:05     ` Tom Tromey
2010-09-11 18:34       ` Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).