[gdb/testsuite] Rename *.exp.in to *.exp.tcl
authorTom de Vries <tdevries@suse.de>
Fri, 15 May 2020 12:49:48 +0000 (14:49 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 15 May 2020 12:49:48 +0000 (14:49 +0200)
Say we have some common tcl code that we want to include in test-cases
t1.exp and t1.exp.

We could put the common code into a file common.exp alongside the test-cases,
but that will make dejagnu treat that file as another test-case.  To prevent
this, we use a suffix, currently .in, in other words we put the common code in
a file common.exp.in.

The .in suffix however is also used in autoconf, which might cause confusion.

Change the suffix from .in to .tcl.

gdb/testsuite/ChangeLog:

2020-05-15  Tom de Vries  <tdevries@suse.de>

* gdb.base/align.exp.in: Rename to ...
* gdb.base/align.exp.tcl: ... this.
* gdb.base/align-c++.exp: Update.
* gdb.base/align-c.exp: Update.
* gdb.base/all-architectures.exp.in: Rename to ...
* gdb.base/all-architectures.exp: ... this.
* gdb.base/all-architectures-0.exp: Update.
* gdb.base/all-architectures-1.exp: Update.
* gdb.base/all-architectures-2.exp: Update.
* gdb.base/all-architectures-3.exp: Update.
* gdb.base/all-architectures-4.exp: Update.
* gdb.base/all-architectures-5.exp: Update.
* gdb.base/all-architectures-6.exp: Update.
* gdb.base/all-architectures-7.exp: Update.
* gdb.base/infcall-nested-structs.exp.in: Rename to ...
* gdb.base/infcall-nested-structs.exp.tcl: ... this.
* gdb.base/infcall-nested-structs-c++.exp: Update.
* gdb.base/infcall-nested-structs-c.exp: Update.
* gdb.base/info-types.exp.in: Rename to ...
* gdb.base/info-types.exp.tcl: ... this.
* gdb.base/info-types-c++.exp: Update.
* gdb.base/info-types-c.exp: Update.
* gdb.base/max-depth.exp.in: Rename to ...
* gdb.base/max-depth.exp.tcl: ... this.
* gdb.base/max-depth-c++.exp: Update.
* gdb.base/max-depth-c.exp: Update.
* gdb.cp/cpexprs.exp.in: Rename to ...
* gdb.cp/cpexprs.exp.tcl: ... this.
* gdb.cp/cpexprs-debug-types.exp: Update.
* gdb.cp/cpexprs.exp: Update.
* gdb.cp/infcall-nodebug.exp.in: Rename to ...
* gdb.cp/infcall-nodebug.exp.tcl: ... this.
* gdb.cp/infcall-nodebug-c++-d0.exp: Update.
* gdb.cp/infcall-nodebug-c++-d1.exp: Update.
* gdb.cp/infcall-nodebug-c-d0.exp: Update.
* gdb.cp/infcall-nodebug-c-d1.exp: Update.
* gdb.dwarf2/clang-debug-names.exp.in: Rename to ...
* gdb.dwarf2/clang-debug-names.exp.tcl: ... this.
* gdb.dwarf2/clang-debug-names-2.exp: Update.
* gdb.dwarf2/clang-debug-names.exp: Update.

41 files changed:
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/align-c++.exp
gdb/testsuite/gdb.base/align-c.exp
gdb/testsuite/gdb.base/align.exp.in [deleted file]
gdb/testsuite/gdb.base/align.exp.tcl [new file with mode: 0644]
gdb/testsuite/gdb.base/all-architectures-0.exp
gdb/testsuite/gdb.base/all-architectures-1.exp
gdb/testsuite/gdb.base/all-architectures-2.exp
gdb/testsuite/gdb.base/all-architectures-3.exp
gdb/testsuite/gdb.base/all-architectures-4.exp
gdb/testsuite/gdb.base/all-architectures-5.exp
gdb/testsuite/gdb.base/all-architectures-6.exp
gdb/testsuite/gdb.base/all-architectures-7.exp
gdb/testsuite/gdb.base/all-architectures.exp.in [deleted file]
gdb/testsuite/gdb.base/all-architectures.exp.tcl [new file with mode: 0644]
gdb/testsuite/gdb.base/infcall-nested-structs-c++.exp
gdb/testsuite/gdb.base/infcall-nested-structs-c.exp
gdb/testsuite/gdb.base/infcall-nested-structs.exp.in [deleted file]
gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl [new file with mode: 0644]
gdb/testsuite/gdb.base/info-types-c++.exp
gdb/testsuite/gdb.base/info-types-c.exp
gdb/testsuite/gdb.base/info-types.exp.in [deleted file]
gdb/testsuite/gdb.base/info-types.exp.tcl [new file with mode: 0644]
gdb/testsuite/gdb.base/max-depth-c++.exp
gdb/testsuite/gdb.base/max-depth-c.exp
gdb/testsuite/gdb.base/max-depth.exp.in [deleted file]
gdb/testsuite/gdb.base/max-depth.exp.tcl [new file with mode: 0644]
gdb/testsuite/gdb.cp/cpexprs-debug-types.exp
gdb/testsuite/gdb.cp/cpexprs.exp
gdb/testsuite/gdb.cp/cpexprs.exp.in [deleted file]
gdb/testsuite/gdb.cp/cpexprs.exp.tcl [new file with mode: 0644]
gdb/testsuite/gdb.cp/infcall-nodebug-c++-d0.exp
gdb/testsuite/gdb.cp/infcall-nodebug-c++-d1.exp
gdb/testsuite/gdb.cp/infcall-nodebug-c-d0.exp
gdb/testsuite/gdb.cp/infcall-nodebug-c-d1.exp
gdb/testsuite/gdb.cp/infcall-nodebug.exp.in [deleted file]
gdb/testsuite/gdb.cp/infcall-nodebug.exp.tcl [new file with mode: 0644]
gdb/testsuite/gdb.dwarf2/clang-debug-names-2.exp
gdb/testsuite/gdb.dwarf2/clang-debug-names.exp
gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.in [deleted file]
gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.tcl [new file with mode: 0644]

index 5a523c2d2bc97117ad56db982183785e7be7344f..30a150d782ce48ca79b90e73ae5cefb4c1722312 100644 (file)
@@ -1,3 +1,46 @@
+2020-05-15  Tom de Vries  <tdevries@suse.de>
+
+       * gdb.base/align.exp.in: Rename to ...
+       * gdb.base/align.exp.tcl: ... this.
+       * gdb.base/align-c++.exp: Update.
+       * gdb.base/align-c.exp: Update.
+       * gdb.base/all-architectures.exp.in: Rename to ...
+       * gdb.base/all-architectures.exp: ... this.
+       * gdb.base/all-architectures-0.exp: Update.
+       * gdb.base/all-architectures-1.exp: Update.
+       * gdb.base/all-architectures-2.exp: Update.
+       * gdb.base/all-architectures-3.exp: Update.
+       * gdb.base/all-architectures-4.exp: Update.
+       * gdb.base/all-architectures-5.exp: Update.
+       * gdb.base/all-architectures-6.exp: Update.
+       * gdb.base/all-architectures-7.exp: Update.
+       * gdb.base/infcall-nested-structs.exp.in: Rename to ...
+       * gdb.base/infcall-nested-structs.exp.tcl: ... this.
+       * gdb.base/infcall-nested-structs-c++.exp: Update.
+       * gdb.base/infcall-nested-structs-c.exp: Update.
+       * gdb.base/info-types.exp.in: Rename to ...
+       * gdb.base/info-types.exp.tcl: ... this.
+       * gdb.base/info-types-c++.exp: Update.
+       * gdb.base/info-types-c.exp: Update.
+       * gdb.base/max-depth.exp.in: Rename to ...
+       * gdb.base/max-depth.exp.tcl: ... this.
+       * gdb.base/max-depth-c++.exp: Update.
+       * gdb.base/max-depth-c.exp: Update.
+       * gdb.cp/cpexprs.exp.in: Rename to ...
+       * gdb.cp/cpexprs.exp.tcl: ... this.
+       * gdb.cp/cpexprs-debug-types.exp: Update.
+       * gdb.cp/cpexprs.exp: Update.
+       * gdb.cp/infcall-nodebug.exp.in: Rename to ...
+       * gdb.cp/infcall-nodebug.exp.tcl: ... this.
+       * gdb.cp/infcall-nodebug-c++-d0.exp: Update.
+       * gdb.cp/infcall-nodebug-c++-d1.exp: Update.
+       * gdb.cp/infcall-nodebug-c-d0.exp: Update.
+       * gdb.cp/infcall-nodebug-c-d1.exp: Update.
+       * gdb.dwarf2/clang-debug-names.exp.in: Rename to ...
+       * gdb.dwarf2/clang-debug-names.exp.tcl: ... this.
+       * gdb.dwarf2/clang-debug-names-2.exp: Update.
+       * gdb.dwarf2/clang-debug-names.exp: Update.
+
 2020-05-15  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * lib/check-test-names.exp: Remove code that prevents this file
index 09632d8bfaa3528fbecf0a7f4c0e5fbd72479548..6266d112828de6ed4e46c10862aa737fa3ca3089 100644 (file)
@@ -24,4 +24,4 @@ if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
 }
 set lang c++
 
-source $srcdir/$subdir/align.exp.in
+source $srcdir/$subdir/align.exp.tcl
index d7852f4ea83381d905d19409fdc88eebadcbbfe3..d42abc8d3802cd8dfd2171aee55217c70fb40eba 100644 (file)
@@ -20,4 +20,4 @@
 
 set lang c
 
-source $srcdir/$subdir/align.exp.in
+source $srcdir/$subdir/align.exp.tcl
diff --git a/gdb/testsuite/gdb.base/align.exp.in b/gdb/testsuite/gdb.base/align.exp.in
deleted file mode 100644 (file)
index 0653371..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-# Copyright 2018-2020 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/>.
-
-# This file is part of the gdb testsuite
-
-# The types we're going to test.
-
-set typelist {
-    char {unsigned char}
-    short {unsigned short}
-    int {unsigned int}
-    long {unsigned long}
-    {long long} {unsigned long long}
-    float
-    double {long double}
-}
-
-if {[has_int128_c]} {
-    # Note we don't check "unsigned __int128" yet because at least gcc
-    # canonicalizes the name to "__int128 unsigned", and there isn't a
-    # c-exp.y production for this.
-    # https://sourceware.org/bugzilla/show_bug.cgi?id=20991
-    lappend typelist __int128
-}
-
-# Build source file for testing alignment handling of language LANG.
-# Returns the name of the newly created source file.
-proc prepare_test_source_file { lang } {
-    global typelist
-
-    # Create the test file.
-
-    if { $lang == "c++" } {
-       set suffix "cpp"
-       set align_func "alignof"
-    } else {
-       set suffix "c"
-       set align_func "_Alignof"
-    }
-
-    set filename [standard_output_file "align.$suffix"]
-    set outfile [open $filename w]
-
-    # Prologue.
-    puts -nonewline $outfile "#define DEF(T,U) struct align_pair_ ## T ## _x_ ## U "
-    puts $outfile "{ T one; U two; }"
-    if { $lang == "c++" } {
-       puts -nonewline $outfile "#define DEF_WITH_1_STATIC(T,U) struct align_pair_static_ ## T ## _x_ ## U "
-       puts $outfile "{ static T one; U two; }"
-       puts -nonewline $outfile "#define DEF_WITH_2_STATIC(T,U) struct align_pair_static_ ## T ## _x_static_ ## U "
-       puts $outfile "{ static T one; static U two; }"
-    }
-    if { $lang == "c" } {
-       puts $outfile "unsigned a_void = ${align_func} (void);"
-    }
-
-    # First emit single items.
-    foreach type $typelist {
-       set utype [join [split $type] _]
-       if {$type != $utype} {
-           puts $outfile "typedef $type $utype;"
-       }
-       puts $outfile "$type item_$utype;"
-       if { $lang == "c" } {
-           puts $outfile "unsigned a_$utype\n  = ${align_func} ($type);"
-       }
-       set utype [join [split $type] _]
-    }
-
-    # Now emit all pairs.
-    foreach type $typelist {
-       set utype [join [split $type] _]
-       foreach inner $typelist {
-           set uinner [join [split $inner] _]
-           puts $outfile "DEF ($utype, $uinner);"
-           set joined "${utype}_x_${uinner}"
-           puts $outfile "struct align_pair_$joined item_${joined};"
-           puts $outfile "unsigned a_${joined}"
-           puts $outfile "  = ${align_func} (struct align_pair_${joined});"
-
-           if { $lang == "c++" } {
-               puts $outfile "DEF_WITH_1_STATIC ($utype, $uinner);"
-               set joined "static_${utype}_x_${uinner}"
-               puts $outfile "struct align_pair_$joined item_${joined};"
-               puts $outfile "unsigned a_${joined}"
-               puts $outfile "  = ${align_func} (struct align_pair_${joined});"
-
-               puts $outfile "DEF_WITH_2_STATIC ($utype, $uinner);"
-               set joined "static_${utype}_x_static_${uinner}"
-               puts $outfile "struct align_pair_$joined item_${joined};"
-               puts $outfile "unsigned a_${joined}"
-               puts $outfile "  = ${align_func} (struct align_pair_${joined});"
-           }
-       }
-    }
-
-    # Epilogue.
-    puts $outfile {
-       int main() {
-           return 0;
-       }
-    }
-
-    close $outfile
-
-    return $filename
-}
-
-# Run the alignment test for the language LANG.
-proc run_alignment_test { lang } {
-    global testfile srcfile typelist
-    global subdir
-
-    set filename [prepare_test_source_file $lang]
-
-    set flags {debug}
-    if { "$lang" == "c++" } {
-       lappend flags "additional_flags=-std=c++11"
-    }
-    standard_testfile $filename
-    if {[prepare_for_testing "failed to prepare" "$testfile" $srcfile $flags]} {
-       return -1
-    }
-
-    if {![runto_main]} {
-       perror "test suppressed"
-       return
-    }
-
-    if { $lang == "c++" } {
-       set align_func "alignof"
-    } else {
-       set align_func "_Alignof"
-    }
-
-    foreach type $typelist {
-       set utype [join [split $type] _]
-       if { $lang == "c" } {
-           set expected [get_integer_valueof a_$utype 0]
-           gdb_test "print ${align_func}($type)" " = $expected"
-       }
-
-       foreach inner $typelist {
-           set uinner [join [split $inner] _]
-           set expected [get_integer_valueof a_${utype}_x_${uinner} 0]
-           gdb_test "print ${align_func}(struct align_pair_${utype}_x_${uinner})" \
-               " = $expected"
-
-           if { $lang == "c++" } {
-               set expected [get_integer_valueof a_static_${utype}_x_${uinner} 0]
-               gdb_test "print ${align_func}(struct align_pair_static_${utype}_x_${uinner})" \
-                   " = $expected"
-
-               set expected [get_integer_valueof a_static_${utype}_x_static_${uinner} 0]
-               gdb_test "print ${align_func}(struct align_pair_static_${utype}_x_static_${uinner})" \
-                   " = $expected"
-           }
-       }
-    }
-
-    if { $lang == "c" } {
-       set expected [get_integer_valueof a_void 0]
-       gdb_test "print ${align_func}(void)" " = $expected"
-    }
-}
-
-run_alignment_test $lang
diff --git a/gdb/testsuite/gdb.base/align.exp.tcl b/gdb/testsuite/gdb.base/align.exp.tcl
new file mode 100644 (file)
index 0000000..0653371
--- /dev/null
@@ -0,0 +1,179 @@
+# Copyright 2018-2020 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/>.
+
+# This file is part of the gdb testsuite
+
+# The types we're going to test.
+
+set typelist {
+    char {unsigned char}
+    short {unsigned short}
+    int {unsigned int}
+    long {unsigned long}
+    {long long} {unsigned long long}
+    float
+    double {long double}
+}
+
+if {[has_int128_c]} {
+    # Note we don't check "unsigned __int128" yet because at least gcc
+    # canonicalizes the name to "__int128 unsigned", and there isn't a
+    # c-exp.y production for this.
+    # https://sourceware.org/bugzilla/show_bug.cgi?id=20991
+    lappend typelist __int128
+}
+
+# Build source file for testing alignment handling of language LANG.
+# Returns the name of the newly created source file.
+proc prepare_test_source_file { lang } {
+    global typelist
+
+    # Create the test file.
+
+    if { $lang == "c++" } {
+       set suffix "cpp"
+       set align_func "alignof"
+    } else {
+       set suffix "c"
+       set align_func "_Alignof"
+    }
+
+    set filename [standard_output_file "align.$suffix"]
+    set outfile [open $filename w]
+
+    # Prologue.
+    puts -nonewline $outfile "#define DEF(T,U) struct align_pair_ ## T ## _x_ ## U "
+    puts $outfile "{ T one; U two; }"
+    if { $lang == "c++" } {
+       puts -nonewline $outfile "#define DEF_WITH_1_STATIC(T,U) struct align_pair_static_ ## T ## _x_ ## U "
+       puts $outfile "{ static T one; U two; }"
+       puts -nonewline $outfile "#define DEF_WITH_2_STATIC(T,U) struct align_pair_static_ ## T ## _x_static_ ## U "
+       puts $outfile "{ static T one; static U two; }"
+    }
+    if { $lang == "c" } {
+       puts $outfile "unsigned a_void = ${align_func} (void);"
+    }
+
+    # First emit single items.
+    foreach type $typelist {
+       set utype [join [split $type] _]
+       if {$type != $utype} {
+           puts $outfile "typedef $type $utype;"
+       }
+       puts $outfile "$type item_$utype;"
+       if { $lang == "c" } {
+           puts $outfile "unsigned a_$utype\n  = ${align_func} ($type);"
+       }
+       set utype [join [split $type] _]
+    }
+
+    # Now emit all pairs.
+    foreach type $typelist {
+       set utype [join [split $type] _]
+       foreach inner $typelist {
+           set uinner [join [split $inner] _]
+           puts $outfile "DEF ($utype, $uinner);"
+           set joined "${utype}_x_${uinner}"
+           puts $outfile "struct align_pair_$joined item_${joined};"
+           puts $outfile "unsigned a_${joined}"
+           puts $outfile "  = ${align_func} (struct align_pair_${joined});"
+
+           if { $lang == "c++" } {
+               puts $outfile "DEF_WITH_1_STATIC ($utype, $uinner);"
+               set joined "static_${utype}_x_${uinner}"
+               puts $outfile "struct align_pair_$joined item_${joined};"
+               puts $outfile "unsigned a_${joined}"
+               puts $outfile "  = ${align_func} (struct align_pair_${joined});"
+
+               puts $outfile "DEF_WITH_2_STATIC ($utype, $uinner);"
+               set joined "static_${utype}_x_static_${uinner}"
+               puts $outfile "struct align_pair_$joined item_${joined};"
+               puts $outfile "unsigned a_${joined}"
+               puts $outfile "  = ${align_func} (struct align_pair_${joined});"
+           }
+       }
+    }
+
+    # Epilogue.
+    puts $outfile {
+       int main() {
+           return 0;
+       }
+    }
+
+    close $outfile
+
+    return $filename
+}
+
+# Run the alignment test for the language LANG.
+proc run_alignment_test { lang } {
+    global testfile srcfile typelist
+    global subdir
+
+    set filename [prepare_test_source_file $lang]
+
+    set flags {debug}
+    if { "$lang" == "c++" } {
+       lappend flags "additional_flags=-std=c++11"
+    }
+    standard_testfile $filename
+    if {[prepare_for_testing "failed to prepare" "$testfile" $srcfile $flags]} {
+       return -1
+    }
+
+    if {![runto_main]} {
+       perror "test suppressed"
+       return
+    }
+
+    if { $lang == "c++" } {
+       set align_func "alignof"
+    } else {
+       set align_func "_Alignof"
+    }
+
+    foreach type $typelist {
+       set utype [join [split $type] _]
+       if { $lang == "c" } {
+           set expected [get_integer_valueof a_$utype 0]
+           gdb_test "print ${align_func}($type)" " = $expected"
+       }
+
+       foreach inner $typelist {
+           set uinner [join [split $inner] _]
+           set expected [get_integer_valueof a_${utype}_x_${uinner} 0]
+           gdb_test "print ${align_func}(struct align_pair_${utype}_x_${uinner})" \
+               " = $expected"
+
+           if { $lang == "c++" } {
+               set expected [get_integer_valueof a_static_${utype}_x_${uinner} 0]
+               gdb_test "print ${align_func}(struct align_pair_static_${utype}_x_${uinner})" \
+                   " = $expected"
+
+               set expected [get_integer_valueof a_static_${utype}_x_static_${uinner} 0]
+               gdb_test "print ${align_func}(struct align_pair_static_${utype}_x_static_${uinner})" \
+                   " = $expected"
+           }
+       }
+    }
+
+    if { $lang == "c" } {
+       set expected [get_integer_valueof a_void 0]
+       gdb_test "print ${align_func}(void)" " = $expected"
+    }
+}
+
+run_alignment_test $lang
index 767daac9fff0aa2a554d3b05b11ad79681e477ae..d861c41aff5c6c389e110942dfe79eaa11db4f75 100644 (file)
@@ -14,4 +14,4 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 set test_slice 0
-source $srcdir/$subdir/all-architectures.exp.in
+source $srcdir/$subdir/all-architectures.exp.tcl
index 91aad9dc861cf2f8fab76cdc191dc1bff975c248..0e6379eea5df46cd8ae9152a43ca83e1d5844954 100644 (file)
@@ -14,4 +14,4 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 set test_slice 1
-source $srcdir/$subdir/all-architectures.exp.in
+source $srcdir/$subdir/all-architectures.exp.tcl
index c24a332bc2476649fe0e8a5dd5e6f83fdd3aa2fa..6216d48a7c682f25cf625a0a484e7061010596da 100644 (file)
@@ -14,4 +14,4 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 set test_slice 2
-source $srcdir/$subdir/all-architectures.exp.in
+source $srcdir/$subdir/all-architectures.exp.tcl
index a88a38b3a97a1de19e93f8b6f6f62c53ff89ee18..bd873a9666cc00d1a0c50a7ba9a97e0418f17c68 100644 (file)
@@ -14,4 +14,4 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 set test_slice 3
-source $srcdir/$subdir/all-architectures.exp.in
+source $srcdir/$subdir/all-architectures.exp.tcl
index f6c9fc4cefa6986786ee2293472e504e79c944ba..17b0160036bf8f84e01a9a78e2f2c6a42ba87166 100644 (file)
@@ -14,4 +14,4 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 set test_slice 4
-source $srcdir/$subdir/all-architectures.exp.in
+source $srcdir/$subdir/all-architectures.exp.tcl
index e84441be4a89a22c62f250470e8bf2a2dc28b008..613ae6fdf12c1b85ddd92aa9b2fec3e34e3bc073 100644 (file)
@@ -14,4 +14,4 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 set test_slice 5
-source $srcdir/$subdir/all-architectures.exp.in
+source $srcdir/$subdir/all-architectures.exp.tcl
index 702b5237d2fb13926665f200e69bf4afe5b95898..3dceb5e1f833ac00f4311247aa19d050cd84cfdb 100644 (file)
@@ -14,4 +14,4 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 set test_slice 6
-source $srcdir/$subdir/all-architectures.exp.in
+source $srcdir/$subdir/all-architectures.exp.tcl
index 2d0705b384bfcfbf83115c706eef164abc94d546..ba7640ce44ca83ba6967865f15694d643cab7493 100644 (file)
@@ -14,4 +14,4 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 set test_slice 7
-source $srcdir/$subdir/all-architectures.exp.in
+source $srcdir/$subdir/all-architectures.exp.tcl
diff --git a/gdb/testsuite/gdb.base/all-architectures.exp.in b/gdb/testsuite/gdb.base/all-architectures.exp.in
deleted file mode 100644 (file)
index ebdd344..0000000
+++ /dev/null
@@ -1,341 +0,0 @@
-# Copyright (C) 2016-2020 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/>.
-
-# This file is part of the gdb testsuite.
-
-# Test manually setting _all_ combinations of all supported bfd
-# architectures and OS ABIs.  This ensures that gdbarch initialization
-# routines handle unusual combinations gracefully, at least without
-# crashing.
-
-# While at it, because the number of possible combinations is quite
-# large, embed other checks that might be useful to do with all
-# supported archs.
-
-# One such test is ensuring that printing float, double and long
-# double types works in cross/bi-arch scenarios.  Some of GDB's float
-# format conversion routines used to fail to consider that even if
-# host and target floating formats match, their sizes may still
-# differ.  E.g., on x86, long double is 80-bit extended precision on
-# both 32-bit vs 64-bit, but it's stored as 96 bit on 32-bit, and 128
-# bit on 64-bit.  This resulted in GDB accessing memory out of bounds.
-# This test catches the issue when run against gdb linked with
-# libmcheck, or run under Valgrind.
-
-# Note: this test is actually split in several driver .exp files, in
-# order to be able to parallelize the work.  Each driver .exp file
-# exercises a different slice of the supported architectures.  See
-# all-architectures-*.exp and the TEST_SLICE variable.
-
-clean_restart
-
-# By default, preparation steps don't output a PASS message.  This is
-# because the testcase has several thousand such steps.
-set want_tests_messages 0
-
-# Call this when an "internal" preparation-like step test passed.
-# Logs the pass in gdb.log, but not in gdb.sum.
-
-proc internal_pass {message} {
-    global want_tests_messages
-
-    if {$want_tests_messages} {
-       pass $message
-    } else {
-       # Skip the sum file, but still log an internal pass in the log
-       # file.
-       global pf_prefix
-
-       verbose -log "IPASS: $pf_prefix $message"
-    }
-}
-
-# The number of times gdb_test_internal was called, and the number of
-# time that resulted in an internal pass.  If these don't match, then
-# some test failed.
-set test_count 0
-set internal_pass_count 0
-
-# Like gdb_test, but calls internal_pass instead of pass, on success.
-
-proc gdb_test_internal {cmd pattern {message ""}} {
-    global test_count internal_pass_count
-    global gdb_prompt
-
-    incr test_count
-
-    if {$message == ""} {
-       set message $cmd
-    }
-
-    gdb_test_multiple $cmd $message {
-       -re "$pattern\r\n$gdb_prompt $" {
-           internal_pass $message
-           incr internal_pass_count
-       }
-    }
-}
-
-gdb_test_internal "set max-completions unlimited" \
-    "^set max-completions unlimited"
-
-# Return a list of all the accepted values of "set WHAT".
-
-proc get_set_option_choices {what} {
-    global gdb_prompt
-
-    set values {}
-
-    set test "complete set $what"
-    gdb_test_multiple "complete set $what " "$test" {
-       -re "set $what (\[^\r\n\]+)\r\n" {
-           lappend values $expect_out(1,string)
-           exp_continue
-       }
-       -re "$gdb_prompt " {
-           internal_pass $test
-       }
-    }
-    return $values
-}
-
-set supported_archs [get_set_option_choices "architecture"]
-# There should be at least one more than "auto".
-gdb_assert {[llength $supported_archs] > 1} "at least one architecture"
-
-set supported_osabis [get_set_option_choices "osabi"]
-# There should be at least one more than "auto" and "default".
-gdb_assert {[llength $supported_osabis] > 2} "at least one osabi"
-
-if {[lsearch $supported_archs "mips"] >= 0} {
-    set supported_mipsfpu [get_set_option_choices "mipsfpu"]
-    set supported_mips_abi [get_set_option_choices "mips abi"]
-
-    gdb_assert {[llength $supported_mipsfpu] != 0} "at least one mipsfpu"
-    gdb_assert {[llength $supported_mips_abi] != 0} "at least one mips abi"
-}
-
-if {[lsearch $supported_archs "arm"] >= 0} {
-    set supported_arm_fpu [get_set_option_choices "arm fpu"]
-    set supported_arm_abi [get_set_option_choices "arm abi"]
-
-    gdb_assert {[llength $supported_arm_fpu] != 0} "at least one arm fpu"
-    gdb_assert {[llength $supported_arm_abi] != 0} "at least one arm abi"
-}
-
-# Exercise printing float, double and long double.
-
-proc print_floats {} {
-    gdb_test_internal "ptype 1.0L" "type = long double" "ptype, long double"
-    gdb_test_internal "print 1.0L" " = 1" "print, long double"
-
-    gdb_test_internal "ptype 1.0" "type = double" "ptype, double"
-    gdb_test_internal "print 1.0" " = 1" "print, double"
-
-    gdb_test_internal "ptype 1.0f" "type = float" "ptype, float"
-    gdb_test_internal "print 1.0f" " = 1" "print, float"
-}
-
-# Run tests on the current architecture.
-
-proc do_arch_tests {} {
-    print_floats
-
-    # GDB can't access memory because there is no loaded executable
-    # nor live inferior.
-    gdb_test_internal "disassemble 0x0,+4" \
-       "Cannot access memory at address 0x0"
-}
-
-# Given we can't change arch, osabi, endianness, etc. atomically, we
-# need to silently ignore the case of the current OS ABI (not the one
-# we'll switch to) not having a handler for the arch.
-set osabi_warning \
-    [multi_line \
-        "warning: A handler for the OS ABI .* is not built into this configuration" \
-        "of GDB.  Attempting to continue with the default .* settings." \
-        "" \
-        "" \
-       ]
-
-set endian_warning "(Little|Big) endian target not supported by GDB\r\n"
-
-# Like gdb_test_no_output, but use internal_pass instead of pass, and
-# ignore "no handler for OS ABI" warnings.
-
-proc gdb_test_no_output_osabi {cmd test} {
-    global osabi_warning
-    global gdb_prompt
-
-    gdb_test_multiple "$cmd" $test {
-       -re "^${cmd}\r\n(${osabi_warning})?$gdb_prompt $" {
-           internal_pass $test
-       }
-    }
-}
-
-# It'd be nicer/safer to restart GDB on each iteration, but, that
-# increases the testcase's run time several times fold.  At the time
-# of writting, it'd jump from 20s to 4min on x86-64 GNU/Linux with
-# --enable-targets=all.
-
-set num_slices 8
-set num_archs [llength $supported_archs]
-set archs_per_slice [expr (($num_archs + $num_slices - 1) / $num_slices)]
-
-with_test_prefix "tests" {
-    foreach_with_prefix osabi $supported_osabis {
-
-       gdb_test_no_output_osabi "set osabi $osabi" \
-           "set osabi"
-
-       set arch_count 0
-       foreach_with_prefix arch $supported_archs {
-
-           incr arch_count
-
-           # Skip architectures outside our slice.
-           if {$arch_count < [expr $test_slice * $archs_per_slice]} {
-               continue
-           }
-           if {$arch_count >= [expr ($test_slice + 1) * $archs_per_slice]} {
-               continue
-           }
-
-           if {$arch == "auto"} {
-               continue
-           }
-           set default_endian ""
-           foreach_with_prefix endian {"auto" "big" "little"} {
-
-               set test "set endian"
-               if {$endian == $default_endian} {
-                   continue
-               } elseif {$endian == "auto"} {
-                   gdb_test_multiple "set endian $endian" $test {
-                       -re "^set endian $endian\r\n(${osabi_warning})?The target endianness is set automatically \\(currently .* endian\\)\r\n$gdb_prompt $" {
-                           internal_pass $test
-                       }
-                   }
-               } else {
-                   gdb_test_multiple "set endian $endian" $test {
-                       -re "^set endian $endian\r\n${endian_warning}.*\r\n$gdb_prompt $" {
-                           internal_pass $test
-                           continue
-                       }
-                       -re "^set endian $endian\r\n(${osabi_warning})?The target is assumed to be $endian endian\r\n$gdb_prompt $" {
-                           internal_pass $test
-                       }
-                   }
-               }
-
-               # Skip setting the same architecture again.
-               if {$endian == "auto"} {
-                   set arch_re [string_to_regexp $arch]
-                   set test "set architecture $arch"
-                   gdb_test_multiple $test $test {
-                       -re "^set architecture $arch_re\r\n(${osabi_warning})?The target architecture is assumed to be $arch_re\r\n$gdb_prompt $" {
-                           internal_pass $test
-                       }
-                       -re "Architecture .* not recognized.*$gdb_prompt $" {
-                           # GDB is missing support for a few
-                           # machines that bfd supports.
-                           if  {$arch == "powerpc:EC603e"
-                                || $arch == "powerpc:e500mc"
-                                || $arch == "powerpc:e500mc64"
-                                || $arch == "powerpc:vle"
-                                || $arch == "powerpc:titan"
-                                || $arch == "powerpc:e5500"
-                                || $arch == "powerpc:e6500"} {
-                               if {$want_tests_messages} {
-                                   kfail $test "gdb/19797"
-                               }
-                           } else {
-                               fail "$test (arch not recognized)"
-                           }
-                           continue
-                       }
-                   }
-
-                   # Record what is the default endianess.  As an
-                   # optimization, we'll skip testing the manual "set
-                   # endian DEFAULT" case.
-                   set test "show endian"
-                   gdb_test_multiple "show endian" $test {
-                       -re "currently little endian.*$gdb_prompt $" {
-                           set default_endian "little"
-                           internal_pass $test
-                       }
-                       -re "currently big endian.*$gdb_prompt $" {
-                           set default_endian "big"
-                           internal_pass $test
-                       }
-                   }
-               }
-
-               # Some architectures have extra settings that affect
-               # the ABI.  Specify the extra testing axes in a
-               # declarative form.
-               #
-               # A list of {COMMAND, VAR, OPTIONS-LIST} elements.
-               set all_axes {}
-
-               if {$arch == "mips"} {
-                   lappend all_axes [list "set mips abi" mips_abi $supported_mips_abi]
-                   lappend all_axes [list "set mipsfpu" mipsfpu $supported_mipsfpu]
-               } elseif {$arch == "arm"} {
-                   lappend all_axes [list "set arm abi" arm_abi $supported_arm_abi]
-                   lappend all_axes [list "set arm fpu" arm_fpu $supported_arm_fpu]
-               }
-
-               # Run testing axis CUR_AXIS.  This is a recursive
-               # procedure that tries all combinations of options of
-               # all the testing axes.
-               proc run_axis {all_axes cur_axis} {
-                   if {$cur_axis == [llength $all_axes]} {
-                       do_arch_tests
-                       return
-                   }
-
-                   # Unpack the axis.
-                   set axis [lindex $all_axes $cur_axis]
-                   set cmd [lindex $axis 0]
-                   set var [lindex $axis 1]
-                   set options [lindex $axis 2]
-
-                   foreach v $options {
-                       with_test_prefix "$var=$v" {
-                           gdb_test_no_output_osabi "$cmd $v" "$cmd"
-                           run_axis $all_axes [expr $cur_axis + 1]
-                       }
-                   }
-               }
-
-               run_axis $all_axes 0
-           }
-       }
-    }
-}
-
-# A test that:
-#
-#  - ensures there's a PASS if all internal tests actually passed
-#
-#  - ensures there's at least one test that is interpreted as a
-#    regression (a matching PASS->FAIL) if some of the internal tests
-#    failed, instead of looking like it could be a new FAIL that could
-#    be ignored.
-#
-gdb_assert {$internal_pass_count == $test_count} "all passed"
diff --git a/gdb/testsuite/gdb.base/all-architectures.exp.tcl b/gdb/testsuite/gdb.base/all-architectures.exp.tcl
new file mode 100644 (file)
index 0000000..ebdd344
--- /dev/null
@@ -0,0 +1,341 @@
+# Copyright (C) 2016-2020 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/>.
+
+# This file is part of the gdb testsuite.
+
+# Test manually setting _all_ combinations of all supported bfd
+# architectures and OS ABIs.  This ensures that gdbarch initialization
+# routines handle unusual combinations gracefully, at least without
+# crashing.
+
+# While at it, because the number of possible combinations is quite
+# large, embed other checks that might be useful to do with all
+# supported archs.
+
+# One such test is ensuring that printing float, double and long
+# double types works in cross/bi-arch scenarios.  Some of GDB's float
+# format conversion routines used to fail to consider that even if
+# host and target floating formats match, their sizes may still
+# differ.  E.g., on x86, long double is 80-bit extended precision on
+# both 32-bit vs 64-bit, but it's stored as 96 bit on 32-bit, and 128
+# bit on 64-bit.  This resulted in GDB accessing memory out of bounds.
+# This test catches the issue when run against gdb linked with
+# libmcheck, or run under Valgrind.
+
+# Note: this test is actually split in several driver .exp files, in
+# order to be able to parallelize the work.  Each driver .exp file
+# exercises a different slice of the supported architectures.  See
+# all-architectures-*.exp and the TEST_SLICE variable.
+
+clean_restart
+
+# By default, preparation steps don't output a PASS message.  This is
+# because the testcase has several thousand such steps.
+set want_tests_messages 0
+
+# Call this when an "internal" preparation-like step test passed.
+# Logs the pass in gdb.log, but not in gdb.sum.
+
+proc internal_pass {message} {
+    global want_tests_messages
+
+    if {$want_tests_messages} {
+       pass $message
+    } else {
+       # Skip the sum file, but still log an internal pass in the log
+       # file.
+       global pf_prefix
+
+       verbose -log "IPASS: $pf_prefix $message"
+    }
+}
+
+# The number of times gdb_test_internal was called, and the number of
+# time that resulted in an internal pass.  If these don't match, then
+# some test failed.
+set test_count 0
+set internal_pass_count 0
+
+# Like gdb_test, but calls internal_pass instead of pass, on success.
+
+proc gdb_test_internal {cmd pattern {message ""}} {
+    global test_count internal_pass_count
+    global gdb_prompt
+
+    incr test_count
+
+    if {$message == ""} {
+       set message $cmd
+    }
+
+    gdb_test_multiple $cmd $message {
+       -re "$pattern\r\n$gdb_prompt $" {
+           internal_pass $message
+           incr internal_pass_count
+       }
+    }
+}
+
+gdb_test_internal "set max-completions unlimited" \
+    "^set max-completions unlimited"
+
+# Return a list of all the accepted values of "set WHAT".
+
+proc get_set_option_choices {what} {
+    global gdb_prompt
+
+    set values {}
+
+    set test "complete set $what"
+    gdb_test_multiple "complete set $what " "$test" {
+       -re "set $what (\[^\r\n\]+)\r\n" {
+           lappend values $expect_out(1,string)
+           exp_continue
+       }
+       -re "$gdb_prompt " {
+           internal_pass $test
+       }
+    }
+    return $values
+}
+
+set supported_archs [get_set_option_choices "architecture"]
+# There should be at least one more than "auto".
+gdb_assert {[llength $supported_archs] > 1} "at least one architecture"
+
+set supported_osabis [get_set_option_choices "osabi"]
+# There should be at least one more than "auto" and "default".
+gdb_assert {[llength $supported_osabis] > 2} "at least one osabi"
+
+if {[lsearch $supported_archs "mips"] >= 0} {
+    set supported_mipsfpu [get_set_option_choices "mipsfpu"]
+    set supported_mips_abi [get_set_option_choices "mips abi"]
+
+    gdb_assert {[llength $supported_mipsfpu] != 0} "at least one mipsfpu"
+    gdb_assert {[llength $supported_mips_abi] != 0} "at least one mips abi"
+}
+
+if {[lsearch $supported_archs "arm"] >= 0} {
+    set supported_arm_fpu [get_set_option_choices "arm fpu"]
+    set supported_arm_abi [get_set_option_choices "arm abi"]
+
+    gdb_assert {[llength $supported_arm_fpu] != 0} "at least one arm fpu"
+    gdb_assert {[llength $supported_arm_abi] != 0} "at least one arm abi"
+}
+
+# Exercise printing float, double and long double.
+
+proc print_floats {} {
+    gdb_test_internal "ptype 1.0L" "type = long double" "ptype, long double"
+    gdb_test_internal "print 1.0L" " = 1" "print, long double"
+
+    gdb_test_internal "ptype 1.0" "type = double" "ptype, double"
+    gdb_test_internal "print 1.0" " = 1" "print, double"
+
+    gdb_test_internal "ptype 1.0f" "type = float" "ptype, float"
+    gdb_test_internal "print 1.0f" " = 1" "print, float"
+}
+
+# Run tests on the current architecture.
+
+proc do_arch_tests {} {
+    print_floats
+
+    # GDB can't access memory because there is no loaded executable
+    # nor live inferior.
+    gdb_test_internal "disassemble 0x0,+4" \
+       "Cannot access memory at address 0x0"
+}
+
+# Given we can't change arch, osabi, endianness, etc. atomically, we
+# need to silently ignore the case of the current OS ABI (not the one
+# we'll switch to) not having a handler for the arch.
+set osabi_warning \
+    [multi_line \
+        "warning: A handler for the OS ABI .* is not built into this configuration" \
+        "of GDB.  Attempting to continue with the default .* settings." \
+        "" \
+        "" \
+       ]
+
+set endian_warning "(Little|Big) endian target not supported by GDB\r\n"
+
+# Like gdb_test_no_output, but use internal_pass instead of pass, and
+# ignore "no handler for OS ABI" warnings.
+
+proc gdb_test_no_output_osabi {cmd test} {
+    global osabi_warning
+    global gdb_prompt
+
+    gdb_test_multiple "$cmd" $test {
+       -re "^${cmd}\r\n(${osabi_warning})?$gdb_prompt $" {
+           internal_pass $test
+       }
+    }
+}
+
+# It'd be nicer/safer to restart GDB on each iteration, but, that
+# increases the testcase's run time several times fold.  At the time
+# of writting, it'd jump from 20s to 4min on x86-64 GNU/Linux with
+# --enable-targets=all.
+
+set num_slices 8
+set num_archs [llength $supported_archs]
+set archs_per_slice [expr (($num_archs + $num_slices - 1) / $num_slices)]
+
+with_test_prefix "tests" {
+    foreach_with_prefix osabi $supported_osabis {
+
+       gdb_test_no_output_osabi "set osabi $osabi" \
+           "set osabi"
+
+       set arch_count 0
+       foreach_with_prefix arch $supported_archs {
+
+           incr arch_count
+
+           # Skip architectures outside our slice.
+           if {$arch_count < [expr $test_slice * $archs_per_slice]} {
+               continue
+           }
+           if {$arch_count >= [expr ($test_slice + 1) * $archs_per_slice]} {
+               continue
+           }
+
+           if {$arch == "auto"} {
+               continue
+           }
+           set default_endian ""
+           foreach_with_prefix endian {"auto" "big" "little"} {
+
+               set test "set endian"
+               if {$endian == $default_endian} {
+                   continue
+               } elseif {$endian == "auto"} {
+                   gdb_test_multiple "set endian $endian" $test {
+                       -re "^set endian $endian\r\n(${osabi_warning})?The target endianness is set automatically \\(currently .* endian\\)\r\n$gdb_prompt $" {
+                           internal_pass $test
+                       }
+                   }
+               } else {
+                   gdb_test_multiple "set endian $endian" $test {
+                       -re "^set endian $endian\r\n${endian_warning}.*\r\n$gdb_prompt $" {
+                           internal_pass $test
+                           continue
+                       }
+                       -re "^set endian $endian\r\n(${osabi_warning})?The target is assumed to be $endian endian\r\n$gdb_prompt $" {
+                           internal_pass $test
+                       }
+                   }
+               }
+
+               # Skip setting the same architecture again.
+               if {$endian == "auto"} {
+                   set arch_re [string_to_regexp $arch]
+                   set test "set architecture $arch"
+                   gdb_test_multiple $test $test {
+                       -re "^set architecture $arch_re\r\n(${osabi_warning})?The target architecture is assumed to be $arch_re\r\n$gdb_prompt $" {
+                           internal_pass $test
+                       }
+                       -re "Architecture .* not recognized.*$gdb_prompt $" {
+                           # GDB is missing support for a few
+                           # machines that bfd supports.
+                           if  {$arch == "powerpc:EC603e"
+                                || $arch == "powerpc:e500mc"
+                                || $arch == "powerpc:e500mc64"
+                                || $arch == "powerpc:vle"
+                                || $arch == "powerpc:titan"
+                                || $arch == "powerpc:e5500"
+                                || $arch == "powerpc:e6500"} {
+                               if {$want_tests_messages} {
+                                   kfail $test "gdb/19797"
+                               }
+                           } else {
+                               fail "$test (arch not recognized)"
+                           }
+                           continue
+                       }
+                   }
+
+                   # Record what is the default endianess.  As an
+                   # optimization, we'll skip testing the manual "set
+                   # endian DEFAULT" case.
+                   set test "show endian"
+                   gdb_test_multiple "show endian" $test {
+                       -re "currently little endian.*$gdb_prompt $" {
+                           set default_endian "little"
+                           internal_pass $test
+                       }
+                       -re "currently big endian.*$gdb_prompt $" {
+                           set default_endian "big"
+                           internal_pass $test
+                       }
+                   }
+               }
+
+               # Some architectures have extra settings that affect
+               # the ABI.  Specify the extra testing axes in a
+               # declarative form.
+               #
+               # A list of {COMMAND, VAR, OPTIONS-LIST} elements.
+               set all_axes {}
+
+               if {$arch == "mips"} {
+                   lappend all_axes [list "set mips abi" mips_abi $supported_mips_abi]
+                   lappend all_axes [list "set mipsfpu" mipsfpu $supported_mipsfpu]
+               } elseif {$arch == "arm"} {
+                   lappend all_axes [list "set arm abi" arm_abi $supported_arm_abi]
+                   lappend all_axes [list "set arm fpu" arm_fpu $supported_arm_fpu]
+               }
+
+               # Run testing axis CUR_AXIS.  This is a recursive
+               # procedure that tries all combinations of options of
+               # all the testing axes.
+               proc run_axis {all_axes cur_axis} {
+                   if {$cur_axis == [llength $all_axes]} {
+                       do_arch_tests
+                       return
+                   }
+
+                   # Unpack the axis.
+                   set axis [lindex $all_axes $cur_axis]
+                   set cmd [lindex $axis 0]
+                   set var [lindex $axis 1]
+                   set options [lindex $axis 2]
+
+                   foreach v $options {
+                       with_test_prefix "$var=$v" {
+                           gdb_test_no_output_osabi "$cmd $v" "$cmd"
+                           run_axis $all_axes [expr $cur_axis + 1]
+                       }
+                   }
+               }
+
+               run_axis $all_axes 0
+           }
+       }
+    }
+}
+
+# A test that:
+#
+#  - ensures there's a PASS if all internal tests actually passed
+#
+#  - ensures there's at least one test that is interpreted as a
+#    regression (a matching PASS->FAIL) if some of the internal tests
+#    failed, instead of looking like it could be a new FAIL that could
+#    be ignored.
+#
+gdb_assert {$internal_pass_count == $test_count} "all passed"
index 9da0621384efdd9c968caa8f70d5db76ceff22f3..4741e0dade4cdb0b3d3bc49883acca10f17e1d95 100644 (file)
@@ -21,4 +21,4 @@ if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
 }
 set lang c++
 
-source $srcdir/$subdir/infcall-nested-structs.exp.in
+source $srcdir/$subdir/infcall-nested-structs.exp.tcl
index a715c5bd0d2880fa196f815210b48a089419d30a..1e876e331a4ba913c43783d36ed0fb52508c0302 100644 (file)
@@ -17,4 +17,4 @@
 
 set lang {c}
 
-source $srcdir/$subdir/infcall-nested-structs.exp.in
+source $srcdir/$subdir/infcall-nested-structs.exp.tcl
diff --git a/gdb/testsuite/gdb.base/infcall-nested-structs.exp.in b/gdb/testsuite/gdb.base/infcall-nested-structs.exp.in
deleted file mode 100644 (file)
index f740961..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-# This testcase is part of GDB, the GNU debugger.
-
-# Copyright 2018-2020 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/>.
-
-# Some targets can't call functions, so don't even bother with this
-# test.
-
-if [target_info exists gdb,cannot_call_functions] {
-    unsupported "this target can not call functions"
-    continue
-}
-
-set int_types { tc ts ti tl tll }
-set float_types { tf td tld }
-set complex_types { tfc tdc tldc }
-
-set compile_flags {debug}
-if [support_complex_tests] {
-    lappend compile_flags "additional_flags=-DTEST_COMPLEX"
-    lappend compile_flags "additional_flags=-Wno-psabi"
-}
-
-# Given N (0..25), return the corresponding alphabetic letter in upper
-# case.
-
-proc I2A { n } {
-    return [string range "ABCDEFGHIJKLMNOPQRSTUVWXYZ" $n $n]
-}
-
-# Compile a variant of nested-structs.c using TYPES to specify the
-# types of the struct fields within the source.  Run up to main.
-# Also updates the global "testfile" to reflect the most recent build.
-
-proc start_nested_structs_test { lang types } {
-    global testfile
-    global srcfile
-    global binfile
-    global subdir
-    global srcdir
-    global compile_flags
-
-    standard_testfile infcall-nested-structs.c
-
-    # Create the additional flags
-    set flags $compile_flags
-    lappend flags $lang
-    lappend flags "additional_flags=-O2"
-
-    for {set n 0} {$n<[llength ${types}]} {incr n} {
-       set m [I2A ${n}]
-       set t [lindex ${types} $n]
-       lappend flags "additional_flags=-Dt${m}=${t}"
-       append testfile "-" "$t"
-    }
-
-    if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "${flags}"] != "" } {
-       unresolved "failed to compile"
-       return 0
-    }
-
-    # Start with a fresh gdb.
-    clean_restart ${binfile}
-
-    # Make certain that the output is consistent
-    gdb_test_no_output "set print sevenbit-strings"
-    gdb_test_no_output "set print address off"
-    gdb_test_no_output "set print pretty off"
-    gdb_test_no_output "set width 0"
-    gdb_test_no_output "set print elements 300"
-
-    # Advance to main
-    if { ![runto_main] } then {
-       fail "can't run to main"
-       return 0
-    }
-
-    # Now continue forward to a suitable location to run the tests.
-    # Some targets only enable the FPU on first use, so ensure that we
-    # have used the FPU before we make calls from GDB to code that
-    # could use the FPU.
-    gdb_breakpoint [gdb_get_line_number "Break Here"] temporary
-    gdb_continue_to_breakpoint "breakpt" ".* Break Here\\. .*"
-
-    return 1
-}
-
-# Assuming GDB is stopped at main within a test binary, run some tests
-# passing structures, and reading return value structures.
-
-proc run_tests { lang types } {
-    global gdb_prompt
-
-    foreach {name} {struct_01_01 struct_01_02 struct_01_03 struct_01_04
-                    struct_02_01 struct_02_02 struct_02_03 struct_02_04
-                    struct_04_01 struct_04_02 struct_04_03 struct_04_04
-                    struct_05_01 struct_05_02 struct_05_03 struct_05_04
-                    struct_static_02_01 struct_static_02_02 struct_static_02_03 struct_static_02_04
-                    struct_static_04_01 struct_static_04_02 struct_static_04_03 struct_static_04_04
-                    struct_static_06_01 struct_static_06_02 struct_static_06_03 struct_static_06_04} {
-
-       # Only run static member tests on C++
-       if { $lang == "c" && [regexp "static" $name match] } {
-           continue
-       }
-
-       gdb_test "p/d check_arg_${name} (ref_val_${name})" "= 1"
-
-       set refval [ get_valueof "" "ref_val_${name}" "" ]
-       verbose -log "Refval: ${refval}"
-
-       set test "check return value ${name}"
-       if { ${refval} != "" } {
-
-           set answer [ get_valueof "" "rtn_str_${name} ()" "XXXX"]
-           verbose -log "Answer: ${answer}"
-
-           gdb_assert [string eq ${answer} ${refval}] ${test}
-       } else {
-           unresolved $test
-       }
-    }
-}
-
-# Set up a test prefix, compile the test binary, run to main, and then
-# run some tests.
-
-proc start_gdb_and_run_tests { lang types } {
-    set prefix "types"
-
-    foreach t $types {
-       append prefix "-" "${t}"
-    }
-
-    with_test_prefix $prefix {
-       if { [start_nested_structs_test $lang $types] } {
-           run_tests $lang $prefix
-       }
-    }
-}
-
-foreach ta $int_types {
-    start_gdb_and_run_tests $lang $ta
-}
-
-if [support_complex_tests] {
-    foreach ta $complex_types {
-       start_gdb_and_run_tests $lang $ta
-    }
-}
-
-if ![gdb_skip_float_test] {
-    foreach ta $float_types {
-       start_gdb_and_run_tests $lang $ta
-    }
-
-    foreach ta $int_types {
-       foreach tb $float_types {
-           start_gdb_and_run_tests $lang [list $ta $tb]
-       }
-    }
-
-    foreach ta $float_types {
-       foreach tb $int_types {
-           start_gdb_and_run_tests $lang [list $ta $tb]
-       }
-
-       foreach tb $float_types {
-           start_gdb_and_run_tests $lang [list $ta $tb]
-       }
-    }
-}
diff --git a/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl b/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl
new file mode 100644 (file)
index 0000000..f740961
--- /dev/null
@@ -0,0 +1,184 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2018-2020 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/>.
+
+# Some targets can't call functions, so don't even bother with this
+# test.
+
+if [target_info exists gdb,cannot_call_functions] {
+    unsupported "this target can not call functions"
+    continue
+}
+
+set int_types { tc ts ti tl tll }
+set float_types { tf td tld }
+set complex_types { tfc tdc tldc }
+
+set compile_flags {debug}
+if [support_complex_tests] {
+    lappend compile_flags "additional_flags=-DTEST_COMPLEX"
+    lappend compile_flags "additional_flags=-Wno-psabi"
+}
+
+# Given N (0..25), return the corresponding alphabetic letter in upper
+# case.
+
+proc I2A { n } {
+    return [string range "ABCDEFGHIJKLMNOPQRSTUVWXYZ" $n $n]
+}
+
+# Compile a variant of nested-structs.c using TYPES to specify the
+# types of the struct fields within the source.  Run up to main.
+# Also updates the global "testfile" to reflect the most recent build.
+
+proc start_nested_structs_test { lang types } {
+    global testfile
+    global srcfile
+    global binfile
+    global subdir
+    global srcdir
+    global compile_flags
+
+    standard_testfile infcall-nested-structs.c
+
+    # Create the additional flags
+    set flags $compile_flags
+    lappend flags $lang
+    lappend flags "additional_flags=-O2"
+
+    for {set n 0} {$n<[llength ${types}]} {incr n} {
+       set m [I2A ${n}]
+       set t [lindex ${types} $n]
+       lappend flags "additional_flags=-Dt${m}=${t}"
+       append testfile "-" "$t"
+    }
+
+    if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "${flags}"] != "" } {
+       unresolved "failed to compile"
+       return 0
+    }
+
+    # Start with a fresh gdb.
+    clean_restart ${binfile}
+
+    # Make certain that the output is consistent
+    gdb_test_no_output "set print sevenbit-strings"
+    gdb_test_no_output "set print address off"
+    gdb_test_no_output "set print pretty off"
+    gdb_test_no_output "set width 0"
+    gdb_test_no_output "set print elements 300"
+
+    # Advance to main
+    if { ![runto_main] } then {
+       fail "can't run to main"
+       return 0
+    }
+
+    # Now continue forward to a suitable location to run the tests.
+    # Some targets only enable the FPU on first use, so ensure that we
+    # have used the FPU before we make calls from GDB to code that
+    # could use the FPU.
+    gdb_breakpoint [gdb_get_line_number "Break Here"] temporary
+    gdb_continue_to_breakpoint "breakpt" ".* Break Here\\. .*"
+
+    return 1
+}
+
+# Assuming GDB is stopped at main within a test binary, run some tests
+# passing structures, and reading return value structures.
+
+proc run_tests { lang types } {
+    global gdb_prompt
+
+    foreach {name} {struct_01_01 struct_01_02 struct_01_03 struct_01_04
+                    struct_02_01 struct_02_02 struct_02_03 struct_02_04
+                    struct_04_01 struct_04_02 struct_04_03 struct_04_04
+                    struct_05_01 struct_05_02 struct_05_03 struct_05_04
+                    struct_static_02_01 struct_static_02_02 struct_static_02_03 struct_static_02_04
+                    struct_static_04_01 struct_static_04_02 struct_static_04_03 struct_static_04_04
+                    struct_static_06_01 struct_static_06_02 struct_static_06_03 struct_static_06_04} {
+
+       # Only run static member tests on C++
+       if { $lang == "c" && [regexp "static" $name match] } {
+           continue
+       }
+
+       gdb_test "p/d check_arg_${name} (ref_val_${name})" "= 1"
+
+       set refval [ get_valueof "" "ref_val_${name}" "" ]
+       verbose -log "Refval: ${refval}"
+
+       set test "check return value ${name}"
+       if { ${refval} != "" } {
+
+           set answer [ get_valueof "" "rtn_str_${name} ()" "XXXX"]
+           verbose -log "Answer: ${answer}"
+
+           gdb_assert [string eq ${answer} ${refval}] ${test}
+       } else {
+           unresolved $test
+       }
+    }
+}
+
+# Set up a test prefix, compile the test binary, run to main, and then
+# run some tests.
+
+proc start_gdb_and_run_tests { lang types } {
+    set prefix "types"
+
+    foreach t $types {
+       append prefix "-" "${t}"
+    }
+
+    with_test_prefix $prefix {
+       if { [start_nested_structs_test $lang $types] } {
+           run_tests $lang $prefix
+       }
+    }
+}
+
+foreach ta $int_types {
+    start_gdb_and_run_tests $lang $ta
+}
+
+if [support_complex_tests] {
+    foreach ta $complex_types {
+       start_gdb_and_run_tests $lang $ta
+    }
+}
+
+if ![gdb_skip_float_test] {
+    foreach ta $float_types {
+       start_gdb_and_run_tests $lang $ta
+    }
+
+    foreach ta $int_types {
+       foreach tb $float_types {
+           start_gdb_and_run_tests $lang [list $ta $tb]
+       }
+    }
+
+    foreach ta $float_types {
+       foreach tb $int_types {
+           start_gdb_and_run_tests $lang [list $ta $tb]
+       }
+
+       foreach tb $float_types {
+           start_gdb_and_run_tests $lang [list $ta $tb]
+       }
+    }
+}
index 4f44369fe98cc6b24e05985dcf1f01982943273c..587a39f55fecf4bebc68c128894acf6305ccf038 100644 (file)
@@ -19,4 +19,4 @@ if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
 }
 set lang c++
 
-source $srcdir/$subdir/info-types.exp.in
+source $srcdir/$subdir/info-types.exp.tcl
index 800d6389a4bdfa6e80c1659e9c6a56788dd7734b..0b6e81d5b2b998a322298c991e221890f5132827 100644 (file)
@@ -15,4 +15,4 @@
 
 set lang {c}
 
-source $srcdir/$subdir/info-types.exp.in
+source $srcdir/$subdir/info-types.exp.tcl
diff --git a/gdb/testsuite/gdb.base/info-types.exp.in b/gdb/testsuite/gdb.base/info-types.exp.in
deleted file mode 100644 (file)
index 8c065b1..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-# Copyright 2019-2020 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/>.
-
-# Check that 'info types' produces the expected output for an inferior
-# containing a number of different types.
-
-# Run 'info types' test, compiling the test file for language LANG,
-# which should be either 'c' or 'c++'.
-proc run_test { lang } {
-    global testfile
-    global srcfile
-    global binfile
-    global subdir
-    global srcdir
-    global compile_flags
-
-    standard_testfile info-types.c
-
-    if {[prepare_for_testing "failed to prepare" \
-            "${testfile}" $srcfile "debug $lang"]} {
-       return -1
-    }
-
-    if ![runto_main] then {
-       fail "can't run to main"
-       return 0
-    }
-
-    if { $lang == "c++" } {
-       set output_re \
-           [multi_line \
-                "98:\[\t \]+CL;" \
-                "42:\[\t \]+anon_struct_t;" \
-                "65:\[\t \]+anon_union_t;" \
-                "21:\[\t \]+baz_t;" \
-                "33:\[\t \]+enum_t;" \
-                "56:\[\t \]+union_t;" \
-                "52:\[\t \]+typedef enum {\\.\\.\\.} anon_enum_t;" \
-                "45:\[\t \]+typedef anon_struct_t anon_struct_t;" \
-                "68:\[\t \]+typedef anon_union_t anon_union_t;" \
-                "28:\[\t \]+typedef baz_t baz;" \
-                "31:\[\t \]+typedef baz_t \\* baz_ptr;" \
-                "27:\[\t \]+typedef baz_t baz_t;" \
-                "\[\t \]+double" \
-                "\[\t \]+float" \
-                "\[\t \]+int" \
-                "103:\[\t \]+typedef CL my_cl;" \
-                "38:\[\t \]+typedef enum_t my_enum_t;" \
-                "17:\[\t \]+typedef float my_float_t;" \
-                "16:\[\t \]+typedef int my_int_t;" \
-                "104:\[\t \]+typedef CL \\* my_ptr;" \
-                "54:\[\t \]+typedef enum {\\.\\.\\.} nested_anon_enum_t;" \
-                "47:\[\t \]+typedef anon_struct_t nested_anon_struct_t;" \
-                "70:\[\t \]+typedef anon_union_t nested_anon_union_t;" \
-                "30:\[\t \]+typedef baz_t nested_baz;" \
-                "29:\[\t \]+typedef baz_t nested_baz_t;" \
-                "39:\[\t \]+typedef enum_t nested_enum_t;" \
-                "19:\[\t \]+typedef float nested_float_t;" \
-                "18:\[\t \]+typedef int nested_int_t;" \
-                "62:\[\t \]+typedef union_t nested_union_t;(" \
-                "\[\t \]+unsigned int)?"]
-    } else {
-       set output_re \
-           [multi_line \
-                "52:\[\t \]+typedef enum {\\.\\.\\.} anon_enum_t;" \
-                "45:\[\t \]+typedef struct {\\.\\.\\.} anon_struct_t;" \
-                "68:\[\t \]+typedef union {\\.\\.\\.} anon_union_t;" \
-                "28:\[\t \]+typedef struct baz_t baz;" \
-                "31:\[\t \]+typedef struct baz_t \\* baz_ptr;" \
-                "21:\[\t \]+struct baz_t;" \
-                "\[\t \]+double" \
-                "33:\[\t \]+enum enum_t;" \
-                "\[\t \]+float" \
-                "\[\t \]+int" \
-                "38:\[\t \]+typedef enum enum_t my_enum_t;" \
-                "17:\[\t \]+typedef float my_float_t;" \
-                "16:\[\t \]+typedef int my_int_t;" \
-                "54:\[\t \]+typedef enum {\\.\\.\\.} nested_anon_enum_t;" \
-                "47:\[\t \]+typedef struct {\\.\\.\\.} nested_anon_struct_t;" \
-                "70:\[\t \]+typedef union {\\.\\.\\.} nested_anon_union_t;" \
-                "30:\[\t \]+typedef struct baz_t nested_baz;" \
-                "29:\[\t \]+typedef struct baz_t nested_baz_t;" \
-                "39:\[\t \]+typedef enum enum_t nested_enum_t;" \
-                "19:\[\t \]+typedef float nested_float_t;" \
-                "18:\[\t \]+typedef int nested_int_t;" \
-                "62:\[\t \]+typedef union union_t nested_union_t;" \
-                "56:\[\t \]+union union_t;(" \
-                "\[\t \]+unsigned int)?"]
-    }
-
-    set state 0
-    gdb_test_multiple "info types" "" {
-       -re "\r\nAll defined types:" {
-           if { $state == 0 } { set state 1 }
-           exp_continue
-       }
-       -re "\r\n\r\nFile .*[string_to_regexp $srcfile]:" {
-           if { $state == 1 } { set state 2 }
-           exp_continue
-       }
-       -re $output_re {
-           if { $state == 2 } { set state 3 }
-           exp_continue
-       }
-       -re "\r\n\r\nFile \[^\r\n\]*:" {
-           exp_continue
-       }
-       -re -wrap "" {
-           if { $state == 3} {
-               pass $gdb_test_name
-           } else {
-               fail $gdb_test_name
-           }
-       }
-    }
-}
-
-run_test $lang
diff --git a/gdb/testsuite/gdb.base/info-types.exp.tcl b/gdb/testsuite/gdb.base/info-types.exp.tcl
new file mode 100644 (file)
index 0000000..8c065b1
--- /dev/null
@@ -0,0 +1,130 @@
+# Copyright 2019-2020 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/>.
+
+# Check that 'info types' produces the expected output for an inferior
+# containing a number of different types.
+
+# Run 'info types' test, compiling the test file for language LANG,
+# which should be either 'c' or 'c++'.
+proc run_test { lang } {
+    global testfile
+    global srcfile
+    global binfile
+    global subdir
+    global srcdir
+    global compile_flags
+
+    standard_testfile info-types.c
+
+    if {[prepare_for_testing "failed to prepare" \
+            "${testfile}" $srcfile "debug $lang"]} {
+       return -1
+    }
+
+    if ![runto_main] then {
+       fail "can't run to main"
+       return 0
+    }
+
+    if { $lang == "c++" } {
+       set output_re \
+           [multi_line \
+                "98:\[\t \]+CL;" \
+                "42:\[\t \]+anon_struct_t;" \
+                "65:\[\t \]+anon_union_t;" \
+                "21:\[\t \]+baz_t;" \
+                "33:\[\t \]+enum_t;" \
+                "56:\[\t \]+union_t;" \
+                "52:\[\t \]+typedef enum {\\.\\.\\.} anon_enum_t;" \
+                "45:\[\t \]+typedef anon_struct_t anon_struct_t;" \
+                "68:\[\t \]+typedef anon_union_t anon_union_t;" \
+                "28:\[\t \]+typedef baz_t baz;" \
+                "31:\[\t \]+typedef baz_t \\* baz_ptr;" \
+                "27:\[\t \]+typedef baz_t baz_t;" \
+                "\[\t \]+double" \
+                "\[\t \]+float" \
+                "\[\t \]+int" \
+                "103:\[\t \]+typedef CL my_cl;" \
+                "38:\[\t \]+typedef enum_t my_enum_t;" \
+                "17:\[\t \]+typedef float my_float_t;" \
+                "16:\[\t \]+typedef int my_int_t;" \
+                "104:\[\t \]+typedef CL \\* my_ptr;" \
+                "54:\[\t \]+typedef enum {\\.\\.\\.} nested_anon_enum_t;" \
+                "47:\[\t \]+typedef anon_struct_t nested_anon_struct_t;" \
+                "70:\[\t \]+typedef anon_union_t nested_anon_union_t;" \
+                "30:\[\t \]+typedef baz_t nested_baz;" \
+                "29:\[\t \]+typedef baz_t nested_baz_t;" \
+                "39:\[\t \]+typedef enum_t nested_enum_t;" \
+                "19:\[\t \]+typedef float nested_float_t;" \
+                "18:\[\t \]+typedef int nested_int_t;" \
+                "62:\[\t \]+typedef union_t nested_union_t;(" \
+                "\[\t \]+unsigned int)?"]
+    } else {
+       set output_re \
+           [multi_line \
+                "52:\[\t \]+typedef enum {\\.\\.\\.} anon_enum_t;" \
+                "45:\[\t \]+typedef struct {\\.\\.\\.} anon_struct_t;" \
+                "68:\[\t \]+typedef union {\\.\\.\\.} anon_union_t;" \
+                "28:\[\t \]+typedef struct baz_t baz;" \
+                "31:\[\t \]+typedef struct baz_t \\* baz_ptr;" \
+                "21:\[\t \]+struct baz_t;" \
+                "\[\t \]+double" \
+                "33:\[\t \]+enum enum_t;" \
+                "\[\t \]+float" \
+                "\[\t \]+int" \
+                "38:\[\t \]+typedef enum enum_t my_enum_t;" \
+                "17:\[\t \]+typedef float my_float_t;" \
+                "16:\[\t \]+typedef int my_int_t;" \
+                "54:\[\t \]+typedef enum {\\.\\.\\.} nested_anon_enum_t;" \
+                "47:\[\t \]+typedef struct {\\.\\.\\.} nested_anon_struct_t;" \
+                "70:\[\t \]+typedef union {\\.\\.\\.} nested_anon_union_t;" \
+                "30:\[\t \]+typedef struct baz_t nested_baz;" \
+                "29:\[\t \]+typedef struct baz_t nested_baz_t;" \
+                "39:\[\t \]+typedef enum enum_t nested_enum_t;" \
+                "19:\[\t \]+typedef float nested_float_t;" \
+                "18:\[\t \]+typedef int nested_int_t;" \
+                "62:\[\t \]+typedef union union_t nested_union_t;" \
+                "56:\[\t \]+union union_t;(" \
+                "\[\t \]+unsigned int)?"]
+    }
+
+    set state 0
+    gdb_test_multiple "info types" "" {
+       -re "\r\nAll defined types:" {
+           if { $state == 0 } { set state 1 }
+           exp_continue
+       }
+       -re "\r\n\r\nFile .*[string_to_regexp $srcfile]:" {
+           if { $state == 1 } { set state 2 }
+           exp_continue
+       }
+       -re $output_re {
+           if { $state == 2 } { set state 3 }
+           exp_continue
+       }
+       -re "\r\n\r\nFile \[^\r\n\]*:" {
+           exp_continue
+       }
+       -re -wrap "" {
+           if { $state == 3} {
+               pass $gdb_test_name
+           } else {
+               fail $gdb_test_name
+           }
+       }
+    }
+}
+
+run_test $lang
index b88b2c118d8503b919af4c2cdf4a688e56ee0762..9f732d004fceca04d4369020d3f43991f2432b0b 100644 (file)
@@ -19,4 +19,4 @@ if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
 }
 set lang c++
 
-source $srcdir/$subdir/max-depth.exp.in
+source $srcdir/$subdir/max-depth.exp.tcl
index 3bd93098d2cc6d1c9cb71f64cda5965406736200..765772087d6f28b2c35da680ec4a4ac5a233fd07 100644 (file)
@@ -15,4 +15,4 @@
 
 set lang {c}
 
-source $srcdir/$subdir/max-depth.exp.in
+source $srcdir/$subdir/max-depth.exp.tcl
diff --git a/gdb/testsuite/gdb.base/max-depth.exp.in b/gdb/testsuite/gdb.base/max-depth.exp.in
deleted file mode 100644 (file)
index 8c0d712..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-# Copyright 2019-2020 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/>.
-
-# Tests GDB's handling of 'set print max-depth'.
-
-proc compile_and_run_tests { lang } {
-    global testfile
-    global srcfile
-    global binfile
-    global hex
-
-    standard_testfile max-depth.c
-
-    # Create the additional flags.
-    set flags "debug"
-    lappend flags $lang
-    if { "$lang" == "c++" } {
-       lappend flags "additional_flags=-std=c++11"
-    }
-
-    if { [prepare_for_testing "failed to prepare" "${binfile}" "${srcfile}" "${flags}"] } {
-       return 0
-    }
-
-    # Advance to main.
-    if { ![runto_main] } then {
-       fail "can't run to main"
-       return 0
-    }
-
-    # The max-depth setting has no effect as the anonymous scopes are
-    # ignored and the members are aggregated into the parent scope.
-    gdb_print_expr_at_depths "s1" {"{...}" \
-                                      "{x = 0, y = 0}"\
-                                      "{x = 0, y = 0}"}
-
-    gdb_print_expr_at_depths "s2" {"{...}" \
-                                      "{x = 0, y = 0, {z = 0, a = 0}}" \
-                                      "{x = 0, y = 0, {z = 0, a = 0}}"}
-
-    gdb_print_expr_at_depths "s3" {"{...}" \
-                                      "{x = 0, y = 0, {z = 0, a = 0, {b = 0, c = 0}}}" \
-                                      "{x = 0, y = 0, {z = 0, a = 0, {b = 0, c = 0}}}" \
-                                      "{x = 0, y = 0, {z = 0, a = 0, {b = 0, c = 0}}}"}
-
-    # Increasing max-depth unfurls more of the object.
-    gdb_print_expr_at_depths "s4" {"{...}" \
-                                      "{x = 0, y = 0, l1 = {...}}" \
-                                      "{x = 0, y = 0, l1 = {x = 0, y = 0, l2 = {...}}}" \
-                                      "{x = 0, y = 0, l1 = {x = 0, y = 0, l2 = {x = 0, y = 0}}}"}
-
-    # Check handling of unions, in this case 'raw' is printed instead of
-    # just {...} as this is not useful.
-    gdb_print_expr_at_depths "s5" {"{...}" \
-                                      "{{raw = {...}, {x = 0, y = 0, z = 0}}}" \
-                                      "{{raw = \\{0, 0, 0\\}, {x = 0, y = 0, z = 0}}}"}
-
-    # Check handling of typedefs.
-    gdb_print_expr_at_depths "s6" {"{...}" \
-                                      "{{raw = {...}, {x = 0, y = 0, z = 0}}}" \
-                                      "{{raw = \\{0, 0, 0\\}, {x = 0, y = 0, z = 0}}}"}
-
-    # Multiple anonymous structures in parallel.
-    gdb_print_expr_at_depths "s7" {"{...}" \
-                                      "{{x = 0, y = 0}, {z = 0, a = 0}, {b = 0, c = 0}}" \
-                                      "{{x = 0, y = 0}, {z = 0, a = 0}, {b = 0, c = 0}}"}
-
-    # Flip flop between named and anonymous.  Expected to unfurl to the
-    # first non-anonymous type.
-    gdb_print_expr_at_depths "s8" {"{...}" \
-                                      "{x = 0, y = 0, d1 = {...}}" \
-                                      "{x = 0, y = 0, d1 = {z = 0, a = 0, {b = 0, c = 0}}}"}
-
-    # Imbalanced tree, this will unfurl one size more than the other as
-    # one side has more anonymous levels.
-    gdb_print_expr_at_depths "s9" {"{...}" \
-                                      "{x = 0, y = 0, {k = 0, j = 0, d1 = {...}}, d2 = {...}}" \
-                                      "{x = 0, y = 0, {k = 0, j = 0, d1 = {z = 0, a = 0, {b = 0, c = 0}}}, d2 = {z = 0, a = 0, {b = 0, c = 0}}}"}
-
-    # Arrays are treated as an extra level, while scalars are not.
-    gdb_print_expr_at_depths "s10" {"{...}" \
-                                       "{x = {...}, y = 0, {k = {...}, j = 0, d1 = {...}}, d2 = {...}}" \
-                                       "{x = \\{0, 0, 0, 0, 0, 0, 0, 0, 0, 0\\}, y = 0, {k = \\{0, 0, 0, 0, 0, 0, 0, 0, 0, 0\\}, j = 0, d1 = {z = 0, a = 0, {b = {...}, c = 0}}}, d2 = {z = 0, a = 0, {b = {...}, c = 0}}}" \
-                                       "{x = \\{0, 0, 0, 0, 0, 0, 0, 0, 0, 0\\}, y = 0, {k = \\{0, 0, 0, 0, 0, 0, 0, 0, 0, 0\\}, j = 0, d1 = {z = 0, a = 0, {b = \\{0, 0, 0, 0, 0, 0, 0, 0, 0, 0\\}, c = 0}}}, d2 = {z = 0, a = 0, {b = \\{0, 0, 0, 0, 0, 0, 0, 0, 0, 0\\}, c = 0}}}"}
-
-    # Strings are treated as scalars.
-    gdb_print_expr_at_depths "s11" {"{...}" \
-                                       "{x = 0, s = \"\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\", {z = 0, a = 0}}"}
-
-
-    if { $lang == "c++" } {
-       gdb_print_expr_at_depths "c1" {"{...}" \
-                                          "{c1 = 1}" }
-       gdb_print_expr_at_depths "c2" { "{...}" "{c2 = 2}" }
-       gdb_print_expr_at_depths "c3" { "{...}" \
-                                           "{<C2> = {...}, c3 = 3}" \
-                                           "{<C2> = {c2 = 2}, c3 = 3}" }
-       gdb_print_expr_at_depths "c4" { "{...}" "{c4 = 4}" }
-       gdb_print_expr_at_depths "c5" { "{...}" \
-                                           "{<C4> = {...}, c5 = 5}" \
-                                           "{<C4> = {c4 = 4}, c5 = 5}" }
-       gdb_print_expr_at_depths "c6" { "{...}" \
-                                           "{<C5> = {...}, c6 = 6}" \
-                                           "{<C5> = {<C4> = {...}, c5 = 5}, c6 = 6}" \
-                                           "{<C5> = {<C4> = {c4 = 4}, c5 = 5}, c6 = 6}" }
-       gdb_print_expr_at_depths "c7" { "{...}" \
-                                           "{<C1> = {...}, <C3> = {...}, <C6> = {...}, c7 = 7}" \
-                                           "{<C1> = {c1 = 1}, <C3> = {<C2> = {...}, c3 = 3}, <C6> = {<C5> = {...}, c6 = 6}, c7 = 7}" \
-                                           "{<C1> = {c1 = 1}, <C3> = {<C2> = {c2 = 2}, c3 = 3}, <C6> = {<C5> = {<C4> = {...}, c5 = 5}, c6 = 6}, c7 = 7}" \
-                                           "{<C1> = {c1 = 1}, <C3> = {<C2> = {c2 = 2}, c3 = 3}, <C6> = {<C5> = {<C4> = {c4 = 4}, c5 = 5}, c6 = 6}, c7 = 7}" }
-
-       gdb_print_expr_at_depths "v1" [list "{...}" "{v1 = 1}" ]
-       gdb_print_expr_at_depths "v2" [list "{...}" \
-                                           "{<V1> = {...}, _vptr.V2 = $hex <VTT for V2>, v2 = 2}" \
-                                           "{<V1> = {v1 = 1}, _vptr.V2 = $hex <VTT for V2>, v2 = 2}" ]
-       gdb_print_expr_at_depths "v3" [list "{...}" \
-                                           "{<V1> = {...}, _vptr.V3 = $hex <VTT for V3>, v3 = 3}" \
-                                           "{<V1> = {v1 = 1}, _vptr.V3 = $hex <VTT for V3>, v3 = 3}" ]
-       gdb_print_expr_at_depths "v4" [list "{...}" \
-                                           "{<V2> = {...}, _vptr.V4 = $hex <vtable for V4\[^>\]+>, v4 = 4}" \
-                                           "{<V2> = {<V1> = {...}, _vptr.V2 = $hex <VTT for V4>, v2 = 2}, _vptr.V4 = $hex <vtable for V4\[^>\]+>, v4 = 4}" \
-                                           "{<V2> = {<V1> = {v1 = 1}, _vptr.V2 = $hex <VTT for V4>, v2 = 2}, _vptr.V4 = $hex <vtable for V4\[^>\]+>, v4 = 4}" ]
-       gdb_print_expr_at_depths "v5" [list "{...}" \
-                                           "{<V2> = {...}, _vptr.V5 = $hex <vtable for V5\[^>\]+>, v5 = 1}" \
-                                           "{<V2> = {<V1> = {...}, _vptr.V2 = $hex <VTT for V5>, v2 = 2}, _vptr.V5 = $hex <vtable for V5\[^>\]+>, v5 = 1}" \
-                                           "{<V2> = {<V1> = {v1 = 1}, _vptr.V2 = $hex <VTT for V5>, v2 = 2}, _vptr.V5 = $hex <vtable for V5\[^>\]+>, v5 = 1}" ]
-       gdb_print_expr_at_depths "v6" [list "{...}" \
-                                           "{<V2> = {...}, <V3> = {...}, _vptr.V6 = $hex <vtable for V6\[^>\]+>, v6 = 1}" \
-                                           "{<V2> = {<V1> = {...}, _vptr.V2 = $hex <vtable for V6\[^>\]+>, v2 = 2}, <V3> = {_vptr.V3 = $hex <VTT for V6>, v3 = 3}, _vptr.V6 = $hex <vtable for V6\[^>\]+>, v6 = 1}" \
-                                           "{<V2> = {<V1> = {v1 = 1}, _vptr.V2 = $hex <vtable for V6\[^>\]+>, v2 = 2}, <V3> = {_vptr.V3 = $hex <VTT for V6>, v3 = 3}, _vptr.V6 = $hex <vtable for V6\[^>\]+>, v6 = 1}" ]
-       gdb_print_expr_at_depths "v7" [list "{...}" \
-                                           "{<V4> = {...}, <V5> = {...}, <V6> = {...}, _vptr.V7 = $hex <vtable for V7\[^>\]+>, v7 = 1}" \
-                                           "{<V4> = {<V2> = {...}, _vptr.V4 = $hex <vtable for V7\[^>\]+>, v4 = 4}, <V5> = {_vptr.V5 = $hex <vtable for V7\[^>\]+>, v5 = 1}, <V6> = {<V3> = {...}, _vptr.V6 = $hex <vtable for V7\[^>\]+>, v6 = 1}, _vptr.V7 = $hex <vtable for V7\[^>\]+>, v7 = 1}" \
-                                           "{<V4> = {<V2> = {<V1> = {...}, _vptr.V2 = $hex <vtable for V7\[^>\]+>, v2 = 2}, _vptr.V4 = $hex <vtable for V7\[^>\]+>, v4 = 4}, <V5> = {_vptr.V5 = $hex <vtable for V7\[^>\]+>, v5 = 1}, <V6> = {<V3> = {_vptr.V3 = $hex <VTT for V7>, v3 = 3}, _vptr.V6 = $hex <vtable for V7\[^>\]+>, v6 = 1}, _vptr.V7 = $hex <vtable for V7\[^>\]+>, v7 = 1}" \
-                                           "{<V4> = {<V2> = {<V1> = {v1 = 1}, _vptr.V2 = $hex <vtable for V7\[^>\]+>, v2 = 2}, _vptr.V4 = $hex <vtable for V7\[^>\]+>, v4 = 4}, <V5> = {_vptr.V5 = $hex <vtable for V7\[^>\]+>, v5 = 1}, <V6> = {<V3> = {_vptr.V3 = $hex <VTT for V7>, v3 = 3}, _vptr.V6 = $hex <vtable for V7\[^>\]+>, v6 = 1}, _vptr.V7 = $hex <vtable for V7\[^>\]+>, v7 = 1}" ]
-    }
-}
-
-compile_and_run_tests $lang
diff --git a/gdb/testsuite/gdb.base/max-depth.exp.tcl b/gdb/testsuite/gdb.base/max-depth.exp.tcl
new file mode 100644 (file)
index 0000000..8c0d712
--- /dev/null
@@ -0,0 +1,151 @@
+# Copyright 2019-2020 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/>.
+
+# Tests GDB's handling of 'set print max-depth'.
+
+proc compile_and_run_tests { lang } {
+    global testfile
+    global srcfile
+    global binfile
+    global hex
+
+    standard_testfile max-depth.c
+
+    # Create the additional flags.
+    set flags "debug"
+    lappend flags $lang
+    if { "$lang" == "c++" } {
+       lappend flags "additional_flags=-std=c++11"
+    }
+
+    if { [prepare_for_testing "failed to prepare" "${binfile}" "${srcfile}" "${flags}"] } {
+       return 0
+    }
+
+    # Advance to main.
+    if { ![runto_main] } then {
+       fail "can't run to main"
+       return 0
+    }
+
+    # The max-depth setting has no effect as the anonymous scopes are
+    # ignored and the members are aggregated into the parent scope.
+    gdb_print_expr_at_depths "s1" {"{...}" \
+                                      "{x = 0, y = 0}"\
+                                      "{x = 0, y = 0}"}
+
+    gdb_print_expr_at_depths "s2" {"{...}" \
+                                      "{x = 0, y = 0, {z = 0, a = 0}}" \
+                                      "{x = 0, y = 0, {z = 0, a = 0}}"}
+
+    gdb_print_expr_at_depths "s3" {"{...}" \
+                                      "{x = 0, y = 0, {z = 0, a = 0, {b = 0, c = 0}}}" \
+                                      "{x = 0, y = 0, {z = 0, a = 0, {b = 0, c = 0}}}" \
+                                      "{x = 0, y = 0, {z = 0, a = 0, {b = 0, c = 0}}}"}
+
+    # Increasing max-depth unfurls more of the object.
+    gdb_print_expr_at_depths "s4" {"{...}" \
+                                      "{x = 0, y = 0, l1 = {...}}" \
+                                      "{x = 0, y = 0, l1 = {x = 0, y = 0, l2 = {...}}}" \
+                                      "{x = 0, y = 0, l1 = {x = 0, y = 0, l2 = {x = 0, y = 0}}}"}
+
+    # Check handling of unions, in this case 'raw' is printed instead of
+    # just {...} as this is not useful.
+    gdb_print_expr_at_depths "s5" {"{...}" \
+                                      "{{raw = {...}, {x = 0, y = 0, z = 0}}}" \
+                                      "{{raw = \\{0, 0, 0\\}, {x = 0, y = 0, z = 0}}}"}
+
+    # Check handling of typedefs.
+    gdb_print_expr_at_depths "s6" {"{...}" \
+                                      "{{raw = {...}, {x = 0, y = 0, z = 0}}}" \
+                                      "{{raw = \\{0, 0, 0\\}, {x = 0, y = 0, z = 0}}}"}
+
+    # Multiple anonymous structures in parallel.
+    gdb_print_expr_at_depths "s7" {"{...}" \
+                                      "{{x = 0, y = 0}, {z = 0, a = 0}, {b = 0, c = 0}}" \
+                                      "{{x = 0, y = 0}, {z = 0, a = 0}, {b = 0, c = 0}}"}
+
+    # Flip flop between named and anonymous.  Expected to unfurl to the
+    # first non-anonymous type.
+    gdb_print_expr_at_depths "s8" {"{...}" \
+                                      "{x = 0, y = 0, d1 = {...}}" \
+                                      "{x = 0, y = 0, d1 = {z = 0, a = 0, {b = 0, c = 0}}}"}
+
+    # Imbalanced tree, this will unfurl one size more than the other as
+    # one side has more anonymous levels.
+    gdb_print_expr_at_depths "s9" {"{...}" \
+                                      "{x = 0, y = 0, {k = 0, j = 0, d1 = {...}}, d2 = {...}}" \
+                                      "{x = 0, y = 0, {k = 0, j = 0, d1 = {z = 0, a = 0, {b = 0, c = 0}}}, d2 = {z = 0, a = 0, {b = 0, c = 0}}}"}
+
+    # Arrays are treated as an extra level, while scalars are not.
+    gdb_print_expr_at_depths "s10" {"{...}" \
+                                       "{x = {...}, y = 0, {k = {...}, j = 0, d1 = {...}}, d2 = {...}}" \
+                                       "{x = \\{0, 0, 0, 0, 0, 0, 0, 0, 0, 0\\}, y = 0, {k = \\{0, 0, 0, 0, 0, 0, 0, 0, 0, 0\\}, j = 0, d1 = {z = 0, a = 0, {b = {...}, c = 0}}}, d2 = {z = 0, a = 0, {b = {...}, c = 0}}}" \
+                                       "{x = \\{0, 0, 0, 0, 0, 0, 0, 0, 0, 0\\}, y = 0, {k = \\{0, 0, 0, 0, 0, 0, 0, 0, 0, 0\\}, j = 0, d1 = {z = 0, a = 0, {b = \\{0, 0, 0, 0, 0, 0, 0, 0, 0, 0\\}, c = 0}}}, d2 = {z = 0, a = 0, {b = \\{0, 0, 0, 0, 0, 0, 0, 0, 0, 0\\}, c = 0}}}"}
+
+    # Strings are treated as scalars.
+    gdb_print_expr_at_depths "s11" {"{...}" \
+                                       "{x = 0, s = \"\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\", {z = 0, a = 0}}"}
+
+
+    if { $lang == "c++" } {
+       gdb_print_expr_at_depths "c1" {"{...}" \
+                                          "{c1 = 1}" }
+       gdb_print_expr_at_depths "c2" { "{...}" "{c2 = 2}" }
+       gdb_print_expr_at_depths "c3" { "{...}" \
+                                           "{<C2> = {...}, c3 = 3}" \
+                                           "{<C2> = {c2 = 2}, c3 = 3}" }
+       gdb_print_expr_at_depths "c4" { "{...}" "{c4 = 4}" }
+       gdb_print_expr_at_depths "c5" { "{...}" \
+                                           "{<C4> = {...}, c5 = 5}" \
+                                           "{<C4> = {c4 = 4}, c5 = 5}" }
+       gdb_print_expr_at_depths "c6" { "{...}" \
+                                           "{<C5> = {...}, c6 = 6}" \
+                                           "{<C5> = {<C4> = {...}, c5 = 5}, c6 = 6}" \
+                                           "{<C5> = {<C4> = {c4 = 4}, c5 = 5}, c6 = 6}" }
+       gdb_print_expr_at_depths "c7" { "{...}" \
+                                           "{<C1> = {...}, <C3> = {...}, <C6> = {...}, c7 = 7}" \
+                                           "{<C1> = {c1 = 1}, <C3> = {<C2> = {...}, c3 = 3}, <C6> = {<C5> = {...}, c6 = 6}, c7 = 7}" \
+                                           "{<C1> = {c1 = 1}, <C3> = {<C2> = {c2 = 2}, c3 = 3}, <C6> = {<C5> = {<C4> = {...}, c5 = 5}, c6 = 6}, c7 = 7}" \
+                                           "{<C1> = {c1 = 1}, <C3> = {<C2> = {c2 = 2}, c3 = 3}, <C6> = {<C5> = {<C4> = {c4 = 4}, c5 = 5}, c6 = 6}, c7 = 7}" }
+
+       gdb_print_expr_at_depths "v1" [list "{...}" "{v1 = 1}" ]
+       gdb_print_expr_at_depths "v2" [list "{...}" \
+                                           "{<V1> = {...}, _vptr.V2 = $hex <VTT for V2>, v2 = 2}" \
+                                           "{<V1> = {v1 = 1}, _vptr.V2 = $hex <VTT for V2>, v2 = 2}" ]
+       gdb_print_expr_at_depths "v3" [list "{...}" \
+                                           "{<V1> = {...}, _vptr.V3 = $hex <VTT for V3>, v3 = 3}" \
+                                           "{<V1> = {v1 = 1}, _vptr.V3 = $hex <VTT for V3>, v3 = 3}" ]
+       gdb_print_expr_at_depths "v4" [list "{...}" \
+                                           "{<V2> = {...}, _vptr.V4 = $hex <vtable for V4\[^>\]+>, v4 = 4}" \
+                                           "{<V2> = {<V1> = {...}, _vptr.V2 = $hex <VTT for V4>, v2 = 2}, _vptr.V4 = $hex <vtable for V4\[^>\]+>, v4 = 4}" \
+                                           "{<V2> = {<V1> = {v1 = 1}, _vptr.V2 = $hex <VTT for V4>, v2 = 2}, _vptr.V4 = $hex <vtable for V4\[^>\]+>, v4 = 4}" ]
+       gdb_print_expr_at_depths "v5" [list "{...}" \
+                                           "{<V2> = {...}, _vptr.V5 = $hex <vtable for V5\[^>\]+>, v5 = 1}" \
+                                           "{<V2> = {<V1> = {...}, _vptr.V2 = $hex <VTT for V5>, v2 = 2}, _vptr.V5 = $hex <vtable for V5\[^>\]+>, v5 = 1}" \
+                                           "{<V2> = {<V1> = {v1 = 1}, _vptr.V2 = $hex <VTT for V5>, v2 = 2}, _vptr.V5 = $hex <vtable for V5\[^>\]+>, v5 = 1}" ]
+       gdb_print_expr_at_depths "v6" [list "{...}" \
+                                           "{<V2> = {...}, <V3> = {...}, _vptr.V6 = $hex <vtable for V6\[^>\]+>, v6 = 1}" \
+                                           "{<V2> = {<V1> = {...}, _vptr.V2 = $hex <vtable for V6\[^>\]+>, v2 = 2}, <V3> = {_vptr.V3 = $hex <VTT for V6>, v3 = 3}, _vptr.V6 = $hex <vtable for V6\[^>\]+>, v6 = 1}" \
+                                           "{<V2> = {<V1> = {v1 = 1}, _vptr.V2 = $hex <vtable for V6\[^>\]+>, v2 = 2}, <V3> = {_vptr.V3 = $hex <VTT for V6>, v3 = 3}, _vptr.V6 = $hex <vtable for V6\[^>\]+>, v6 = 1}" ]
+       gdb_print_expr_at_depths "v7" [list "{...}" \
+                                           "{<V4> = {...}, <V5> = {...}, <V6> = {...}, _vptr.V7 = $hex <vtable for V7\[^>\]+>, v7 = 1}" \
+                                           "{<V4> = {<V2> = {...}, _vptr.V4 = $hex <vtable for V7\[^>\]+>, v4 = 4}, <V5> = {_vptr.V5 = $hex <vtable for V7\[^>\]+>, v5 = 1}, <V6> = {<V3> = {...}, _vptr.V6 = $hex <vtable for V7\[^>\]+>, v6 = 1}, _vptr.V7 = $hex <vtable for V7\[^>\]+>, v7 = 1}" \
+                                           "{<V4> = {<V2> = {<V1> = {...}, _vptr.V2 = $hex <vtable for V7\[^>\]+>, v2 = 2}, _vptr.V4 = $hex <vtable for V7\[^>\]+>, v4 = 4}, <V5> = {_vptr.V5 = $hex <vtable for V7\[^>\]+>, v5 = 1}, <V6> = {<V3> = {_vptr.V3 = $hex <VTT for V7>, v3 = 3}, _vptr.V6 = $hex <vtable for V7\[^>\]+>, v6 = 1}, _vptr.V7 = $hex <vtable for V7\[^>\]+>, v7 = 1}" \
+                                           "{<V4> = {<V2> = {<V1> = {v1 = 1}, _vptr.V2 = $hex <vtable for V7\[^>\]+>, v2 = 2}, _vptr.V4 = $hex <vtable for V7\[^>\]+>, v4 = 4}, <V5> = {_vptr.V5 = $hex <vtable for V7\[^>\]+>, v5 = 1}, <V6> = {<V3> = {_vptr.V3 = $hex <VTT for V7>, v3 = 3}, _vptr.V6 = $hex <vtable for V7\[^>\]+>, v6 = 1}, _vptr.V7 = $hex <vtable for V7\[^>\]+>, v7 = 1}" ]
+    }
+}
+
+compile_and_run_tests $lang
index b93f2e8c1572ff2d742ae66d6c783d182a3b682c..ece7bc9acdd9db5f71070aa898cc0cbe614b9c0e 100644 (file)
@@ -17,4 +17,4 @@
 
 # Run cpexprs.exp with -fdebug-types-section.
 set flags {additional_flags=-fdebug-types-section}
-source $srcdir/$subdir/cpexprs.exp.in
+source $srcdir/$subdir/cpexprs.exp.tcl
index b16a5ea6e38417738b9b2f3d6f0adc0616c38d84..62f13a38e82cecf50da5c1f7aa5fad01d9f48f70 100644 (file)
@@ -21,4 +21,4 @@
 
 # Run cpexprs.exp.
 set flags {}
-source $srcdir/$subdir/cpexprs.exp.in
+source $srcdir/$subdir/cpexprs.exp.tcl
diff --git a/gdb/testsuite/gdb.cp/cpexprs.exp.in b/gdb/testsuite/gdb.cp/cpexprs.exp.in
deleted file mode 100644 (file)
index ef30215..0000000
+++ /dev/null
@@ -1,761 +0,0 @@
-# cpexprs.exp - C++ expressions tests
-#
-# Copyright 2008-2020 Free Software Foundation, Inc.
-#
-# Contributed by Red Hat, originally written by Keith Seitz.
-#
-# 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/>.
-
-# This file is part of the gdb testsuite.
-
-# A helper proc which sets a breakpoint at FUNC and attempts to
-# run to the breakpoint.
-proc test_breakpoint {func} {
-    global DEC
-
-    # Return to the top of the test function every time.
-    delete_breakpoints
-    if { ! [gdb_breakpoint test_function] } {
-       fail "set test_function breakpoint for $func"
-    } elseif { [gdb_test "continue" \
-                   "Continuing.\r\n\r\nBreakpoint $DEC+,.*test_function.*" \
-                   ""] != 0 } {
-       fail "continue to test_function for $func"
-    } else {
-       gdb_breakpoint "$func"
-       set i [expr {[string last : $func] + 1}]
-       set efunc [string_to_regexp [string range $func $i end]]
-       gdb_test "continue" \
-           "Continuing.\r\n\r\nBreakpoint $DEC+,.*$efunc.*" \
-           "continue to $func"
-    }
-}
-
-# Add a function to the list of tested functions
-# FUNC is the name of the function (which will be passed to gdb commands)
-# TYPE is the type of the function, as expected from the "print" command
-# PRINT is the name of the function, as expected result of the print command
-#  *OR* "-", indicating that FUNC should be used (needed for virtual/inherited
-#   funcs)
-# LST is either the expected result of the list command (the comment from
-#  the source code) *OR* "-", in which case FUNC will be used
-#
-# Usage:
-# add NAME TYPE PRINT LST
-# add NAME TYPE PRINT -
-proc add_type_regexp {func type print lst} {
-    global all_functions CONVAR ADDR
-
-    set all_functions($func,type) $type
-    if {$print == "-"} {
-       set print $func
-    }
-
-    # An exception: since gdb canonicalizes C++ output,
-    # "(void)" must be mutated to "()".
-    regsub {\(void\)} $print {()} print
-
-    set all_functions($func,print) \
-       "$CONVAR = {$type} $ADDR <[string_to_regexp $print].*>"
-    if {$lst == "-"} {
-       set lst "$func"
-    }
-    set all_functions($func,list) ".*// [string_to_regexp $lst]"
-}
-
-proc add {func type print lst} {
-    add_type_regexp $func [string_to_regexp $type] $print $lst
-}
-
-proc get {func cmd} {
-    global all_functions
-    return $all_functions($func,$cmd)
-}
-
-# Returns a list of function names for a given command
-proc get_functions {cmd} {
-    global all_functions
-    set result {}
-    foreach i [array names all_functions *,$cmd] {
-       if {$all_functions($i) != ""} {
-           set idx [string last , $i]
-           if {$idx != -1} {
-               lappend result [string range $i 0 [expr {$idx - 1}]]
-           }
-       }
-    }
-
-    return [lsort $result]
-}
-
-# Some convenience variables for this test
-set DEC {[0-9]}; # a decimal number
-set HEX {[0-9a-fA-F]}; # a hexidecimal number
-set CONVAR "\\\$$DEC+"; # convenience variable regexp
-set ADDR "0x$HEX+"; # address
-
-# An array of functions/methods that we are testing...
-# Each element consists is indexed by NAME,COMMAND, where
-# NAME is the function name and COMMAND is the gdb command that
-# we are testing. The value of the array for any index pair is
-# the expected result of running COMMAND with the NAME as argument.
-
-# The array holding all functions/methods to test. Valid subindexes
-# are (none need character escaping -- "add" will take care of that):
-
-# add name type print_name list
-# NAME,type: value is type of function 
-# NAME,print: value is print name of function (careful w/inherited/virtual!)
-# NAME,list: value is comment in source code on first line of function
-#   (without the leading "//")
-array set all_functions {}
-
-# "Normal" functions/methods
-add {test_function} \
-    {int (int, char **)} \
-    - \
-    -
-add {derived::a_function} \
-    {void (const derived * const)} \
-    - \
-    -
-add {base1::a_function} \
-    {void (const base1 * const)} \
-    - \
-    -
-add {base2::a_function} \
-    {void (const base2 * const)} \
-    - \
-    -
-
-# Constructors
-
-# On targets using the ARM EABI, the constructor is expected to return
-# "this".
-proc ctor_ret { type } {
-    if { [istarget arm*-*eabi*] || [is_aarch32_target] } {
-       return "$type *"
-    } else {
-       return "void "
-    }
-}
-
-proc ctor_prefix { type } {
-    set ret [ctor_ret $type]
-    return "${ret}($type * const"
-}
-
-proc ctor { type arglist } {
-    if { $arglist != "" } {
-       set arglist ", $arglist"
-    }
-    return "[ctor_prefix $type]$arglist)"
-}
-
-add {derived::derived} \
-    [ctor derived ""] \
-    - \
-    -
-add_type_regexp {base1::base1(void)} \
-    "[string_to_regexp [ctor_prefix base1]], (const )?void \\*\\*( const)?\\)" \
-    - \
-    -
-add {base1::base1(int)} \
-    [ctor base1 "int"] \
-    - \
-    -
-add_type_regexp {base2::base2} \
-    "[string_to_regexp [ctor_prefix base2]], (const )?void \\*\\*( const)?\\)" \
-    - \
-    -
-add {base::base(void)} \
-    [ctor base ""] \
-    - \
-    -
-add {base::base(int)} \
-    [ctor base "int"] \
-    - \
-    -
-
-# Destructors
-
-# On targets using the ARM EABI, some destructors are expected
-# to return "this".  Others are void.  For internal reasons,
-# GCC returns void * instead of $type *; RealView appears to do
-# the same.
-proc dtor { type } {
-    if { [istarget arm*-*eabi*] || [is_aarch32_target] } {
-       set ret "void *"
-    } else {
-       set ret "void "
-    }
-    return "${ret}($type * const)"
-}
-
-add {base::~base} \
-    [dtor base] \
-    - \
-    -
-
-# Overloaded methods (all are const)
-add {base::overload(void) const} \
-    {int (const base * const)} \
-    - \
-    {base::overload(void) const}
-add {base::overload(int) const} \
-    {int (const base * const, int)} \
-    - \
-    -
-add {base::overload(short) const} \
-    {int (const base * const, short)} \
-    - \
-    -
-add {base::overload(long) const} \
-    {int (const base * const, long)} \
-    - \
-    -
-add {base::overload(char*) const} \
-    {int (const base * const, char *)} \
-    - \
-    -
-add {base::overload(base&) const} \
-    {int (const base * const, base &)} \
-    - \
-    -
-
-# Operators
-add {base::operator+} \
-    {int (const base * const, const base &)} \
-    - \
-    -
-add {base::operator++} \
-    {base (base * const)} \
-    - \
-    -
-add {base::operator+=} \
-    {base (base * const, const base &)} \
-    - \
-    -
-add {base::operator-} \
-    {int (const base * const, const base &)} \
-    - \
-    -
-add {base::operator--} \
-    {base (base * const)} \
-    - \
-    -
-add {base::operator-=} \
-    {base (base * const, const base &)} \
-    - \
-    -
-add {base::operator*} \
-    {int (const base * const, const base &)} \
-    - \
-    -
-add {base::operator*=} \
-    {base (base * const, const base &)} \
-    - \
-    -
-add {base::operator/} \
-    {int (const base * const, const base &)} \
-    - \
-    -
-add {base::operator/=} \
-    {base (base * const, const base &)} \
-    - \
-    -
-add {base::operator%} \
-    {int (const base * const, const base &)} \
-    - \
-    -
-add {base::operator%=} \
-    {base (base * const, const base &)} \
-    - \
-    -
-add {base::operator<} \
-    {bool (const base * const, const base &)} \
-    - \
-    -
-add {base::operator<=} \
-    {bool (const base * const, const base &)} \
-    - \
-    -
-add {base::operator>} \
-    {bool (const base * const, const base &)} \
-    - \
-    -
-add {base::operator>=} \
-    {bool (const base * const, const base &)} \
-    - \
-    -
-add {base::operator!=} \
-    {bool (const base * const, const base &)} \
-    - \
-    -
-add {base::operator==} \
-    {bool (const base * const, const base &)} \
-    - \
-    -
-add {base::operator!} \
-    {bool (const base * const)} \
-    - \
-    -
-add {base::operator&&} \
-    {bool (const base * const, const base &)} \
-    - \
-    -
-add {base::operator||} \
-    {bool (const base * const, const base &)} \
-    - \
-    -
-add {base::operator<<} \
-    {int (const base * const, int)} \
-    - \
-    -
-add {base::operator<<=} \
-    {base (base * const, int)} \
-    - \
-    -
-add {base::operator>>} \
-    {int (const base * const, int)} \
-    - \
-    -
-add {base::operator>>=} \
-    {base (base * const, int)} \
-    - \
-    -
-add {base::operator~} \
-    {int (const base * const)} \
-    - \
-    -
-add {base::operator&} \
-    {int (const base * const, const base &)} \
-    - \
-    -
-add {base::operator&=} \
-    {base (base * const, const base &)} \
-    - \
-    -
-add {base::operator|} \
-    {int (const base * const, const base &)} \
-    - \
-    -
-add {base::operator|=} \
-    {base (base * const, const base &)} \
-    - \
-    -
-add {base::operator^} \
-    {int (const base * const, const base &)} \
-    - \
-    -
-add {base::operator^=} \
-    {base (base * const, const base &)} \
-    - \
-    -
-add {base::operator=} \
-    {base (base * const, const base &)} \
-    - \
-    -
-add {base::operator()} \
-    {void (const base * const)} \
-    - \
-    -
-add {base::operator[]} \
-    {int (const base * const, int)} \
-    - \
-    -
-add {base::operator new} \
-    {void *(size_t)} \
-    - \
-    -
-add {base::operator delete} \
-    {void (void *)} \
-    - \
-    -
-add {base::operator new[]} \
-    {void *(size_t)} \
-    - \
-    -
-add {base::operator delete[]} \
-    {void (void *)} \
-    - \
-    -
-add {base::operator char*} \
-    {char *(const base * const)} \
-    - \
-    -
-add {base::operator fluff*} \
-    {fluff *(const base * const)} \
-    - \
-    -
-add {base::operator fluff**} \
-    {fluff **(const base * const)} \
-    - \
-    -
-add {base::operator int} \
-    {int (const base * const)} \
-    - \
-    -
-add {base::operator fluff const* const*} \
-    {const fluff * const *(const base * const)} \
-    - \
-    -
-
-# Templates
-add {tclass<char>::do_something} \
-    {void (tclass<char> * const)} \
-    - \
-    -
-add {tclass<int>::do_something} \
-    {void (tclass<int> * const)} \
-    - \
-    -
-add {tclass<long>::do_something} \
-    {void (tclass<long> * const)} \
-    - \
-    -
-add {tclass<short>::do_something} \
-    {void (tclass<short> * const)} \
-    - \
-    -
-add {tclass<base>::do_something} \
-    {void (tclass<base> * const)} \
-    - \
-    -
-add {flubber<int, int, int, int, int>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<int, int, int, int, short>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<int, int, int, int, long>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<int, int, int, int, char>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<int, int, int, short, int>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<int, int, int, short, short>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<int, int, int, short, long>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<int, int, int, short, char>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<int, int, int, long, int>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<int, int, int, long, short>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<int, int, int, long, long>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<int, int, int, long, char>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<int, int, int, char, int>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<int, int, int, char, short>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<int, int, int, char, long>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<int, int, int, char, char>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<int, int, short, int, int>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<int, int, short, int, short>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<int, int, short, int, long>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<int, int, short, int, char>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<int, int, short, short, int>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<short, int, short, int, short>} \
-    {void (void)} \
-    - \
-    flubber
-add {flubber<long, short, long, short, long>} \
-    {void (void)} \
-    - \
-    flubber
-add {tclass<base>::do_something} \
-    {void (tclass<base> * const)} \
-    - \
-    {tclass<T>::do_something}
-add {policy1::policy} \
-    [ctor "policy<int, operation_1<void*> >" "int"] \
-    {policy<int, operation_1<void*> >::policy} \
-    {policy<T, Policy>::policy}
-add {policy2::policy} \
-    [ctor "policy<int, operation_2<void*> >" int] \
-    {policy<int, operation_2<void*> >::policy} \
-    {policy<T, Policy>::policy}
-add {policy3::policy} \
-    [ctor "policy<int, operation_3<void*> >" "int"] \
-    {policy<int, operation_3<void*> >::policy} \
-    {policy<T, Policy>::policy}
-add {policy4::policy} \
-    [ctor "policy<int, operation_4<void*> >" "int"] \
-    {policy<int, operation_4<void*> >::policy} \
-    {policy<T, Policy>::policy}
-add {policy1::function} \
-    {void (void)} \
-    {operation_1<void*>::function} \
-    {operation_1<T>::function}
-add {policy2::function} \
-    {void (void)} \
-    {operation_2<void*>::function} \
-    {operation_2<T>::function}
-add {policy3::function} \
-    {void (void)} \
-    {operation_3<void*>::function} \
-    {operation_3<T>::function}
-add {policy4::function} \
-    {void (void)} \
-    {operation_4<void*>::function} \
-    {operation_4<T>::function}
-add {policyd<int, operation_1<int> >::policyd} \
-    [ctor "policyd<int, operation_1<int> >" "int"] \
-    - \
-    {policyd<T, Policy>::policyd}
-add {policyd1::policyd} \
-    [ctor "policyd<int, operation_1<int> >" "int"] \
-    {policyd<int, operation_1<int> >::policyd} \
-    {policyd<T, Policy>::policyd}
-add {policyd<int, operation_1<int> >::~policyd} \
-    [dtor "policyd<int, operation_1<int> >"] \
-    - \
-    {policyd<T, Policy>::~policyd}
-add {policyd1::~policyd} \
-    [dtor "policyd<int, operation_1<int> >"] \
-    {policyd<int, operation_1<int> >::~policyd} \
-    {policyd<T, Policy>::~policyd}
-add {policyd<long, operation_1<long> >::policyd} \
-    [ctor "policyd<long, operation_1<long> >" "long"] \
-    - \
-    {policyd<T, Policy>::policyd}
-add {policyd2::policyd} \
-    [ctor "policyd<long, operation_1<long> >" "long"] \
-    {policyd<long, operation_1<long> >::policyd} \
-    {policyd<T, Policy>::policyd}
-add {policyd<long, operation_1<long> >::~policyd} \
-    [dtor "policyd<long, operation_1<long> >"] \
-    - \
-    {policyd<T, Policy>::~policyd}
-add {policyd2::~policyd} \
-    [dtor "policyd<long, operation_1<long> >"] \
-    {policyd<long, operation_1<long> >::~policyd} \
-    {policyd<T, Policy>::~policyd}
-add {policyd<char, operation_1<char> >::policyd} \
-    [ctor "policyd<char, operation_1<char> >" "char"] \
-    - \
-    {policyd<T, Policy>::policyd}
-add {policyd3::policyd} \
-    [ctor "policyd<char, operation_1<char> >" "char"] \
-    {policyd<char, operation_1<char> >::policyd} \
-    {policyd<T, Policy>::policyd}
-add {policyd<char, operation_1<char> >::~policyd} \
-    [dtor "policyd<char, operation_1<char> >"] \
-    - \
-    {policyd<T, Policy>::~policyd}
-add {policyd3::~policyd} \
-    [dtor "policyd<char, operation_1<char> >"] \
-    {policyd<char, operation_1<char> >::~policyd} \
-    {policyd<T, Policy>::~policyd}
-add {policyd<base, operation_1<base> >::policyd} \
-    [ctor "policyd<base, operation_1<base> >" "base"] \
-    - \
-    {policyd<T, Policy>::policyd}
-add {policyd4::policyd} \
-    [ctor "policyd<base, operation_1<base> >" "base"] \
-    {policyd<base, operation_1<base> >::policyd} \
-    {policyd<T, Policy>::policyd}
-add {policyd<base, operation_1<base> >::~policyd} \
-    [dtor "policyd<base, operation_1<base> >"] \
-    - \
-    {policyd<T, Policy>::~policyd}
-add {policyd4::~policyd} \
-    [dtor "policyd<base, operation_1<base> >"] \
-    {policyd<base, operation_1<base> >::~policyd} \
-    {policyd<T, Policy>::~policyd}
-add {policyd<tclass<int>, operation_1<tclass<int> > >::policyd} \
-    [ctor "policyd<tclass<int>, operation_1<tclass<int> > >" "tclass<int>"] \
-    - \
-    {policyd<T, Policy>::policyd}
-add {policyd5::policyd} \
-    [ctor "policyd<tclass<int>, operation_1<tclass<int> > >" "tclass<int>"] \
-    {policyd<tclass<int>, operation_1<tclass<int> > >::policyd} \
-    {policyd<T, Policy>::policyd}
-add {policyd<tclass<int>, operation_1<tclass<int> > >::~policyd} \
-    [dtor "policyd<tclass<int>, operation_1<tclass<int> > >"] \
-    - \
-    {policyd<T, Policy>::~policyd}
-add {policyd5::~policyd} \
-    [dtor "policyd<tclass<int>, operation_1<tclass<int> > >"] \
-    {policyd<tclass<int>, operation_1<tclass<int> > >::~policyd} \
-    {policyd<T, Policy>::~policyd}
-add {policyd<int, operation_1<int> >::function} \
-    {void (void)} \
-    {operation_1<int>::function}\
-    {operation_1<T>::function}
-add {policyd1::function} \
-    {void (void)} \
-    {operation_1<int>::function} \
-    {operation_1<T>::function}
-add {policyd2::function} \
-    {void (void)} \
-    {operation_1<long>::function} \
-    {operation_1<T>::function}
-add {policyd<char, operation_1<char> >::function} \
-    {void (void)} \
-    {operation_1<char>::function} \
-    {operation_1<T>::function}
-add {policyd3::function} \
-    {void (void)} \
-    {operation_1<char>::function} \
-    {operation_1<T>::function}
-add {policyd<base, operation_1<base> >::function} \
-    {void (void)} \
-    {operation_1<base>::function} \
-    {operation_1<T>::function}
-add {policyd4::function} \
-    {void (void)} \
-    {operation_1<base>::function} \
-    {operation_1<T>::function}
-add {policyd<tclass<int>, operation_1<tclass<int> > >::function} \
-    {void (void)} \
-    {operation_1<tclass<int> >::function} \
-    {operation_1<T>::function}
-add {policyd5::function} \
-    {void (void)} \
-    {operation_1<tclass<int> >::function} \
-    {operation_1<T>::function}
-
-# Start the test
-if {[skip_cplus_tests]} { continue }
-
-#
-# test running programs
-#
-
-standard_testfile cpexprs.cc
-
-if {[get_compiler_info "c++"]} {
-    return -1
-}
-
-# Include required flags.
-set flags "$flags debug c++"
-
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile "$flags"]} {
-    return -1
-}
-
-if {![runto_main]} {
-    perror "couldn't run to breakpoint"
-    continue
-}
-
-# Set the listsize to one. This will help with testing "list".
-gdb_test "set listsize 1"
-
-# "print METHOD"
-foreach name [get_functions print] {
-    gdb_test "print $name" [get $name print]
-}
-
-# "list METHOD"
-foreach name [get_functions list] {
-    gdb_test "list $name" [get $name list]
-}
-
-# Running to breakpoint -- use any function we can "list"
-foreach name [get_functions list] {
-    # Skip "test_function", since test_breakpoint uses it
-    if {[string compare $name "test_function"] != 0} {
-       test_breakpoint $name
-    }
-}
-
-# Test c/v gets recognized even without quoting.
-foreach cv {{} { const} { volatile} { const volatile}} {
-  set test "p 'CV::m(int)$cv'"
-  gdb_test_multiple $test $test {
-      -re "( = {.*} 0x\[0-9a-f\]+ <CV::m.*>)\r\n$gdb_prompt $" {
-         # = {void (CV * const, CV::t)} 0x400944 <CV::m(int)>
-         set correct $expect_out(1,string)
-         pass $test
-      }
-  }
-  gdb_test "p CV::m(int)$cv" [string_to_regexp $correct]
-}
-
-# Test TYPENAME:: gets recognized even in parentheses.
-gdb_test "p CV_f(int)"   { = {int \(int\)} 0x[0-9a-f]+ <CV_f\(int\)>}
-gdb_test "p CV_f(CV::t)" { = {int \(int\)} 0x[0-9a-f]+ <CV_f\(int\)>}
-gdb_test "p CV_f(CV::i)" " = 43"
-
-gdb_test "p CV_f('cpexprs.cc'::CV::t)" \
-    { = {int \(int\)} 0x[0-9a-f]+ <CV_f\(int\)>}
-
-# Make sure conversion operator names are canonicalized and properly
-# "spelled."
-gdb_test "p base::operator const fluff * const *" \
-    [get "base::operator fluff const* const*" print] \
-    "canonicalized conversion operator name 1"
-gdb_test "p base::operator const fluff* const*" \
-    [get "base::operator fluff const* const*" print] \
-    "canonicalized conversion operator name 2"
-gdb_test "p base::operator derived*" \
-    "There is no field named operator derived\\*" \
-    "undefined conversion operator"
-
-gdb_exit
-return 0
diff --git a/gdb/testsuite/gdb.cp/cpexprs.exp.tcl b/gdb/testsuite/gdb.cp/cpexprs.exp.tcl
new file mode 100644 (file)
index 0000000..ef30215
--- /dev/null
@@ -0,0 +1,761 @@
+# cpexprs.exp - C++ expressions tests
+#
+# Copyright 2008-2020 Free Software Foundation, Inc.
+#
+# Contributed by Red Hat, originally written by Keith Seitz.
+#
+# 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/>.
+
+# This file is part of the gdb testsuite.
+
+# A helper proc which sets a breakpoint at FUNC and attempts to
+# run to the breakpoint.
+proc test_breakpoint {func} {
+    global DEC
+
+    # Return to the top of the test function every time.
+    delete_breakpoints
+    if { ! [gdb_breakpoint test_function] } {
+       fail "set test_function breakpoint for $func"
+    } elseif { [gdb_test "continue" \
+                   "Continuing.\r\n\r\nBreakpoint $DEC+,.*test_function.*" \
+                   ""] != 0 } {
+       fail "continue to test_function for $func"
+    } else {
+       gdb_breakpoint "$func"
+       set i [expr {[string last : $func] + 1}]
+       set efunc [string_to_regexp [string range $func $i end]]
+       gdb_test "continue" \
+           "Continuing.\r\n\r\nBreakpoint $DEC+,.*$efunc.*" \
+           "continue to $func"
+    }
+}
+
+# Add a function to the list of tested functions
+# FUNC is the name of the function (which will be passed to gdb commands)
+# TYPE is the type of the function, as expected from the "print" command
+# PRINT is the name of the function, as expected result of the print command
+#  *OR* "-", indicating that FUNC should be used (needed for virtual/inherited
+#   funcs)
+# LST is either the expected result of the list command (the comment from
+#  the source code) *OR* "-", in which case FUNC will be used
+#
+# Usage:
+# add NAME TYPE PRINT LST
+# add NAME TYPE PRINT -
+proc add_type_regexp {func type print lst} {
+    global all_functions CONVAR ADDR
+
+    set all_functions($func,type) $type
+    if {$print == "-"} {
+       set print $func
+    }
+
+    # An exception: since gdb canonicalizes C++ output,
+    # "(void)" must be mutated to "()".
+    regsub {\(void\)} $print {()} print
+
+    set all_functions($func,print) \
+       "$CONVAR = {$type} $ADDR <[string_to_regexp $print].*>"
+    if {$lst == "-"} {
+       set lst "$func"
+    }
+    set all_functions($func,list) ".*// [string_to_regexp $lst]"
+}
+
+proc add {func type print lst} {
+    add_type_regexp $func [string_to_regexp $type] $print $lst
+}
+
+proc get {func cmd} {
+    global all_functions
+    return $all_functions($func,$cmd)
+}
+
+# Returns a list of function names for a given command
+proc get_functions {cmd} {
+    global all_functions
+    set result {}
+    foreach i [array names all_functions *,$cmd] {
+       if {$all_functions($i) != ""} {
+           set idx [string last , $i]
+           if {$idx != -1} {
+               lappend result [string range $i 0 [expr {$idx - 1}]]
+           }
+       }
+    }
+
+    return [lsort $result]
+}
+
+# Some convenience variables for this test
+set DEC {[0-9]}; # a decimal number
+set HEX {[0-9a-fA-F]}; # a hexidecimal number
+set CONVAR "\\\$$DEC+"; # convenience variable regexp
+set ADDR "0x$HEX+"; # address
+
+# An array of functions/methods that we are testing...
+# Each element consists is indexed by NAME,COMMAND, where
+# NAME is the function name and COMMAND is the gdb command that
+# we are testing. The value of the array for any index pair is
+# the expected result of running COMMAND with the NAME as argument.
+
+# The array holding all functions/methods to test. Valid subindexes
+# are (none need character escaping -- "add" will take care of that):
+
+# add name type print_name list
+# NAME,type: value is type of function 
+# NAME,print: value is print name of function (careful w/inherited/virtual!)
+# NAME,list: value is comment in source code on first line of function
+#   (without the leading "//")
+array set all_functions {}
+
+# "Normal" functions/methods
+add {test_function} \
+    {int (int, char **)} \
+    - \
+    -
+add {derived::a_function} \
+    {void (const derived * const)} \
+    - \
+    -
+add {base1::a_function} \
+    {void (const base1 * const)} \
+    - \
+    -
+add {base2::a_function} \
+    {void (const base2 * const)} \
+    - \
+    -
+
+# Constructors
+
+# On targets using the ARM EABI, the constructor is expected to return
+# "this".
+proc ctor_ret { type } {
+    if { [istarget arm*-*eabi*] || [is_aarch32_target] } {
+       return "$type *"
+    } else {
+       return "void "
+    }
+}
+
+proc ctor_prefix { type } {
+    set ret [ctor_ret $type]
+    return "${ret}($type * const"
+}
+
+proc ctor { type arglist } {
+    if { $arglist != "" } {
+       set arglist ", $arglist"
+    }
+    return "[ctor_prefix $type]$arglist)"
+}
+
+add {derived::derived} \
+    [ctor derived ""] \
+    - \
+    -
+add_type_regexp {base1::base1(void)} \
+    "[string_to_regexp [ctor_prefix base1]], (const )?void \\*\\*( const)?\\)" \
+    - \
+    -
+add {base1::base1(int)} \
+    [ctor base1 "int"] \
+    - \
+    -
+add_type_regexp {base2::base2} \
+    "[string_to_regexp [ctor_prefix base2]], (const )?void \\*\\*( const)?\\)" \
+    - \
+    -
+add {base::base(void)} \
+    [ctor base ""] \
+    - \
+    -
+add {base::base(int)} \
+    [ctor base "int"] \
+    - \
+    -
+
+# Destructors
+
+# On targets using the ARM EABI, some destructors are expected
+# to return "this".  Others are void.  For internal reasons,
+# GCC returns void * instead of $type *; RealView appears to do
+# the same.
+proc dtor { type } {
+    if { [istarget arm*-*eabi*] || [is_aarch32_target] } {
+       set ret "void *"
+    } else {
+       set ret "void "
+    }
+    return "${ret}($type * const)"
+}
+
+add {base::~base} \
+    [dtor base] \
+    - \
+    -
+
+# Overloaded methods (all are const)
+add {base::overload(void) const} \
+    {int (const base * const)} \
+    - \
+    {base::overload(void) const}
+add {base::overload(int) const} \
+    {int (const base * const, int)} \
+    - \
+    -
+add {base::overload(short) const} \
+    {int (const base * const, short)} \
+    - \
+    -
+add {base::overload(long) const} \
+    {int (const base * const, long)} \
+    - \
+    -
+add {base::overload(char*) const} \
+    {int (const base * const, char *)} \
+    - \
+    -
+add {base::overload(base&) const} \
+    {int (const base * const, base &)} \
+    - \
+    -
+
+# Operators
+add {base::operator+} \
+    {int (const base * const, const base &)} \
+    - \
+    -
+add {base::operator++} \
+    {base (base * const)} \
+    - \
+    -
+add {base::operator+=} \
+    {base (base * const, const base &)} \
+    - \
+    -
+add {base::operator-} \
+    {int (const base * const, const base &)} \
+    - \
+    -
+add {base::operator--} \
+    {base (base * const)} \
+    - \
+    -
+add {base::operator-=} \
+    {base (base * const, const base &)} \
+    - \
+    -
+add {base::operator*} \
+    {int (const base * const, const base &)} \
+    - \
+    -
+add {base::operator*=} \
+    {base (base * const, const base &)} \
+    - \
+    -
+add {base::operator/} \
+    {int (const base * const, const base &)} \
+    - \
+    -
+add {base::operator/=} \
+    {base (base * const, const base &)} \
+    - \
+    -
+add {base::operator%} \
+    {int (const base * const, const base &)} \
+    - \
+    -
+add {base::operator%=} \
+    {base (base * const, const base &)} \
+    - \
+    -
+add {base::operator<} \
+    {bool (const base * const, const base &)} \
+    - \
+    -
+add {base::operator<=} \
+    {bool (const base * const, const base &)} \
+    - \
+    -
+add {base::operator>} \
+    {bool (const base * const, const base &)} \
+    - \
+    -
+add {base::operator>=} \
+    {bool (const base * const, const base &)} \
+    - \
+    -
+add {base::operator!=} \
+    {bool (const base * const, const base &)} \
+    - \
+    -
+add {base::operator==} \
+    {bool (const base * const, const base &)} \
+    - \
+    -
+add {base::operator!} \
+    {bool (const base * const)} \
+    - \
+    -
+add {base::operator&&} \
+    {bool (const base * const, const base &)} \
+    - \
+    -
+add {base::operator||} \
+    {bool (const base * const, const base &)} \
+    - \
+    -
+add {base::operator<<} \
+    {int (const base * const, int)} \
+    - \
+    -
+add {base::operator<<=} \
+    {base (base * const, int)} \
+    - \
+    -
+add {base::operator>>} \
+    {int (const base * const, int)} \
+    - \
+    -
+add {base::operator>>=} \
+    {base (base * const, int)} \
+    - \
+    -
+add {base::operator~} \
+    {int (const base * const)} \
+    - \
+    -
+add {base::operator&} \
+    {int (const base * const, const base &)} \
+    - \
+    -
+add {base::operator&=} \
+    {base (base * const, const base &)} \
+    - \
+    -
+add {base::operator|} \
+    {int (const base * const, const base &)} \
+    - \
+    -
+add {base::operator|=} \
+    {base (base * const, const base &)} \
+    - \
+    -
+add {base::operator^} \
+    {int (const base * const, const base &)} \
+    - \
+    -
+add {base::operator^=} \
+    {base (base * const, const base &)} \
+    - \
+    -
+add {base::operator=} \
+    {base (base * const, const base &)} \
+    - \
+    -
+add {base::operator()} \
+    {void (const base * const)} \
+    - \
+    -
+add {base::operator[]} \
+    {int (const base * const, int)} \
+    - \
+    -
+add {base::operator new} \
+    {void *(size_t)} \
+    - \
+    -
+add {base::operator delete} \
+    {void (void *)} \
+    - \
+    -
+add {base::operator new[]} \
+    {void *(size_t)} \
+    - \
+    -
+add {base::operator delete[]} \
+    {void (void *)} \
+    - \
+    -
+add {base::operator char*} \
+    {char *(const base * const)} \
+    - \
+    -
+add {base::operator fluff*} \
+    {fluff *(const base * const)} \
+    - \
+    -
+add {base::operator fluff**} \
+    {fluff **(const base * const)} \
+    - \
+    -
+add {base::operator int} \
+    {int (const base * const)} \
+    - \
+    -
+add {base::operator fluff const* const*} \
+    {const fluff * const *(const base * const)} \
+    - \
+    -
+
+# Templates
+add {tclass<char>::do_something} \
+    {void (tclass<char> * const)} \
+    - \
+    -
+add {tclass<int>::do_something} \
+    {void (tclass<int> * const)} \
+    - \
+    -
+add {tclass<long>::do_something} \
+    {void (tclass<long> * const)} \
+    - \
+    -
+add {tclass<short>::do_something} \
+    {void (tclass<short> * const)} \
+    - \
+    -
+add {tclass<base>::do_something} \
+    {void (tclass<base> * const)} \
+    - \
+    -
+add {flubber<int, int, int, int, int>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<int, int, int, int, short>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<int, int, int, int, long>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<int, int, int, int, char>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<int, int, int, short, int>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<int, int, int, short, short>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<int, int, int, short, long>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<int, int, int, short, char>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<int, int, int, long, int>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<int, int, int, long, short>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<int, int, int, long, long>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<int, int, int, long, char>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<int, int, int, char, int>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<int, int, int, char, short>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<int, int, int, char, long>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<int, int, int, char, char>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<int, int, short, int, int>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<int, int, short, int, short>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<int, int, short, int, long>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<int, int, short, int, char>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<int, int, short, short, int>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<short, int, short, int, short>} \
+    {void (void)} \
+    - \
+    flubber
+add {flubber<long, short, long, short, long>} \
+    {void (void)} \
+    - \
+    flubber
+add {tclass<base>::do_something} \
+    {void (tclass<base> * const)} \
+    - \
+    {tclass<T>::do_something}
+add {policy1::policy} \
+    [ctor "policy<int, operation_1<void*> >" "int"] \
+    {policy<int, operation_1<void*> >::policy} \
+    {policy<T, Policy>::policy}
+add {policy2::policy} \
+    [ctor "policy<int, operation_2<void*> >" int] \
+    {policy<int, operation_2<void*> >::policy} \
+    {policy<T, Policy>::policy}
+add {policy3::policy} \
+    [ctor "policy<int, operation_3<void*> >" "int"] \
+    {policy<int, operation_3<void*> >::policy} \
+    {policy<T, Policy>::policy}
+add {policy4::policy} \
+    [ctor "policy<int, operation_4<void*> >" "int"] \
+    {policy<int, operation_4<void*> >::policy} \
+    {policy<T, Policy>::policy}
+add {policy1::function} \
+    {void (void)} \
+    {operation_1<void*>::function} \
+    {operation_1<T>::function}
+add {policy2::function} \
+    {void (void)} \
+    {operation_2<void*>::function} \
+    {operation_2<T>::function}
+add {policy3::function} \
+    {void (void)} \
+    {operation_3<void*>::function} \
+    {operation_3<T>::function}
+add {policy4::function} \
+    {void (void)} \
+    {operation_4<void*>::function} \
+    {operation_4<T>::function}
+add {policyd<int, operation_1<int> >::policyd} \
+    [ctor "policyd<int, operation_1<int> >" "int"] \
+    - \
+    {policyd<T, Policy>::policyd}
+add {policyd1::policyd} \
+    [ctor "policyd<int, operation_1<int> >" "int"] \
+    {policyd<int, operation_1<int> >::policyd} \
+    {policyd<T, Policy>::policyd}
+add {policyd<int, operation_1<int> >::~policyd} \
+    [dtor "policyd<int, operation_1<int> >"] \
+    - \
+    {policyd<T, Policy>::~policyd}
+add {policyd1::~policyd} \
+    [dtor "policyd<int, operation_1<int> >"] \
+    {policyd<int, operation_1<int> >::~policyd} \
+    {policyd<T, Policy>::~policyd}
+add {policyd<long, operation_1<long> >::policyd} \
+    [ctor "policyd<long, operation_1<long> >" "long"] \
+    - \
+    {policyd<T, Policy>::policyd}
+add {policyd2::policyd} \
+    [ctor "policyd<long, operation_1<long> >" "long"] \
+    {policyd<long, operation_1<long> >::policyd} \
+    {policyd<T, Policy>::policyd}
+add {policyd<long, operation_1<long> >::~policyd} \
+    [dtor "policyd<long, operation_1<long> >"] \
+    - \
+    {policyd<T, Policy>::~policyd}
+add {policyd2::~policyd} \
+    [dtor "policyd<long, operation_1<long> >"] \
+    {policyd<long, operation_1<long> >::~policyd} \
+    {policyd<T, Policy>::~policyd}
+add {policyd<char, operation_1<char> >::policyd} \
+    [ctor "policyd<char, operation_1<char> >" "char"] \
+    - \
+    {policyd<T, Policy>::policyd}
+add {policyd3::policyd} \
+    [ctor "policyd<char, operation_1<char> >" "char"] \
+    {policyd<char, operation_1<char> >::policyd} \
+    {policyd<T, Policy>::policyd}
+add {policyd<char, operation_1<char> >::~policyd} \
+    [dtor "policyd<char, operation_1<char> >"] \
+    - \
+    {policyd<T, Policy>::~policyd}
+add {policyd3::~policyd} \
+    [dtor "policyd<char, operation_1<char> >"] \
+    {policyd<char, operation_1<char> >::~policyd} \
+    {policyd<T, Policy>::~policyd}
+add {policyd<base, operation_1<base> >::policyd} \
+    [ctor "policyd<base, operation_1<base> >" "base"] \
+    - \
+    {policyd<T, Policy>::policyd}
+add {policyd4::policyd} \
+    [ctor "policyd<base, operation_1<base> >" "base"] \
+    {policyd<base, operation_1<base> >::policyd} \
+    {policyd<T, Policy>::policyd}
+add {policyd<base, operation_1<base> >::~policyd} \
+    [dtor "policyd<base, operation_1<base> >"] \
+    - \
+    {policyd<T, Policy>::~policyd}
+add {policyd4::~policyd} \
+    [dtor "policyd<base, operation_1<base> >"] \
+    {policyd<base, operation_1<base> >::~policyd} \
+    {policyd<T, Policy>::~policyd}
+add {policyd<tclass<int>, operation_1<tclass<int> > >::policyd} \
+    [ctor "policyd<tclass<int>, operation_1<tclass<int> > >" "tclass<int>"] \
+    - \
+    {policyd<T, Policy>::policyd}
+add {policyd5::policyd} \
+    [ctor "policyd<tclass<int>, operation_1<tclass<int> > >" "tclass<int>"] \
+    {policyd<tclass<int>, operation_1<tclass<int> > >::policyd} \
+    {policyd<T, Policy>::policyd}
+add {policyd<tclass<int>, operation_1<tclass<int> > >::~policyd} \
+    [dtor "policyd<tclass<int>, operation_1<tclass<int> > >"] \
+    - \
+    {policyd<T, Policy>::~policyd}
+add {policyd5::~policyd} \
+    [dtor "policyd<tclass<int>, operation_1<tclass<int> > >"] \
+    {policyd<tclass<int>, operation_1<tclass<int> > >::~policyd} \
+    {policyd<T, Policy>::~policyd}
+add {policyd<int, operation_1<int> >::function} \
+    {void (void)} \
+    {operation_1<int>::function}\
+    {operation_1<T>::function}
+add {policyd1::function} \
+    {void (void)} \
+    {operation_1<int>::function} \
+    {operation_1<T>::function}
+add {policyd2::function} \
+    {void (void)} \
+    {operation_1<long>::function} \
+    {operation_1<T>::function}
+add {policyd<char, operation_1<char> >::function} \
+    {void (void)} \
+    {operation_1<char>::function} \
+    {operation_1<T>::function}
+add {policyd3::function} \
+    {void (void)} \
+    {operation_1<char>::function} \
+    {operation_1<T>::function}
+add {policyd<base, operation_1<base> >::function} \
+    {void (void)} \
+    {operation_1<base>::function} \
+    {operation_1<T>::function}
+add {policyd4::function} \
+    {void (void)} \
+    {operation_1<base>::function} \
+    {operation_1<T>::function}
+add {policyd<tclass<int>, operation_1<tclass<int> > >::function} \
+    {void (void)} \
+    {operation_1<tclass<int> >::function} \
+    {operation_1<T>::function}
+add {policyd5::function} \
+    {void (void)} \
+    {operation_1<tclass<int> >::function} \
+    {operation_1<T>::function}
+
+# Start the test
+if {[skip_cplus_tests]} { continue }
+
+#
+# test running programs
+#
+
+standard_testfile cpexprs.cc
+
+if {[get_compiler_info "c++"]} {
+    return -1
+}
+
+# Include required flags.
+set flags "$flags debug c++"
+
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile "$flags"]} {
+    return -1
+}
+
+if {![runto_main]} {
+    perror "couldn't run to breakpoint"
+    continue
+}
+
+# Set the listsize to one. This will help with testing "list".
+gdb_test "set listsize 1"
+
+# "print METHOD"
+foreach name [get_functions print] {
+    gdb_test "print $name" [get $name print]
+}
+
+# "list METHOD"
+foreach name [get_functions list] {
+    gdb_test "list $name" [get $name list]
+}
+
+# Running to breakpoint -- use any function we can "list"
+foreach name [get_functions list] {
+    # Skip "test_function", since test_breakpoint uses it
+    if {[string compare $name "test_function"] != 0} {
+       test_breakpoint $name
+    }
+}
+
+# Test c/v gets recognized even without quoting.
+foreach cv {{} { const} { volatile} { const volatile}} {
+  set test "p 'CV::m(int)$cv'"
+  gdb_test_multiple $test $test {
+      -re "( = {.*} 0x\[0-9a-f\]+ <CV::m.*>)\r\n$gdb_prompt $" {
+         # = {void (CV * const, CV::t)} 0x400944 <CV::m(int)>
+         set correct $expect_out(1,string)
+         pass $test
+      }
+  }
+  gdb_test "p CV::m(int)$cv" [string_to_regexp $correct]
+}
+
+# Test TYPENAME:: gets recognized even in parentheses.
+gdb_test "p CV_f(int)"   { = {int \(int\)} 0x[0-9a-f]+ <CV_f\(int\)>}
+gdb_test "p CV_f(CV::t)" { = {int \(int\)} 0x[0-9a-f]+ <CV_f\(int\)>}
+gdb_test "p CV_f(CV::i)" " = 43"
+
+gdb_test "p CV_f('cpexprs.cc'::CV::t)" \
+    { = {int \(int\)} 0x[0-9a-f]+ <CV_f\(int\)>}
+
+# Make sure conversion operator names are canonicalized and properly
+# "spelled."
+gdb_test "p base::operator const fluff * const *" \
+    [get "base::operator fluff const* const*" print] \
+    "canonicalized conversion operator name 1"
+gdb_test "p base::operator const fluff* const*" \
+    [get "base::operator fluff const* const*" print] \
+    "canonicalized conversion operator name 2"
+gdb_test "p base::operator derived*" \
+    "There is no field named operator derived\\*" \
+    "undefined conversion operator"
+
+gdb_exit
+return 0
index f06ab0862882ca1d231f807196885b92fab9f16e..806d03b0e2c68d12f486d17c7f373ae8bece42c8 100644 (file)
@@ -22,4 +22,4 @@ set lang {c++}
 
 set debug nodebug
 
-source $srcdir/$subdir/infcall-nodebug.exp.in
+source $srcdir/$subdir/infcall-nodebug.exp.tcl
index d9dd14faf96542994e8d240f3bc74fc9cc5dd9b3..dfafe52afb06d92eed9a3ec3cd7692c41ef247fe 100644 (file)
@@ -22,4 +22,4 @@ set lang {c++}
 
 set debug debug
 
-source $srcdir/$subdir/infcall-nodebug.exp.in
+source $srcdir/$subdir/infcall-nodebug.exp.tcl
index cd65dd036a7534c3049f5afd64488ab8dafc793f..b74f9333f8bda4ea6d156082fba2346a07119623 100644 (file)
@@ -18,4 +18,4 @@ set lang {c}
 
 set debug nodebug
 
-source $srcdir/$subdir/infcall-nodebug.exp.in
+source $srcdir/$subdir/infcall-nodebug.exp.tcl
index 4cb26ad3fd2a9d23687ed68ff5d52c2c454c7f63..b9d68637ae3d00271b68f00de4ddf30589c8a933 100644 (file)
@@ -18,4 +18,4 @@ set lang {c}
 
 set debug debug
 
-source $srcdir/$subdir/infcall-nodebug.exp.in
+source $srcdir/$subdir/infcall-nodebug.exp.tcl
diff --git a/gdb/testsuite/gdb.cp/infcall-nodebug.exp.in b/gdb/testsuite/gdb.cp/infcall-nodebug.exp.in
deleted file mode 100644 (file)
index 2346619..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-# This testcase is part of GDB, the GNU debugger.
-# Copyright 2018-2020 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/>.
-
-# Test function calls on C++ functions that have no debug information.
-# See gdb/22736.  Put the called function in a different object to ensure
-# the rest of the test can be complied with debug information.  Whilst we
-# are at it, also test functions with debug information and C functions too.
-
-if [target_info exists gdb,cannot_call_functions] {
-    unsupported "this target can not call functions"
-    continue
-}
-
-set main_basename infcall-nodebug-main
-set lib_basename infcall-nodebug-lib
-standard_testfile ${main_basename}.c ${lib_basename}.c
-
-set mainsrc "${srcdir}/${subdir}/${srcfile}"
-set libsrc "${srcdir}/${subdir}/${srcfile2}"
-
-# Build both source files to objects using language LANG. Use SYMBOLS to build
-# with either debug symbols or without - but always build the main file with
-# debug.  Then make function calls across the files.
-
-proc build_and_run_test { lang symbols } {
-
-    global main_basename lib_basename mainsrc libsrc binfile testfile
-    global gdb_prompt
-
-    if { $symbols == "debug" } {
-       set debug_flags "debug"
-    } else {
-       set debug_flags ""
-    }
-
-    # Compile both files to objects, then link together.
-
-    set main_flags "$lang debug"
-    set lib_flags "$lang $debug_flags"
-    set main_o [standard_output_file ${main_basename}.o]
-    set lib_o [standard_output_file ${lib_basename}.o]
-    set binfile [standard_output_file ${testfile}]
-
-    if { [gdb_compile $mainsrc $main_o object ${main_flags}] != "" } {
-       untested "failed to compile main file to object"
-       return -1
-    }
-
-    if { [gdb_compile $libsrc $lib_o object ${lib_flags}] != "" } {
-       untested "failed to compile secondary file to object"
-       return -1
-    }
-
-    if { [gdb_compile "$main_o $lib_o" ${binfile} executable ""] != "" } {
-       untested "failed to compile"
-       return -1
-    }
-
-    # Startup and run to main.
-
-    clean_restart $binfile
-
-    if ![runto_main] then {
-       fail "can't run to main"
-       return
-    }
-
-    # Function call with cast.
-
-    gdb_test "p (int)foo()" " = 1"
-
-    # Function call without cast.  Will error if there are no debug symbols.
-
-    set test "p foo()"
-    gdb_test_multiple $test $test {
-       -re " = 1\r\n$gdb_prompt " {
-           gdb_assert [ string equal $symbols "debug" ]
-           pass $test
-       }
-       -re "has unknown return type; cast the call to its declared return type\r\n$gdb_prompt " {
-           gdb_assert ![ string equal $symbols "debug" ]
-           pass $test
-       }
-    }
-
-}
-
-build_and_run_test $lang $debug
diff --git a/gdb/testsuite/gdb.cp/infcall-nodebug.exp.tcl b/gdb/testsuite/gdb.cp/infcall-nodebug.exp.tcl
new file mode 100644 (file)
index 0000000..2346619
--- /dev/null
@@ -0,0 +1,101 @@
+# This testcase is part of GDB, the GNU debugger.
+# Copyright 2018-2020 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/>.
+
+# Test function calls on C++ functions that have no debug information.
+# See gdb/22736.  Put the called function in a different object to ensure
+# the rest of the test can be complied with debug information.  Whilst we
+# are at it, also test functions with debug information and C functions too.
+
+if [target_info exists gdb,cannot_call_functions] {
+    unsupported "this target can not call functions"
+    continue
+}
+
+set main_basename infcall-nodebug-main
+set lib_basename infcall-nodebug-lib
+standard_testfile ${main_basename}.c ${lib_basename}.c
+
+set mainsrc "${srcdir}/${subdir}/${srcfile}"
+set libsrc "${srcdir}/${subdir}/${srcfile2}"
+
+# Build both source files to objects using language LANG. Use SYMBOLS to build
+# with either debug symbols or without - but always build the main file with
+# debug.  Then make function calls across the files.
+
+proc build_and_run_test { lang symbols } {
+
+    global main_basename lib_basename mainsrc libsrc binfile testfile
+    global gdb_prompt
+
+    if { $symbols == "debug" } {
+       set debug_flags "debug"
+    } else {
+       set debug_flags ""
+    }
+
+    # Compile both files to objects, then link together.
+
+    set main_flags "$lang debug"
+    set lib_flags "$lang $debug_flags"
+    set main_o [standard_output_file ${main_basename}.o]
+    set lib_o [standard_output_file ${lib_basename}.o]
+    set binfile [standard_output_file ${testfile}]
+
+    if { [gdb_compile $mainsrc $main_o object ${main_flags}] != "" } {
+       untested "failed to compile main file to object"
+       return -1
+    }
+
+    if { [gdb_compile $libsrc $lib_o object ${lib_flags}] != "" } {
+       untested "failed to compile secondary file to object"
+       return -1
+    }
+
+    if { [gdb_compile "$main_o $lib_o" ${binfile} executable ""] != "" } {
+       untested "failed to compile"
+       return -1
+    }
+
+    # Startup and run to main.
+
+    clean_restart $binfile
+
+    if ![runto_main] then {
+       fail "can't run to main"
+       return
+    }
+
+    # Function call with cast.
+
+    gdb_test "p (int)foo()" " = 1"
+
+    # Function call without cast.  Will error if there are no debug symbols.
+
+    set test "p foo()"
+    gdb_test_multiple $test $test {
+       -re " = 1\r\n$gdb_prompt " {
+           gdb_assert [ string equal $symbols "debug" ]
+           pass $test
+       }
+       -re "has unknown return type; cast the call to its declared return type\r\n$gdb_prompt " {
+           gdb_assert ![ string equal $symbols "debug" ]
+           pass $test
+       }
+    }
+
+}
+
+build_and_run_test $lang $debug
index 185dddfc73396fb0abdbf74f4e8d19f291a1598f..43d7801c0d9515db08ddd2d76196fb7bbc31e5ea 100644 (file)
@@ -29,7 +29,7 @@ lassign \
     main_start main_length
 
 set asm_file [standard_output_file $srcfile2]
-source $srcdir/$subdir/clang-debug-names.exp.in
+source $srcdir/$subdir/clang-debug-names.exp.tcl
 
 if { [build_executable_from_specs "failed to prepare" ${testfile} "" \
          $srcfile "nodebug" $asm_file "nodebug" $srcfile3 "debug"] } {
index b5af898838fba6659ecaa6db8a6dea0b3f10cc13..149c1263c90143f20077f075f5dd8efab174ef3e 100644 (file)
@@ -26,7 +26,7 @@ lassign [function_range main ${srcdir}/${subdir}/${srcfile}] \
     main_start main_length
 
 set asm_file [standard_output_file $srcfile2]
-source $srcdir/$subdir/clang-debug-names.exp.in
+source $srcdir/$subdir/clang-debug-names.exp.tcl
 
 if { [prepare_for_testing "failed to prepare" ${testfile} \
          [list $srcfile $asm_file] {nodebug}] } {
diff --git a/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.in b/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.in
deleted file mode 100644 (file)
index 39e0e1e..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-# Copyright 2020 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/>.
-
-# Set up the DWARF for the test.
-
-set main_str_label [Dwarf::_compute_label info_string3]
-set int_str_label [Dwarf::_compute_label info_string4]
-set main_die_label [Dwarf::_compute_label main_die_label]
-set int_die_label [Dwarf::_compute_label int_die_label]
-
-set debug_str \
-    [list \
-         "$main_str_label:" \
-         "  .asciz \"main\"" \
-         "$int_str_label:" \
-         "  .asciz \"int\""]
-
-set debug_names \
-    [list \
-         "  .4byte  .Ldebug_names_end - .Ldebug_names_start" \
-         ".Ldebug_names_start:" \
-         "  .short 5                      # Header: version" \
-         "  .short 0                      # Header: padding" \
-         "  .long 1                       # Header: compilation unit count" \
-         "  .long 0                       # Header: local type unit count" \
-         "  .long 0                       # Header: foreign type unit count" \
-         "  .long 2                       # Header: bucket count" \
-         "  .long 2                       # Header: name count" \
-         "  .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 " \
-         "                                # Header: abbreviation table size" \
-         "  .long 8                       # Header: augmentation string size" \
-         "  .ascii \"LLVM0700\"    # Header: augmentation string" \
-         "  .long .Lcu1_begin             # Compilation unit 0" \
-         "  .long 1                       # Bucket 0" \
-         "  .long 0                       # Bucket 1" \
-         "  .long 193495088               # Hash in Bucket 0" \
-         "  .long 2090499946              # Hash in Bucket 0" \
-         "  .long $int_str_label          # String in Bucket 0: int" \
-         "  .long $main_str_label         # String in Bucket 0: main" \
-         "  .long .Lnames1-.Lnames_entries0 # Offset in Bucket 0" \
-         "  .long .Lnames0-.Lnames_entries0 # Offset in Bucket 0" \
-         ".Lnames_abbrev_start0:" \
-         "  .byte 46                      # Abbrev code" \
-         "  .byte 46                      # DW_TAG_subprogram" \
-         "  .byte 3                       # DW_IDX_die_offset" \
-         "  .byte 19                      # DW_FORM_ref4" \
-         "  .byte 0                       # End of abbrev" \
-         "  .byte 0                       # End of abbrev" \
-         "  .byte 36                      # Abbrev code" \
-         "  .byte 36                      # DW_TAG_base_type" \
-         "  .byte 3                       # DW_IDX_die_offset" \
-         "  .byte 19                      # DW_FORM_ref4" \
-         "  .byte 0                       # End of abbrev" \
-         "  .byte 0                       # End of abbrev" \
-         "  .byte 0                       # End of abbrev list" \
-         ".Lnames_abbrev_end0:" \
-         ".Lnames_entries0:" \
-         ".Lnames1:" \
-         "  .byte 36                      # Abbreviation code" \
-         "  .long $int_die_label - .Lcu1_begin # DW_IDX_die_offset" \
-         "  .long 0                       # End of list: int" \
-         ".Lnames0:" \
-         "  .byte 46                      # Abbreviation code" \
-         "  .long $main_die_label - .Lcu1_begin # DW_IDX_die_offset" \
-         "  .long 0                       # End of list: main" \
-         "  .p2align 2" \
-         ".Ldebug_names_end:"]
-
-Dwarf::assemble $asm_file {
-    global srcdir subdir srcfile
-    global main_start main_length
-
-    cu {} {
-       DW_TAG_compile_unit {
-                {DW_AT_language @DW_LANG_C}
-                {DW_AT_name     clang-debug-names.c}
-                {DW_AT_comp_dir /tmp}
-
-        } {
-           global int_die_label
-           global main_die_label
-
-           define_label $int_die_label
-           base_type {
-               {name "int"}
-               {encoding @DW_ATE_signed}
-               {byte_size 4 DW_FORM_sdata}
-           }
-
-           define_label $main_die_label
-           subprogram {
-               {name main}
-               {type :$int_die_label}
-               {low_pc $main_start addr}
-               {high_pc "$main_start + $main_length" addr}
-           }
-       }
-    }
-
-    _defer_output .debug_str {
-       global debug_str
-       _emit [join $debug_str "\n"]
-    }
-
-    _defer_output .debug_names {
-       global debug_names
-       _emit [join $debug_names "\n"]
-    }
-}
diff --git a/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.tcl b/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.tcl
new file mode 100644 (file)
index 0000000..39e0e1e
--- /dev/null
@@ -0,0 +1,121 @@
+# Copyright 2020 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/>.
+
+# Set up the DWARF for the test.
+
+set main_str_label [Dwarf::_compute_label info_string3]
+set int_str_label [Dwarf::_compute_label info_string4]
+set main_die_label [Dwarf::_compute_label main_die_label]
+set int_die_label [Dwarf::_compute_label int_die_label]
+
+set debug_str \
+    [list \
+         "$main_str_label:" \
+         "  .asciz \"main\"" \
+         "$int_str_label:" \
+         "  .asciz \"int\""]
+
+set debug_names \
+    [list \
+         "  .4byte  .Ldebug_names_end - .Ldebug_names_start" \
+         ".Ldebug_names_start:" \
+         "  .short 5                      # Header: version" \
+         "  .short 0                      # Header: padding" \
+         "  .long 1                       # Header: compilation unit count" \
+         "  .long 0                       # Header: local type unit count" \
+         "  .long 0                       # Header: foreign type unit count" \
+         "  .long 2                       # Header: bucket count" \
+         "  .long 2                       # Header: name count" \
+         "  .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 " \
+         "                                # Header: abbreviation table size" \
+         "  .long 8                       # Header: augmentation string size" \
+         "  .ascii \"LLVM0700\"    # Header: augmentation string" \
+         "  .long .Lcu1_begin             # Compilation unit 0" \
+         "  .long 1                       # Bucket 0" \
+         "  .long 0                       # Bucket 1" \
+         "  .long 193495088               # Hash in Bucket 0" \
+         "  .long 2090499946              # Hash in Bucket 0" \
+         "  .long $int_str_label          # String in Bucket 0: int" \
+         "  .long $main_str_label         # String in Bucket 0: main" \
+         "  .long .Lnames1-.Lnames_entries0 # Offset in Bucket 0" \
+         "  .long .Lnames0-.Lnames_entries0 # Offset in Bucket 0" \
+         ".Lnames_abbrev_start0:" \
+         "  .byte 46                      # Abbrev code" \
+         "  .byte 46                      # DW_TAG_subprogram" \
+         "  .byte 3                       # DW_IDX_die_offset" \
+         "  .byte 19                      # DW_FORM_ref4" \
+         "  .byte 0                       # End of abbrev" \
+         "  .byte 0                       # End of abbrev" \
+         "  .byte 36                      # Abbrev code" \
+         "  .byte 36                      # DW_TAG_base_type" \
+         "  .byte 3                       # DW_IDX_die_offset" \
+         "  .byte 19                      # DW_FORM_ref4" \
+         "  .byte 0                       # End of abbrev" \
+         "  .byte 0                       # End of abbrev" \
+         "  .byte 0                       # End of abbrev list" \
+         ".Lnames_abbrev_end0:" \
+         ".Lnames_entries0:" \
+         ".Lnames1:" \
+         "  .byte 36                      # Abbreviation code" \
+         "  .long $int_die_label - .Lcu1_begin # DW_IDX_die_offset" \
+         "  .long 0                       # End of list: int" \
+         ".Lnames0:" \
+         "  .byte 46                      # Abbreviation code" \
+         "  .long $main_die_label - .Lcu1_begin # DW_IDX_die_offset" \
+         "  .long 0                       # End of list: main" \
+         "  .p2align 2" \
+         ".Ldebug_names_end:"]
+
+Dwarf::assemble $asm_file {
+    global srcdir subdir srcfile
+    global main_start main_length
+
+    cu {} {
+       DW_TAG_compile_unit {
+                {DW_AT_language @DW_LANG_C}
+                {DW_AT_name     clang-debug-names.c}
+                {DW_AT_comp_dir /tmp}
+
+        } {
+           global int_die_label
+           global main_die_label
+
+           define_label $int_die_label
+           base_type {
+               {name "int"}
+               {encoding @DW_ATE_signed}
+               {byte_size 4 DW_FORM_sdata}
+           }
+
+           define_label $main_die_label
+           subprogram {
+               {name main}
+               {type :$int_die_label}
+               {low_pc $main_start addr}
+               {high_pc "$main_start + $main_length" addr}
+           }
+       }
+    }
+
+    _defer_output .debug_str {
+       global debug_str
+       _emit [join $debug_str "\n"]
+    }
+
+    _defer_output .debug_names {
+       global debug_names
+       _emit [join $debug_names "\n"]
+    }
+}
This page took 0.084432 seconds and 4 git commands to generate.