Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Unified Diff: gdb/testsuite/gdb.cp/typeid.exp

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/testsuite/gdb.cp/typeid.cc ('k') | gdb/testsuite/gdb.cp/userdef.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/testsuite/gdb.cp/typeid.exp
diff --git a/gdb/testsuite/gdb.cp/typeid.exp b/gdb/testsuite/gdb.cp/typeid.exp
new file mode 100644
index 0000000000000000000000000000000000000000..2096ad9203b73f942d22192590de0099232a26a7
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/typeid.exp
@@ -0,0 +1,67 @@
+# 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/>.
+
+standard_testfile .cc
+
+if {[skip_cplus_tests]} {
+ return -1
+}
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
+ return -1
+}
+
+proc do_typeid_tests {started} {
+ global hex
+
+ # We might see the standard type or gdb's internal type.
+ set type_re "(std::type_info|struct gdb_gnu_v3_type_info)"
+
+
+ foreach simple_var {i cp ccp ca b} {
+ gdb_test "print &typeid($simple_var)" \
+ " = \\($type_re \\*\\) $hex.*"
+
+ # Note that we test pointer equality rather than object
+ # equality here. That is because std::type_info's operator==
+ # is not present in the libstdc++ .so.
+ gdb_test "print &typeid($simple_var) == &typeid(typeof($simple_var))" \
+ " = true"
+ }
+
+ # typeid for these is Derived. Don't try these tests until the
+ # inferior has started.
+ if {$started} {
+ foreach der_var {*b *vb1 *vb2 *bv d {const Derived} {const Derived &}} {
+ gdb_test "print &typeid($der_var)" \
+ " = \\($type_re \\*\\) $hex.*"
+ gdb_test "print &typeid($der_var) == &typeid(d)" \
+ " = true"
+ }
+ }
+}
+
+with_test_prefix "before starting" {
+ do_typeid_tests 0
+}
+
+if ![runto_main] {
+ untested typeid
+ return -1
+}
+
+with_test_prefix "after starting" {
+ do_typeid_tests 1
+}
« no previous file with comments | « gdb/testsuite/gdb.cp/typeid.cc ('k') | gdb/testsuite/gdb.cp/userdef.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698