1 # Copyright
(C
) 2016-2022 Free Software Foundation
, Inc.
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.
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.
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
/>.
18 load_lib rust
-support.exp
19 if {[skip_rust_tests
]} {
24 if {[prepare_for_testing
"failed to prepare" $testfile $srcfile {debug rust}]} {
28 set line
[gdb_get_line_number
"set breakpoint here"]
29 if {![runto $
{srcfile
}:$line
]} {
30 untested
"could not run to breakpoint"
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"
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"
48 gdb_test
"call super::super::super::f2()" \
49 "Too many super:: uses from 'modules::mod1::inner::innest'"
51 gdb_test_sequence
"ptype ::Generic::<::Generic<::Type> >" "" {
52 "type = struct modules::Generic<modules::Generic<modules::Type>> \\("
53 " modules::Generic<modules::Type>,"
57 gdb_test_sequence
"ptype ::Generic::<::Generic<extern modules::Type> >" "" {
58 "type = struct modules::Generic<modules::Generic<modules::Type>> \\("
59 " modules::Generic<modules::Type>,"
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>,"
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>,"
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>,"
82 # gdb_test_sequence
"ptype ::Generic<Type>" "" ...
84 # Some basic linespec tests.
85 foreach mod
{mod1
::inner
::innest mod1
::inner mod1
{}} {
89 gdb_breakpoint modules
::$
{mod
}f2 message
90 gdb_breakpoint
"*::${mod}f2" message
93 gdb_test
"print ::TWENTY_THREE" " = 23"
95 gdb_test
"print super TWENTY_THREE" "'::' expected"
96 gdb_test
"print super::23" "identifier expected"
97 gdb_test
"ptype ::Generic::<::Generic<self::Type" "'>' expected"