aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-11-04 12:38:10 -0700
committerTom Tromey <tromey@redhat.com>2013-11-15 08:43:14 -0700
commit805e1f190887b3b7dea3fd157d58bc25effcf688 (patch)
treee384f11e3c9596419f0ca2588c8e2e90d32c8299 /gdb/doc
parentad8ecc8114ce17e4f8f118606225f1002d7faec2 (diff)
downloadgdb-805e1f190887b3b7dea3fd157d58bc25effcf688.zip
gdb-805e1f190887b3b7dea3fd157d58bc25effcf688.tar.gz
gdb-805e1f190887b3b7dea3fd157d58bc25effcf688.tar.bz2
fix PR c++/16117
This patch fixes PR c++/16117. gdb has an extension so that users can use expressions like FILE::NAME to choose a variable of the given name from the given file. The bug is that this extension takes precedence over ordinary C++ expressions of the same form. You might think this is merely hypothetical, but now that C++ headers commonly do not use an extension, it is more common. This patch fixes the bug by making two related changes. First, it changes gdb to prefer the ordinary C++ meaning of a symbol over the extended meaning. Second, it arranges for single-quoting of the symbol to indicate a preference for the extension. Built and regtested on x86-64 Fedora 18. New test case included. 2013-11-15 Tom Tromey <tromey@redhat.com> PR c++/16117: * c-exp.y (lex_one_token): Add "is_quoted_name" argument. (classify_name): Likewise. Prefer a field of "this" over a filename. (classify_inner_name, yylex): Update. 2013-11-15 Tom Tromey <tromey@redhat.com> * gdb.texinfo (Variables): Note gdb rules for ambiguous cases. Add example. 2013-11-15 Tom Tromey <tromey@redhat.com> * gdb.cp/includefile: New file. * gdb.cp/filename.exp: New file. * gdb.cp/filename.cc: New file.
Diffstat (limited to 'gdb/doc')
-rw-r--r--gdb/doc/ChangeLog5
-rw-r--r--gdb/doc/gdb.texinfo23
2 files changed, 23 insertions, 5 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 0dc75cd..2750b0a 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2013-11-15 Tom Tromey <tromey@redhat.com>
+
+ * gdb.texinfo (Variables): Note gdb rules for ambiguous cases.
+ Add example.
+
2013-11-14 Tom Tromey <tromey@redhat.com>
* gdb.texinfo (Breakpoints In Python): Replace "as" with "in".
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index c2dfa17..cfb2cdb 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -8324,11 +8324,24 @@ $4 = 0
@end smallexample
@cindex C@t{++} scope resolution
-These uses of @samp{::} are very rarely in conflict with the very similar
-use of the same notation in C@t{++}. @value{GDBN} also supports use of the C@t{++}
-scope resolution operator in @value{GDBN} expressions.
-@c FIXME: Um, so what happens in one of those rare cases where it's in
-@c conflict?? --mew
+These uses of @samp{::} are very rarely in conflict with the very
+similar use of the same notation in C@t{++}. When they are in
+conflict, the C@t{++} meaning takes precedence; however, this can be
+overridden by quoting the file or function name with single quotes.
+
+For example, suppose the program is stopped in a method of a class
+that has a field named @code{includefile}, and there is also an
+include file named @file{includefile} that defines a variable,
+@code{some_global}.
+
+@smallexample
+(@value{GDBP}) p includefile
+$1 = 23
+(@value{GDBP}) p includefile::some_global
+A syntax error in expression, near `'.
+(@value{GDBP}) p 'includefile'::some_global
+$2 = 27
+@end smallexample
@cindex wrong values
@cindex variable values, wrong