* RFA: fix CLI/9591 (pagination and --batch) @ 2010-03-05 19:58 Tom Tromey 2010-03-05 20:51 ` Pedro Alves 0 siblings, 1 reply; 11+ messages in thread From: Tom Tromey @ 2010-03-05 19:58 UTC (permalink / raw) To: gdb-patches This needs a doc review. This patch disables pagination when --batch is given. As discussed on this list earlier, the current situation is strange; pagination only really makes sense interactively. Built and regtested on x86-64 (compile farm). Tom 2010-03-05 Tom Tromey <tromey@redhat.com> PR cli/9591: * utils.c: Include main.h. (fputs_maybe_filtered): Don't pagination if `batch'. * main.h (batch): Declare. * main.c (batch): New global. (captured_main): Remove 'batch'. 2010-03-05 Tom Tromey <tromey@redhat.com> PR cli/9591: * gdb.texinfo (Mode Options): Mention lack of pagination with --batch. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 6bb7d52..69765fd 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -1028,7 +1028,8 @@ 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}. 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 diff --git a/gdb/main.c b/gdb/main.c index e261348..e9f852e 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -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 = 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. */ diff --git a/gdb/main.h b/gdb/main.h index 5e45724..d94903c 100644 --- a/gdb/main.h +++ b/gdb/main.h @@ -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; #endif diff --git a/gdb/utils.c b/gdb/utils.c index 52596ca..deab50d 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -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 */ @@ -2209,7 +2210,7 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream, return; /* Don't do any filtering if it is disabled. */ - if ((stream != gdb_stdout) || !pagination_enabled + if ((stream != gdb_stdout) || !pagination_enabled || batch || (lines_per_page == UINT_MAX && chars_per_line == UINT_MAX)) { fputs_unfiltered (linebuffer, stream); ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: RFA: fix CLI/9591 (pagination and --batch) 2010-03-05 19:58 RFA: fix CLI/9591 (pagination and --batch) Tom Tromey @ 2010-03-05 20:51 ` Pedro Alves 2010-03-05 22:24 ` Tom Tromey 0 siblings, 1 reply; 11+ messages in thread From: Pedro Alves @ 2010-03-05 20:51 UTC (permalink / raw) To: gdb-patches, tromey On Friday 05 March 2010 19:57:51, Tom Tromey wrote: > This needs a doc review. > > This patch disables pagination when --batch is given. As discussed on > this list earlier, the current situation is strange; pagination only > really makes sense interactively. Should queries be left enabled as well? Here's one example, but all queries wait for input: >./gdb --batch -ex "b main" -ex "run" -ex "q" --args ./gdb ./gdb [Thread debugging using libthread_db enabled] Breakpoint 3, main (argc= During symbol reading, incomplete CFI data; unspecified registers (e.g., rax) at 0x456698. 2, argv=0x7fffffffe148) at ../../src/gdb/gdb.c:28 28 memset (&args, 0, sizeof args); A debugging session is active. Inferior 1 [process 2415] will be killed. Quit anyway? (y or n) <waits for input> IMO, pagination is a kind of query. > > Built and regtested on x86-64 (compile farm). > > Tom > > 2010-03-05 Tom Tromey <tromey@redhat.com> > > PR cli/9591: > * utils.c: Include main.h. > (fputs_maybe_filtered): Don't pagination if `batch'. > * main.h (batch): Declare. > * main.c (batch): New global. > (captured_main): Remove 'batch'. > > 2010-03-05 Tom Tromey <tromey@redhat.com> > > PR cli/9591: > * gdb.texinfo (Mode Options): Mention lack of pagination with > --batch. > > diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo > index 6bb7d52..69765fd 100644 > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -1028,7 +1028,8 @@ 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}. > > 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 > diff --git a/gdb/main.c b/gdb/main.c > index e261348..e9f852e 100644 > --- a/gdb/main.c > +++ b/gdb/main.c > @@ -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 = 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. */ > diff --git a/gdb/main.h b/gdb/main.h > index 5e45724..d94903c 100644 > --- a/gdb/main.h > +++ b/gdb/main.h > @@ -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; > > #endif > diff --git a/gdb/utils.c b/gdb/utils.c > index 52596ca..deab50d 100644 > --- a/gdb/utils.c > +++ b/gdb/utils.c > @@ -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 */ > > @@ -2209,7 +2210,7 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream, > return; > > /* Don't do any filtering if it is disabled. */ > - if ((stream != gdb_stdout) || !pagination_enabled > + if ((stream != gdb_stdout) || !pagination_enabled || batch > || (lines_per_page == UINT_MAX && chars_per_line == UINT_MAX)) > { > fputs_unfiltered (linebuffer, stream); > -- Pedro Alves ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: RFA: fix CLI/9591 (pagination and --batch) 2010-03-05 20:51 ` Pedro Alves @ 2010-03-05 22:24 ` Tom Tromey 2010-03-05 23:45 ` Pedro Alves ` (2 more replies) 0 siblings, 3 replies; 11+ messages in thread From: Tom Tromey @ 2010-03-05 22:24 UTC (permalink / raw) To: Pedro Alves; +Cc: gdb-patches >>>>> "Pedro" == Pedro Alves <pedro@codesourcery.com> writes: Pedro> Should queries be left enabled as well? Sure, here's a followup that does this. Tom 2010-03-05 Tom Tromey <tromey@redhat.com> PR cli/9591: * utils.c: Include main.h. (fputs_maybe_filtered): Don't paginate if `batch'. (defaulted_query): Use default answer if `batch'. * main.h (batch): Declare. * main.c (batch): New global. (captured_main): Remove 'batch'. 2010-03-05 Tom Tromey <tromey@redhat.com> PR cli/9591: * gdb.texinfo (Mode Options): Mention lack of pagination with --batch. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 6bb7d52..d3e06c9 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -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 @code{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 diff --git a/gdb/main.c b/gdb/main.c index e261348..e9f852e 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -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 = 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. */ diff --git a/gdb/main.h b/gdb/main.h index 5e45724..d94903c 100644 --- a/gdb/main.h +++ b/gdb/main.h @@ -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; #endif diff --git a/gdb/utils.c b/gdb/utils.c index 52596ca..388ba43 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -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 */ @@ -1495,7 +1496,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 || ! input_from_terminal_p ()) { wrap_here (""); vfprintf_filtered (gdb_stdout, ctlstr, args); @@ -2209,7 +2210,7 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream, return; /* Don't do any filtering if it is disabled. */ - if ((stream != gdb_stdout) || !pagination_enabled + if ((stream != gdb_stdout) || !pagination_enabled || batch || (lines_per_page == UINT_MAX && chars_per_line == UINT_MAX)) { fputs_unfiltered (linebuffer, stream); ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: RFA: fix CLI/9591 (pagination and --batch) 2010-03-05 22:24 ` Tom Tromey @ 2010-03-05 23:45 ` Pedro Alves 2010-03-06 4:10 ` Joel Brobecker 2010-03-06 9:14 ` Eli Zaretskii 2 siblings, 0 replies; 11+ messages in thread From: Pedro Alves @ 2010-03-05 23:45 UTC (permalink / raw) To: Tom Tromey; +Cc: gdb-patches On Friday 05 March 2010 22:24:12, Tom Tromey wrote: > Pedro> Should queries be left enabled as well? > Sure, here's a followup that does this. Thanks. -- Pedro Alves ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: RFA: fix CLI/9591 (pagination and --batch) 2010-03-05 22:24 ` Tom Tromey 2010-03-05 23:45 ` Pedro Alves @ 2010-03-06 4:10 ` Joel Brobecker 2010-03-06 9:32 ` Eli Zaretskii 2010-03-06 9:14 ` Eli Zaretskii 2 siblings, 1 reply; 11+ messages in thread From: Joel Brobecker @ 2010-03-06 4:10 UTC (permalink / raw) To: Tom Tromey; +Cc: Pedro Alves, gdb-patches > Pedro> Should queries be left enabled as well? > > Sure, here's a followup that does this. Yay! I also agree this change (and I had a look at the patch, FWIW). Thank you :) -- Joel ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: RFA: fix CLI/9591 (pagination and --batch) 2010-03-06 4:10 ` Joel Brobecker @ 2010-03-06 9:32 ` Eli Zaretskii 0 siblings, 0 replies; 11+ messages in thread From: Eli Zaretskii @ 2010-03-06 9:32 UTC (permalink / raw) To: Joel Brobecker; +Cc: tromey, pedro, gdb-patches > Date: Sat, 6 Mar 2010 08:09:44 +0400 > From: Joel Brobecker <brobecker@adacore.com> > Cc: Pedro Alves <pedro@codesourcery.com>, gdb-patches@sourceware.org > > > Pedro> Should queries be left enabled as well? > > > > Sure, here's a followup that does this. > > Yay! I also agree this change (and I had a look at the patch, FWIW). Btw, should we have a NEWS entry about this? ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: RFA: fix CLI/9591 (pagination and --batch) 2010-03-05 22:24 ` Tom Tromey 2010-03-05 23:45 ` Pedro Alves 2010-03-06 4:10 ` Joel Brobecker @ 2010-03-06 9:14 ` Eli Zaretskii 2010-03-08 17:46 ` Tom Tromey 2 siblings, 1 reply; 11+ messages in thread From: Eli Zaretskii @ 2010-03-06 9:14 UTC (permalink / raw) To: Tom Tromey; +Cc: pedro, gdb-patches > From: Tom Tromey <tromey@redhat.com> > Cc: gdb-patches@sourceware.org > Date: Fri, 05 Mar 2010 15:24:12 -0700 > > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -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 @code{set confirm off} were in > +effect (@pxref{Messages/Warnings}). This is okay, but please also add notes to the two referenced nodes telling how the batch mode changes their respective defaults. Oh, and please use @kbd{set confirm off}, as that would be a command typed at the keyboard. > +/* True if --batch or --batch-silent was seen. */ > +int batch = 0; Is it wise to have a global symbol with such a short and ``general'' name? Previously, it was static, so that was probably okay. Now it's a true global, so it could potentially clash with some library. I'd suggest to rename it to something less invasive. Thanks. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: RFA: fix CLI/9591 (pagination and --batch) 2010-03-06 9:14 ` Eli Zaretskii @ 2010-03-08 17:46 ` Tom Tromey 2010-03-08 18:13 ` Eli Zaretskii 0 siblings, 1 reply; 11+ messages in thread From: Tom Tromey @ 2010-03-08 17:46 UTC (permalink / raw) To: Eli Zaretskii; +Cc: pedro, gdb-patches >>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes: Eli> This is okay, but please also add notes to the two referenced nodes Eli> telling how the batch mode changes their respective defaults. It doesn't change their defaults, it permanently overrides them. So, I didn't update those nodes. Eli> Oh, and please use @kbd{set confirm off}, as that would be a command Eli> typed at the keyboard. Done. >> +/* True if --batch or --batch-silent was seen. */ >> +int batch = 0; Eli> Is it wise to have a global symbol with such a short and ``general'' Eli> name? Previously, it was static, so that was probably okay. Now it's Eli> a true global, so it could potentially clash with some library. I'd Eli> suggest to rename it to something less invasive. I think that is very unlikely, but I went ahead and made the change anyway. Here is a new version with a NEWS entry. Please review. Tom 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 Tom Tromey <tromey@redhat.com> PR cli/9591: * gdb.texinfo (Mode Options): Mention lack of pagination with --batch. Index: NEWS =================================================================== RCS file: /cvs/src/src/gdb/NEWS,v retrieving revision 1.361 diff -u -r1.361 NEWS --- NEWS 5 Mar 2010 20:18:11 -0000 1.361 +++ NEWS 8 Mar 2010 17:44:31 -0000 @@ -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: main.c =================================================================== RCS file: /cvs/src/src/gdb/main.c,v retrieving revision 1.80 diff -u -r1.80 main.c --- main.c 20 Jan 2010 14:23:07 -0000 1.80 +++ main.c 8 Mar 2010 17:44:31 -0000 @@ -76,6 +76,9 @@ 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 @@ 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 @@ {"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 @@ } break; case 'B': - batch = batch_silent = 1; + batch_flag = batch_silent = 1; gdb_stdout = ui_file_new(); break; #ifdef GDBTK @@ -631,7 +633,7 @@ use_windows = 0; } - if (batch) + if (batch_flag) quiet = 1; } @@ -803,15 +805,15 @@ /* 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 @@ 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 @@ 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 @@ { 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: main.h =================================================================== RCS file: /cvs/src/src/gdb/main.h,v retrieving revision 1.10 diff -u -r1.10 main.h --- main.h 1 Jan 2010 07:31:37 -0000 1.10 +++ main.h 8 Mar 2010 17:44:31 -0000 @@ -34,5 +34,6 @@ extern int return_child_result; extern int return_child_result_value; extern int batch_silent; +extern int batch_flag; #endif Index: utils.c =================================================================== RCS file: /cvs/src/src/gdb/utils.c,v retrieving revision 1.227 diff -u -r1.227 utils.c --- utils.c 5 Mar 2010 20:18:14 -0000 1.227 +++ utils.c 8 Mar 2010 17:44:31 -0000 @@ -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 @@ 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); Index: doc/gdb.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v retrieving revision 1.678 diff -u -r1.678 gdb.texinfo --- doc/gdb.texinfo 5 Mar 2010 20:18:16 -0000 1.678 +++ doc/gdb.texinfo 8 Mar 2010 17:44:35 -0000 @@ -1028,7 +1028,9 @@ 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: RFA: fix CLI/9591 (pagination and --batch) 2010-03-08 17:46 ` Tom Tromey @ 2010-03-08 18:13 ` Eli Zaretskii 2010-03-08 18:47 ` Tom Tromey 0 siblings, 1 reply; 11+ messages in thread From: Eli Zaretskii @ 2010-03-08 18:13 UTC (permalink / raw) To: Tom Tromey; +Cc: pedro, gdb-patches > From: Tom Tromey <tromey@redhat.com> > Cc: pedro@codesourcery.com, gdb-patches@sourceware.org > Date: Mon, 08 Mar 2010 10:45:55 -0700 > > >>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes: > > Eli> This is okay, but please also add notes to the two referenced nodes > Eli> telling how the batch mode changes their respective defaults. > > It doesn't change their defaults, it permanently overrides them. Well, I don't see how that subtle difference matters here. For example, in the "Messages/Warnings" node the manual currently says: `set confirm off' Disables confirmation requests. `set confirm on' Enables confirmation requests (the default). `show confirm' Displays state of confirmation requests. What I had in mind is adding a note like this: @item set confirm off Disables confirmation requests. Note that running @value{GDBN} with the @option{--batch} option (@pxref{Mode Options, --batch}) also automatically disables confirmation requests. and similarly for pagination. > Here is a new version with a NEWS entry. Please review. They are okay otherwise. Thanks. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: RFA: fix CLI/9591 (pagination and --batch) 2010-03-08 18:13 ` Eli Zaretskii @ 2010-03-08 18:47 ` Tom Tromey 2010-03-08 19:11 ` Eli Zaretskii 0 siblings, 1 reply; 11+ messages in thread From: Tom Tromey @ 2010-03-08 18:47 UTC (permalink / raw) To: Eli Zaretskii; +Cc: pedro, gdb-patches >>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes: Eli> What I had in mind is adding a note like this: Eli> @item set confirm off Eli> Disables confirmation requests. Note that running @value{GDBN} Eli> with the @option{--batch} option (@pxref{Mode Options, --batch}) Eli> also automatically disables confirmation requests. Eli> and similarly for pagination. Ok, how about this? Tom 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 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. Index: NEWS =================================================================== RCS file: /cvs/src/src/gdb/NEWS,v retrieving revision 1.361 diff -u -r1.361 NEWS --- NEWS 5 Mar 2010 20:18:11 -0000 1.361 +++ NEWS 8 Mar 2010 18:47:15 -0000 @@ -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: main.c =================================================================== RCS file: /cvs/src/src/gdb/main.c,v retrieving revision 1.80 diff -u -r1.80 main.c --- main.c 20 Jan 2010 14:23:07 -0000 1.80 +++ main.c 8 Mar 2010 18:47:15 -0000 @@ -76,6 +76,9 @@ 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 @@ 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 @@ {"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 @@ } break; case 'B': - batch = batch_silent = 1; + batch_flag = batch_silent = 1; gdb_stdout = ui_file_new(); break; #ifdef GDBTK @@ -631,7 +633,7 @@ use_windows = 0; } - if (batch) + if (batch_flag) quiet = 1; } @@ -803,15 +805,15 @@ /* 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 @@ 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 @@ 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 @@ { 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: main.h =================================================================== RCS file: /cvs/src/src/gdb/main.h,v retrieving revision 1.10 diff -u -r1.10 main.h --- main.h 1 Jan 2010 07:31:37 -0000 1.10 +++ main.h 8 Mar 2010 18:47:15 -0000 @@ -34,5 +34,6 @@ extern int return_child_result; extern int return_child_result_value; extern int batch_silent; +extern int batch_flag; #endif Index: utils.c =================================================================== RCS file: /cvs/src/src/gdb/utils.c,v retrieving revision 1.227 diff -u -r1.227 utils.c --- utils.c 5 Mar 2010 20:18:14 -0000 1.227 +++ utils.c 8 Mar 2010 18:47:16 -0000 @@ -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 @@ 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); Index: doc/gdb.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v retrieving revision 1.678 diff -u -r1.678 gdb.texinfo --- doc/gdb.texinfo 5 Mar 2010 20:18:16 -0000 1.678 +++ doc/gdb.texinfo 8 Mar 2010 18:47:19 -0000 @@ -1028,7 +1028,9 @@ 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 @@ @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 @@ @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). ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: RFA: fix CLI/9591 (pagination and --batch) 2010-03-08 18:47 ` Tom Tromey @ 2010-03-08 19:11 ` Eli Zaretskii 0 siblings, 0 replies; 11+ messages in thread From: Eli Zaretskii @ 2010-03-08 19:11 UTC (permalink / raw) To: Tom Tromey; +Cc: pedro, gdb-patches > From: Tom Tromey <tromey@redhat.com> > Cc: pedro@codesourcery.com, gdb-patches@sourceware.org > Date: Mon, 08 Mar 2010 11:47:25 -0700 > > >>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes: > > Eli> What I had in mind is adding a note like this: > Eli> @item set confirm off > Eli> Disables confirmation requests. Note that running @value{GDBN} > Eli> with the @option{--batch} option (@pxref{Mode Options, --batch}) > Eli> also automatically disables confirmation requests. > Eli> and similarly for pagination. > > Ok, how about this? Perfect. Thanks. ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2010-03-08 19:11 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-03-05 19:58 RFA: fix CLI/9591 (pagination and --batch) Tom Tromey 2010-03-05 20:51 ` Pedro Alves 2010-03-05 22:24 ` Tom Tromey 2010-03-05 23:45 ` Pedro Alves 2010-03-06 4:10 ` Joel Brobecker 2010-03-06 9:32 ` Eli Zaretskii 2010-03-06 9:14 ` Eli Zaretskii 2010-03-08 17:46 ` Tom Tromey 2010-03-08 18:13 ` Eli Zaretskii 2010-03-08 18:47 ` Tom Tromey 2010-03-08 19:11 ` Eli Zaretskii
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox