Commit | Line | Data |
---|---|---|
61baf725 | 1 | # Copyright (C) 2016-2017 Free Software Foundation, Inc. |
67218854 TT |
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 | |
5b362f04 | 24 | if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} { |
67218854 TT |
25 | return -1 |
26 | } | |
27 | ||
28 | set line [gdb_get_line_number "set breakpoint here"] | |
29 | if {![runto ${srcfile}:$line]} { | |
5b362f04 | 30 | untested "could not run to breakpoint" |
67218854 TT |
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 | gdb_test "call f3()" "mod1::inner::innest::f3" | |
39 | gdb_test "call self::f2()" "mod1::inner::innest::f2" | |
40 | gdb_test "call self::super::f2()" "mod1::inner::f2" | |
41 | gdb_test "call super::f2()" "mod1::inner::f2" | |
42 | gdb_test "call self::super::super::f2()" "mod1::f2" | |
43 | gdb_test "call super::super::f2()" "mod1::f2" | |
44 | gdb_test "call ::f2()" "::f2" | |
45 | gdb_test "call super::super::super::f2()" \ | |
46 | "Too many super:: uses from 'modules::mod1::inner::innest'" | |
47 | gdb_test "call extern modules::mod1::f2()" "mod1::f2" | |
48 | ||
49 | gdb_test_sequence "ptype ::Generic::<::Generic<::Type> >" "" { | |
50 | "type = struct modules::Generic<modules::Generic<modules::Type>> \\(" | |
51 | " modules::Generic<modules::Type>," | |
52 | "\\)" | |
53 | } | |
54 | ||
55 | gdb_test_sequence "ptype ::Generic::<::Generic<extern modules::Type> >" "" { | |
56 | "type = struct modules::Generic<modules::Generic<modules::Type>> \\(" | |
57 | " modules::Generic<modules::Type>," | |
58 | "\\)" | |
59 | } | |
60 | ||
61 | gdb_test_sequence "ptype ::Generic::<::Generic<::mod1::Type>>" "" { | |
62 | "type = struct modules::Generic<modules::Generic<modules::mod1::Type>> \\(" | |
63 | " modules::Generic<modules::mod1::Type>," | |
64 | "\\)" | |
65 | } | |
66 | ||
67 | gdb_test_sequence "ptype ::Generic::<::Generic<super::Type>>" "" { | |
68 | "type = struct modules::Generic<modules::Generic<modules::mod1::inner::Type>> \\(" | |
69 | " modules::Generic<modules::mod1::inner::Type>," | |
70 | "\\)" | |
71 | } | |
72 | ||
73 | gdb_test_sequence "ptype ::Generic::<::Generic<self::Type>>" "" { | |
74 | "type = struct modules::Generic<modules::Generic<modules::mod1::inner::innest::Type>> \\(" | |
75 | " modules::Generic<modules::mod1::inner::innest::Type>," | |
76 | "\\)" | |
77 | } | |
78 | ||
79 | # Not working yet. | |
80 | # gdb_test_sequence "ptype ::Generic<Type>" "" ... | |
81 | ||
82 | # Some basic linespec tests. | |
83 | foreach mod {mod1::inner::innest mod1::inner mod1 {}} { | |
84 | if {$mod != ""} { | |
85 | append mod :: | |
86 | } | |
87 | gdb_breakpoint modules::${mod}f2 message | |
88 | gdb_breakpoint "*::${mod}f2" message | |
89 | } |