From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14774 invoked by alias); 5 Mar 2010 22:24:32 -0000 Received: (qmail 14763 invoked by uid 22791); 5 Mar 2010 22:24:30 -0000 X-SWARE-Spam-Status: No, hits=-7.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 05 Mar 2010 22:24:24 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o25MOEWC022377 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 5 Mar 2010 17:24:14 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o25MOD2P023069; Fri, 5 Mar 2010 17:24:14 -0500 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o25MOCQO019668; Fri, 5 Mar 2010 17:24:13 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id AAC98378261; Fri, 5 Mar 2010 15:24:12 -0700 (MST) From: Tom Tromey To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: RFA: fix CLI/9591 (pagination and --batch) References: <201003052050.51865.pedro@codesourcery.com> Reply-To: Tom Tromey Date: Fri, 05 Mar 2010 22:24:00 -0000 In-Reply-To: <201003052050.51865.pedro@codesourcery.com> (Pedro Alves's message of "Fri, 5 Mar 2010 20:50:51 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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/msg00248.txt.bz2 >>>>> "Pedro" == Pedro Alves writes: Pedro> Should queries be left enabled as well? Sure, here's a followup that does this. Tom 2010-03-05 Tom Tromey 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 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);