[1/2] cli/cli-logging.c: don't call ui_out_redirect for MI when disabling logging

Message ID 1406125575-28311-2-git-send-email-adrian.sendroiu@freescale.com
State New, archived
Headers

Commit Message

Adrian Sendroiu July 23, 2014, 2:26 p.m. UTC
  When logging is set up, the code skips the call to ui_out_redirect if the
current interpreter is MI, but still calls it unconditionally when logging
is turned off. Since the number of "redirect"/"unredirect" calls must match,
this patch ensures that the ui_out_redirect call is also skipped when logging
is turned off.

gdb/
2014-07-23  Adrian Sendroiu  <adrian.sendroiu@freescale.com>

	* cli/cli-logging.c (pop_output_files): Don't call ui_out_redirect
	if the current interpreter is MI.
---
 gdb/cli/cli-logging.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Tom Tromey July 24, 2014, 6:03 p.m. UTC | #1
>>>>> "Adrian" == Adrian Sendroiu <adrian.sendroiu@freescale.com> writes:

Adrian> 2014-07-23  Adrian Sendroiu  <adrian.sendroiu@freescale.com>

Adrian> 	* cli/cli-logging.c (pop_output_files): Don't call ui_out_redirect
Adrian> 	if the current interpreter is MI.

Thanks, this is ok.

Tom
  

Patch

diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c
index aae0039..e51bb95 100644
--- a/gdb/cli/cli-logging.c
+++ b/gdb/cli/cli-logging.c
@@ -180,7 +180,8 @@  pop_output_files (void)
   saved_output.targ = NULL;
   saved_output.targerr = NULL;
 
-  ui_out_redirect (current_uiout, NULL);
+  if (!ui_out_is_mi_like_p (current_uiout))
+    ui_out_redirect (current_uiout, NULL);
 }
 
 /* This is a helper for the `set logging' command.  */