From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18480 invoked by alias); 10 Feb 2010 17:50:51 -0000 Received: (qmail 18462 invoked by uid 22791); 10 Feb 2010 17:50:50 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_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; Wed, 10 Feb 2010 17:50:46 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1AHogIE003297 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 10 Feb 2010 12:50:42 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1AHof3C032311; Wed, 10 Feb 2010 12:50:41 -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 o1AHod8H005586; Wed, 10 Feb 2010 12:50:40 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id 4747837824A; Wed, 10 Feb 2010 10:50:39 -0700 (MST) From: Tom Tromey To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: RFA: interactive command to enable parser debugging References: <833a1adyv2.fsf@gnu.org> Reply-To: Tom Tromey Date: Wed, 10 Feb 2010 17:50:00 -0000 In-Reply-To: <833a1adyv2.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 09 Feb 2010 20:53:53 +0200") 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-02/txt/msg00270.txt.bz2 >>>>> "Eli" == Eli Zaretskii writes: Eli> I would also consider saying explicitly that this option sets the Eli> value of `yydebug', because whoever wants to debug the parser is Eli> probably familiar with what `yydebug' does. How about this? I did that, added the index entries you suggested, rearranged things so that set comes before show (the other items in the list all do this, which I didn't notice the first time), and finally added a link to the bison manual. Tom 2010-02-10 Tom Tromey * parser-defs.h (parser_debug): Declare. * parse.c (_initialize_parse): Install "debug parser" set/show command. (parser_debug): New global. (show_parserdebug): New function. * c-exp.y (c_parse): Set yydebug. 2010-02-10 Tom Tromey * gdb.texinfo (Debugging Output): Document set debug parser and show debug parser. Index: c-exp.y =================================================================== RCS file: /cvs/src/src/gdb/c-exp.y,v retrieving revision 1.69 diff -u -r1.69 c-exp.y --- c-exp.y 18 Jan 2010 20:54:33 -0000 1.69 +++ c-exp.y 10 Feb 2010 17:44:21 -0000 @@ -2450,6 +2450,9 @@ gdb_assert (! macro_original_text); make_cleanup (scan_macro_cleanup, 0); + make_cleanup_restore_integer (&yydebug); + yydebug = parser_debug; + /* Initialize some state used by the lexer. */ last_was_structop = 0; saw_name_at_eof = 0; Index: parse.c =================================================================== RCS file: /cvs/src/src/gdb/parse.c,v retrieving revision 1.94 diff -u -r1.94 parse.c --- parse.c 18 Jan 2010 20:54:34 -0000 1.94 +++ parse.c 10 Feb 2010 17:44:22 -0000 @@ -109,6 +109,18 @@ fprintf_filtered (file, _("Expression debugging is %s.\n"), value); } + +/* Non-zero if an expression parser should set yydebug. */ +int parser_debug; + +static void +show_parserdebug (struct ui_file *file, int from_tty, + struct cmd_list_element *c, const char *value) +{ + fprintf_filtered (file, _("Parser debugging is %s.\n"), value); +} + + static void free_funcalls (void *ignore); static int prefixify_expression (struct expression *); @@ -1377,4 +1389,12 @@ NULL, show_expressiondebug, &setdebuglist, &showdebuglist); + add_setshow_boolean_cmd ("parser", class_maintenance, + &parser_debug, _("\ +Set parser debugging."), _("\ +Show parser debugging."), _("\ +When non-zero, expression parser tracing will be enabled."), + NULL, + show_parserdebug, + &setdebuglist, &showdebuglist); } Index: parser-defs.h =================================================================== RCS file: /cvs/src/src/gdb/parser-defs.h,v retrieving revision 1.32 diff -u -r1.32 parser-defs.h --- parser-defs.h 1 Jan 2010 07:31:38 -0000 1.32 +++ parser-defs.h 10 Feb 2010 17:44:22 -0000 @@ -29,6 +29,8 @@ struct block; +extern int parser_debug; + extern struct expression *expout; extern int expout_size; extern int expout_ptr; Index: doc/gdb.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v retrieving revision 1.666 diff -u -r1.666 gdb.texinfo --- doc/gdb.texinfo 9 Feb 2010 18:58:57 -0000 1.666 +++ doc/gdb.texinfo 10 Feb 2010 17:44:27 -0000 @@ -18848,6 +18848,15 @@ @item show debug overload Displays the current state of displaying @value{GDBN} C@t{++} overload debugging info. +@cindex expression parser, debugging info +@cindex debug expression parser +@item set debug parser +Turns on or off the display of expression parser debugging output. +Internally, this sets the @code{yydebug} variable in the expression +parser. @xref{Tracing, , Tracing Your Parser, bison, Bison}, for +details. The default is off. +@item show debug parser +Show the current state of expression parser debugging. @cindex packets, reporting on stdout @cindex serial connections, debugging @cindex debug remote protocol