aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp/filename.exp
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/testsuite/gdb.cp/filename.exp
parentad8ecc8114ce17e4f8f118606225f1002d7faec2 (diff)
downloadfsf-binutils-gdb-805e1f190887b3b7dea3fd157d58bc25effcf688.zip
fsf-binutils-gdb-805e1f190887b3b7dea3fd157d58bc25effcf688.tar.gz
fsf-binutils-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/testsuite/gdb.cp/filename.exp')
-rw-r--r--gdb/testsuite/gdb.cp/filename.exp33
1 files changed, 33 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.cp/filename.exp b/gdb/testsuite/gdb.cp/filename.exp
new file mode 100644
index 0000000..b908715
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/filename.exp
@@ -0,0 +1,33 @@
+# Copyright 2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if { [skip_cplus_tests] } { continue }
+
+standard_testfile .cc
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
+ return -1
+}
+
+if ![runto_main] then {
+ perror "couldn't run to main"
+ continue
+}
+
+gdb_breakpoint [gdb_get_line_number "stop here"]
+gdb_continue_to_breakpoint "stop here"
+
+gdb_test "print includefile\[0\]" " = 23"
+gdb_test "print 'includefile'::some_global" " = 27"