aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2010-02-10 18:57:21 +0000
committerTom Tromey <tromey@redhat.com>2010-02-10 18:57:21 +0000
commit92981e24467c4247c8bf16780cac90b340c0a4c2 (patch)
tree2d06fe7a6dc3736da642110496f8417d85b4a28c
parent9fd3625f79a17480dd4017136edf4f9a21e834df (diff)
downloadgdb-92981e24467c4247c8bf16780cac90b340c0a4c2.zip
gdb-92981e24467c4247c8bf16780cac90b340c0a4c2.tar.gz
gdb-92981e24467c4247c8bf16780cac90b340c0a4c2.tar.bz2
gdb
* 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. gdb/testsuite * gdb.texinfo (Debugging Output): Document set debug parser and show debug parser.
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/c-exp.y3
-rw-r--r--gdb/doc/ChangeLog5
-rw-r--r--gdb/doc/gdb.texinfo9
-rw-r--r--gdb/parse.c20
-rw-r--r--gdb/parser-defs.h2
6 files changed, 48 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 431ba1c..c5bf4f9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2010-02-10 Tom Tromey <tromey@redhat.com>
+
+ * 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 H.J. Lu <hongjiu.lu@intel.com>
* target-descriptions.c (tdesc_type): Add TDESC_TYPE_I387_EXT,
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 8e00979..845771c 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -2450,6 +2450,9 @@ c_parse (void)
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;
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index dbd12df..b5bef2f 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2010-02-10 Tom Tromey <tromey@redhat.com>
+
+ * gdb.texinfo (Debugging Output): Document set debug parser and
+ show debug parser.
+
2010-02-09 H.J. Lu <hongjiu.lu@intel.com>
* gdb.texinfo (Predefined Target Types): Add i387_ext,
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 81c0b6b..4fc064d 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18848,6 +18848,15 @@ is off.
@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
diff --git a/gdb/parse.c b/gdb/parse.c
index d5a199b..aabc461 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -109,6 +109,18 @@ show_expressiondebug (struct ui_file *file, int from_tty,
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 @@ When non-zero, the internal representation of expressions will be printed."),
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);
}
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
index 6fcf7ae..c4eb1a0 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
@@ -29,6 +29,8 @@
struct block;
+extern int parser_debug;
+
extern struct expression *expout;
extern int expout_size;
extern int expout_ptr;