gdb
authorTom Tromey <tromey@redhat.com>
Mon, 8 Mar 2010 19:20:38 +0000 (19:20 +0000)
committerTom Tromey <tromey@redhat.com>
Mon, 8 Mar 2010 19:20:38 +0000 (19:20 +0000)
PR cli/9591:
* NEWS: Update.
* utils.c: Include main.h.
(fputs_maybe_filtered): Don't paginate if `batch_flag'.
(defaulted_query): Use default answer if `batch_flag'.
* main.h (batch_flag): Declare.
* main.c (batch_flag): New global.
(captured_main): Remove 'batch'.  Update.
gdb/doc
PR cli/9591:
* gdb.texinfo (Mode Options): Mention lack of pagination and
confirmation with --batch.
(Screen Size): Mention --batch.
(Messages/Warnings): Likewise.

gdb/ChangeLog
gdb/NEWS
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo
gdb/main.c
gdb/main.h
gdb/utils.c

index 16837318288d5fa506ddb9baedbb9da3b4d63248..4fed3ff5d03f577232fc645786da571570cdc035 100644 (file)
@@ -1,3 +1,14 @@
+2010-03-08  Tom Tromey  <tromey@redhat.com>
+
+       PR cli/9591:
+       * NEWS: Update.
+       * utils.c: Include main.h.
+       (fputs_maybe_filtered): Don't paginate if `batch_flag'.
+       (defaulted_query): Use default answer if `batch_flag'.
+       * main.h (batch_flag): Declare.
+       * main.c (batch_flag): New global.
+       (captured_main): Remove 'batch'.  Update.
+
 2010-03-08  Kevin Buettner  <kevinb@redhat.com>
 
        From Richard Sandiford, Martin M. Hunt, Corinna Vinschen,
index 7e33caa17d9d9474ad89c8b120a92adb6bdb3248..64c48f63789705c52ed7242bcb4bf0fd3a654d88 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -3,6 +3,8 @@
 
 *** Changes since GDB 7.1
 
+* The --batch flag now disables pagination and queries.
+
 * X86 general purpose registers
 
   GDB now supports reading/writing byte, word and double-word x86
index bbd7895fb764fdae85f066d9e8e162fb2faa6b96..285ec9d220de8f65955b066ccd8560eca997be57 100644 (file)
@@ -1,3 +1,11 @@
+2010-03-08  Tom Tromey  <tromey@redhat.com>
+
+       PR cli/9591:
+       * gdb.texinfo (Mode Options): Mention lack of pagination and
+       confirmation with --batch.
+       (Screen Size): Mention --batch.
+       (Messages/Warnings): Likewise.
+
 2010-03-05  Tom Tromey  <tromey@redhat.com>
 
        * gdb.texinfo (Basic Python): Document target_charset and
index 41b11b63ec78f2e4086a20eebbf109f05ef3e8d9..a1f3a7836b45effa328ca30aee64c4aa20d71bae 100644 (file)
@@ -1028,7 +1028,9 @@ Run in batch mode.  Exit with status @code{0} after processing all the
 command files specified with @samp{-x} (and all commands from
 initialization files, if not inhibited with @samp{-n}).  Exit with
 nonzero status if an error occurs in executing the @value{GDBN} commands
-in the command files.
+in the command files.  Batch mode also disables pagination;
+@pxref{Screen Size} and acts as if @kbd{set confirm off} were in
+effect (@pxref{Messages/Warnings}).
 
 Batch mode may be useful for running @value{GDBN} as a filter, for
 example to download and run a program on another computer; in order to
@@ -18494,7 +18496,9 @@ from wrapping its output.
 @itemx set pagination off
 @kindex set pagination
 Turn the output pagination on or off; the default is on.  Turning
-pagination off is the alternative to @code{set height 0}.
+pagination off is the alternative to @code{set height 0}.  Note that
+running @value{GDBN} with the @option{--batch} option (@pxref{Mode
+Options, -batch}) also automatically disables pagination.
 
 @item show pagination
 @kindex show pagination
@@ -18717,7 +18721,9 @@ commands, you can disable this ``feature'':
 @cindex confirmation
 @cindex stupid questions
 @item set confirm off
-Disables confirmation requests.
+Disables confirmation requests.  Note that running @value{GDBN} with
+the @option{--batch} option (@pxref{Mode Options, -batch}) also
+automatically disables confirmation requests.
 
 @item set confirm on
 Enables confirmation requests (the default).
index e2613488273b21fb9581c07c43ce944db7c3a5e0..170a5b412d12192d126fa3252fcf32cc3fa0953b 100644 (file)
@@ -76,6 +76,9 @@ struct ui_file *gdb_stdtargin;
 struct ui_file *gdb_stdtarg;
 struct ui_file *gdb_stdtargerr;
 
+/* True if --batch or --batch-silent was seen.  */
+int batch_flag = 0;
+
 /* Support for the --batch-silent option.  */
 int batch_silent = 0;
 
@@ -247,7 +250,6 @@ captured_main (void *data)
   int argc = context->argc;
   char **argv = context->argv;
   static int quiet = 0;
-  static int batch = 0;
   static int set_args = 0;
 
   /* Pointers to various arguments from command line.  */
@@ -386,7 +388,7 @@ captured_main (void *data)
       {"nx", no_argument, &inhibit_gdbinit, 1},
       {"n", no_argument, &inhibit_gdbinit, 1},
       {"batch-silent", no_argument, 0, 'B'},
-      {"batch", no_argument, &batch, 1},
+      {"batch", no_argument, &batch_flag, 1},
       {"epoch", no_argument, &epoch_interface, 1},
 
     /* This is a synonym for "--annotate=1".  --annotate is now preferred,
@@ -537,7 +539,7 @@ captured_main (void *data)
              }
            break;
          case 'B':
-           batch = batch_silent = 1;
+           batch_flag = batch_silent = 1;
            gdb_stdout = ui_file_new();
            break;
 #ifdef GDBTK
@@ -631,7 +633,7 @@ extern int gdbtk_test (char *);
        use_windows = 0;
       }
 
-    if (batch)
+    if (batch_flag)
       quiet = 1;
   }
 
@@ -803,15 +805,15 @@ Excess command line arguments ignored. (%s%s)\n"),
       /* The exec file and the symbol-file are the same.  If we can't
          open it, better only print one error message.
          catch_command_errors returns non-zero on success! */
-      if (catch_command_errors (exec_file_attach, execarg, !batch, RETURN_MASK_ALL))
-       catch_command_errors (symbol_file_add_main, symarg, !batch, RETURN_MASK_ALL);
+      if (catch_command_errors (exec_file_attach, execarg, !batch_flag, RETURN_MASK_ALL))
+       catch_command_errors (symbol_file_add_main, symarg, !batch_flag, RETURN_MASK_ALL);
     }
   else
     {
       if (execarg != NULL)
-       catch_command_errors (exec_file_attach, execarg, !batch, RETURN_MASK_ALL);
+       catch_command_errors (exec_file_attach, execarg, !batch_flag, RETURN_MASK_ALL);
       if (symarg != NULL)
-       catch_command_errors (symbol_file_add_main, symarg, !batch, RETURN_MASK_ALL);
+       catch_command_errors (symbol_file_add_main, symarg, !batch_flag, RETURN_MASK_ALL);
     }
 
   if (corearg && pidarg)
@@ -820,10 +822,10 @@ Can't attach to process and specify a core file at the same time."));
 
   if (corearg != NULL)
     catch_command_errors (core_file_command, corearg,
-                         !batch, RETURN_MASK_ALL);
+                         !batch_flag, RETURN_MASK_ALL);
   else if (pidarg != NULL)
     catch_command_errors (attach_command, pidarg,
-                         !batch, RETURN_MASK_ALL);
+                         !batch_flag, RETURN_MASK_ALL);
   else if (pid_or_core_arg)
     {
       /* The user specified 'gdb program pid' or gdb program core'.
@@ -833,13 +835,13 @@ Can't attach to process and specify a core file at the same time."));
       if (isdigit (pid_or_core_arg[0]))
        {
          if (catch_command_errors (attach_command, pid_or_core_arg,
-                                   !batch, RETURN_MASK_ALL) == 0)
+                                   !batch_flag, RETURN_MASK_ALL) == 0)
            catch_command_errors (core_file_command, pid_or_core_arg,
-                                 !batch, RETURN_MASK_ALL);
+                                 !batch_flag, RETURN_MASK_ALL);
        }
       else /* Can't be a pid, better be a corefile.  */
        catch_command_errors (core_file_command, pid_or_core_arg,
-                             !batch, RETURN_MASK_ALL);
+                             !batch_flag, RETURN_MASK_ALL);
     }
 
   if (ttyarg != NULL)
@@ -859,17 +861,17 @@ Can't attach to process and specify a core file at the same time."));
     {
       if (cmdarg[i].type == CMDARG_FILE)
         catch_command_errors (source_script, cmdarg[i].string,
-                             !batch, RETURN_MASK_ALL);
+                             !batch_flag, RETURN_MASK_ALL);
       else  /* cmdarg[i].type == CMDARG_COMMAND */
         catch_command_errors (execute_command, cmdarg[i].string,
-                             !batch, RETURN_MASK_ALL);
+                             !batch_flag, RETURN_MASK_ALL);
     }
   xfree (cmdarg);
 
   /* Read in the old history after all the command files have been read. */
   init_history ();
 
-  if (batch)
+  if (batch_flag)
     {
       /* We have hit the end of the batch file.  */
       quit_force (NULL, 0);
index 5e457249a8fc2ba4ab0dc5bc8d5c09996a1c9316..4b27c1a325f465343551d219b00f34c7561ee34b 100644 (file)
@@ -34,5 +34,6 @@ extern int gdb_main (struct captured_main_args *);
 extern int return_child_result;
 extern int return_child_result_value;
 extern int batch_silent;
+extern int batch_flag;
 
 #endif
index 8054f0355e0660225db5e49109880c5aebe4af96..e225a3f14f500a2be962936c97d6be60048f25e4 100644 (file)
@@ -58,6 +58,7 @@
 #include "gdb_obstack.h"
 #include "gdbcore.h"
 #include "top.h"
+#include "main.h"
 
 #include "inferior.h"          /* for signed_pointer_to_address */
 
@@ -1496,7 +1497,7 @@ defaulted_query (const char *ctlstr, const char defchar, va_list args)
      question we're asking, and then answer the default automatically.  This
      way, important error messages don't get lost when talking to GDB
      over a pipe.  */
-  if (! input_from_terminal_p ())
+  if (batch_flag || ! input_from_terminal_p ())
     {
       wrap_here ("");
       vfprintf_filtered (gdb_stdout, ctlstr, args);
This page took 0.069307 seconds and 4 git commands to generate.