This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] --batch-silent option


Here are the patches I just committed to add the --batch-silent option.

Andrew Stubbs
2005-11-01  Andrew Stubbs  <andrew.stubbs@st.com>

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


Index: src/gdb/event-top.c
===================================================================
--- src.orig/gdb/event-top.c	2005-03-16 17:05:31.000000000 +0000
+++ src/gdb/event-top.c	2005-10-17 17:38:27.000000000 +0100
@@ -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 */
Index: src/gdb/main.c
===================================================================
--- src.orig/gdb/main.c	2005-10-17 15:29:40.000000000 +0100
+++ src/gdb/main.c	2005-10-17 17:44:35.000000000 +0100
@@ -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},
 
@@ -384,6 +388,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':
 	    {
@@ -834,6 +842,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\
2005-11-01  Andrew Stubbs  <andrew.stubbs@st.com>

	* gdb.texinfo (Choosing modes): Add --batch-silent.

Index: src/gdb/doc/gdb.texinfo
===================================================================
--- src.orig/gdb/doc/gdb.texinfo	2005-10-28 18:31:04.000000000 +0100
+++ src/gdb/doc/gdb.texinfo	2005-10-31 12:18:35.000000000 +0000
@@ -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}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]