]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.rust/modules.exp
Update copyright year range in all GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.rust / modules.exp
1 # Copyright (C) 2016-2019 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 # Test name lookup.
17
18 load_lib rust-support.exp
19 if {[skip_rust_tests]} {
20 continue
21 }
22
23 standard_testfile .rs
24 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
25 return -1
26 }
27
28 set line [gdb_get_line_number "set breakpoint here"]
29 if {![runto ${srcfile}:$line]} {
30 untested "could not run to breakpoint"
31 return -1
32 }
33
34 # Currently a closure type is not described by rustc.
35 # https://github.com/rust-lang/rust/issues/33121
36 # gdb_test "call f2()" "lambda f2"
37
38 if ![target_info exists gdb,noinferiorio] {
39 gdb_test_stdio "call f3()" "mod1::inner::innest::f3"
40 gdb_test_stdio "call self::f2()" "mod1::inner::innest::f2"
41 gdb_test_stdio "call self::super::f2()" "mod1::inner::f2"
42 gdb_test_stdio "call super::f2()" "mod1::inner::f2"
43 gdb_test_stdio "call self::super::super::f2()" "mod1::f2"
44 gdb_test_stdio "call super::super::f2()" "mod1::f2"
45 gdb_test_stdio "call ::f2()" "::f2"
46 gdb_test_stdio "call extern modules::mod1::f2()" "mod1::f2"
47 }
48 gdb_test "call super::super::super::f2()" \
49 "Too many super:: uses from 'modules::mod1::inner::innest'"
50
51 gdb_test_sequence "ptype ::Generic::<::Generic<::Type> >" "" {
52 "type = struct modules::Generic<modules::Generic<modules::Type>> \\("
53 " modules::Generic<modules::Type>,"
54 "\\)"
55 }
56
57 gdb_test_sequence "ptype ::Generic::<::Generic<extern modules::Type> >" "" {
58 "type = struct modules::Generic<modules::Generic<modules::Type>> \\("
59 " modules::Generic<modules::Type>,"
60 "\\)"
61 }
62
63 gdb_test_sequence "ptype ::Generic::<::Generic<::mod1::Type>>" "" {
64 "type = struct modules::Generic<modules::Generic<modules::mod1::Type>> \\("
65 " modules::Generic<modules::mod1::Type>,"
66 "\\)"
67 }
68
69 gdb_test_sequence "ptype ::Generic::<::Generic<super::Type>>" "" {
70 "type = struct modules::Generic<modules::Generic<modules::mod1::inner::Type>> \\("
71 " modules::Generic<modules::mod1::inner::Type>,"
72 "\\)"
73 }
74
75 gdb_test_sequence "ptype ::Generic::<::Generic<self::Type>>" "" {
76 "type = struct modules::Generic<modules::Generic<modules::mod1::inner::innest::Type>> \\("
77 " modules::Generic<modules::mod1::inner::innest::Type>,"
78 "\\)"
79 }
80
81 # Not working yet.
82 # gdb_test_sequence "ptype ::Generic<Type>" "" ...
83
84 # Some basic linespec tests.
85 foreach mod {mod1::inner::innest mod1::inner mod1 {}} {
86 if {$mod != ""} {
87 append mod ::
88 }
89 gdb_breakpoint modules::${mod}f2 message
90 gdb_breakpoint "*::${mod}f2" message
91 }
92
93 gdb_test "print ::TWENTY_THREE" " = 23"