Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2564)

Unified Diff: gdb/cli/cli-logging.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/cli/cli-interp.c ('k') | gdb/cli/cli-script.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/cli/cli-logging.c
diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c
index 0c5bda8797563cdb787df11e3e1f6856c91f49ca..6ff064ad6f3d1ff12ed005ea483e9359eaa0022a 100644
--- a/gdb/cli/cli-logging.c
+++ b/gdb/cli/cli-logging.c
@@ -20,6 +20,7 @@
#include "defs.h"
#include "gdbcmd.h"
#include "ui-out.h"
+#include "interps.h"
#include "gdb_assert.h"
#include "gdb_string.h"
@@ -115,11 +116,17 @@ set_logging_redirect (char *args, int from_tty, struct cmd_list_element *c)
logging_filename);
}
- gdb_stdout = output;
- gdb_stderr = output;
- gdb_stdlog = output;
- gdb_stdtarg = output;
- gdb_stdtargerr = output;
+ /* Give the current interpreter a chance to do anything special that
+ it might need for logging, such as updating other channels. */
+ if (current_interp_set_logging (1, output, NULL) == 0)
+ {
+ gdb_stdout = output;
+ gdb_stdlog = output;
+ gdb_stderr = 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
@@ -147,19 +154,25 @@ show_logging_redirect (struct ui_file *file, int from_tty,
static void
pop_output_files (void)
{
- /* Only delete one of the files -- they are all set to the same
- value. */
- ui_file_delete (gdb_stdout);
if (logging_no_redirect_file)
{
ui_file_delete (logging_no_redirect_file);
logging_no_redirect_file = NULL;
}
- gdb_stdout = saved_output.out;
- gdb_stderr = saved_output.err;
- gdb_stdlog = saved_output.log;
- gdb_stdtarg = saved_output.targ;
- gdb_stdtargerr = saved_output.targ;
+
+ if (current_interp_set_logging (0, NULL, NULL) == 0)
+ {
+ /* Only delete one of the files -- they are all set to the same
+ value. */
+ ui_file_delete (gdb_stdout);
+
+ gdb_stdout = saved_output.out;
+ 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;
@@ -175,6 +188,7 @@ handle_redirections (int from_tty)
{
struct cleanup *cleanups;
struct ui_file *output;
+ struct ui_file *no_redirect_file = NULL;
if (saved_filename != NULL)
{
@@ -191,7 +205,7 @@ handle_redirections (int from_tty)
/* Redirects everything to gdb_stdout while this is running. */
if (!logging_redirect)
{
- struct ui_file *no_redirect_file = output;
+ no_redirect_file = output;
output = tee_file_new (gdb_stdout, 0, no_redirect_file, 0);
if (output == NULL)
@@ -220,14 +234,22 @@ handle_redirections (int from_tty)
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;
+ /* Let the interpreter do anything it needs. */
+ if (current_interp_set_logging (1, output, no_redirect_file) == 0)
+ {
+ gdb_stdout = output;
+ gdb_stdlog = output;
+ gdb_stderr = output;
+ gdb_stdtarg = output;
+ gdb_stdtargerr = output;
+ }
- if (ui_out_redirect (current_uiout, output) < 0)
- warning (_("Current output protocol does not support redirection"));
+ /* Don't do the redirect for MI, it confuses MI's ui-out scheme. */
+ if (!ui_out_is_mi_like_p (current_uiout))
+ {
+ if (ui_out_redirect (current_uiout, output) < 0)
+ warning (_("Current output protocol does not support redirection"));
+ }
}
static void
« no previous file with comments | « gdb/cli/cli-interp.c ('k') | gdb/cli/cli-script.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698