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

Adrian Sendroiu
2014-07-23T14:26:39Z

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

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. */
--
1.7.9.5