From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8618 invoked by alias); 5 Mar 2010 20:51:02 -0000 Received: (qmail 8595 invoked by uid 22791); 5 Mar 2010 20:50:59 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 05 Mar 2010 20:50:55 +0000 Received: (qmail 21026 invoked from network); 5 Mar 2010 20:50:53 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 5 Mar 2010 20:50:53 -0000 From: Pedro Alves To: gdb-patches@sourceware.org, tromey@redhat.com Subject: Re: RFA: fix CLI/9591 (pagination and --batch) Date: Fri, 05 Mar 2010 20:51:00 -0000 User-Agent: KMail/1.12.2 (Linux/2.6.31-19-generic; KDE/4.3.2; x86_64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201003052050.51865.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-03/txt/msg00245.txt.bz2 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) IMO, pagination is a kind of query. > > Built and regtested on x86-64 (compile farm). > > Tom > > 2010-03-05 Tom Tromey > > 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 > > 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