From 1a088d065a1177313c8304095f49b74662eddd04 Mon Sep 17 00:00:00 2001 From: Andrew Stubbs Date: Tue, 1 Nov 2005 11:09:18 +0000 Subject: [PATCH] 2005-11-01 Andrew Stubbs * event-top.c (gdb_setup_readline): Don't set gdb_stdout when --batch-silent option was given. * main.c (batch_silent): New variable. (captured_main): Add new option --batch-silent. (print_gdb_help): Likewise. doc/ * gdb.texinfo (Choosing modes): Add --batch-silent. --- gdb/ChangeLog | 8 ++++++++ gdb/doc/ChangeLog | 4 ++++ gdb/doc/gdb.texinfo | 13 +++++++++++++ gdb/event-top.c | 4 +++- gdb/main.c | 9 +++++++++ 5 files changed, 37 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1a63e2d893..463414ec35 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2005-11-01 Andrew Stubbs + + * event-top.c (gdb_setup_readline): Don't set gdb_stdout when + --batch-silent option was given. + * main.c (batch_silent): New variable. + (captured_main): Add new option --batch-silent. + (print_gdb_help): Likewise. + 2005-11-01 Mark Kettenis * NEWS: Mention VAX floating point support. diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index ef6248807e..f62c31230c 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,7 @@ +2005-11-01 Andrew Stubbs + + * gdb.texinfo (Choosing modes): Add --batch-silent. + 2005-10-28 Eli Zaretskii * gdb.texinfo (GDB/MI Variable Objects): Fix @pxref usage under diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 0ceb3aa5b3..75ae4ef7f0 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -994,6 +994,19 @@ Program exited normally. @value{GDBN} control terminates) is not issued when running in batch mode. +@item -batch-silent +@cindex @code{--batch-silent} +Run in batch mode exactly like @samp{-batch}, but totally silently. All +@value{GDBN} output to @code{stdout} is prevented (@code{stderr} is +unaffected). This is much quieter than @samp{-silent} and would be useless +for an interactive session. + +This is particularly useful when using targets that give @samp{Loading section} +messages, for example. + +Note that targets that give their output via @value{GDBN}, as opposed to +writing directly to @code{stdout}, will also be made silent. + @item -nowindows @itemx -nw @cindex @code{--nowindows} diff --git a/gdb/event-top.c b/gdb/event-top.c index 4614d4d2f4..bc1fe8ea38 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -1110,8 +1110,10 @@ gdb_setup_readline (void) that the sync setup is ALL done in gdb_init, and we would only mess it up here. The sync stuff should really go away over time. */ + extern batch_silent; - gdb_stdout = stdio_fileopen (stdout); + if (!batch_silent) + gdb_stdout = stdio_fileopen (stdout); gdb_stderr = stdio_fileopen (stderr); gdb_stdlog = gdb_stderr; /* for moment */ gdb_stdtarg = gdb_stderr; /* for moment */ diff --git a/gdb/main.c b/gdb/main.c index f73af20795..5e912953da 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -73,6 +73,9 @@ struct ui_file *gdb_stdtargin; struct ui_file *gdb_stdtarg; struct ui_file *gdb_stdtargerr; +/* Support for the --batch-silent option. */ +int batch_silent = 0; + /* Whether to enable writing into executable and core files */ extern int write_files; @@ -254,6 +257,7 @@ captured_main (void *data) {"silent", no_argument, &quiet, 1}, {"nx", no_argument, &inhibit_gdbinit, 1}, {"n", no_argument, &inhibit_gdbinit, 1}, + {"batch-silent", no_argument, 0, 'B'}, {"batch", no_argument, &batch, 1}, {"epoch", no_argument, &epoch_interface, 1}, @@ -379,6 +383,10 @@ captured_main (void *data) cmdsize * sizeof (*cmdarg)); } break; + case 'B': + batch = batch_silent = 1; + gdb_stdout = ui_file_new(); + break; #ifdef GDBTK case 'z': { @@ -829,6 +837,7 @@ Options:\n\n\ fputs_unfiltered (_("\ -b BAUDRATE Set serial port baud rate used for remote debugging.\n\ --batch Exit after processing options.\n\ + --batch-silent As for --batch, but suppress all gdb stdout output.\n\ --cd=DIR Change current directory to DIR.\n\ --command=FILE Execute GDB commands from FILE.\n\ --core=COREFILE Analyze the core dump COREFILE.\n\ -- 2.34.1