1 # Copyright
2017-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
/>.
16 # Test
"info inferiors" and "info connections" with multiple targets.
18 load_lib gdb
-python.exp
20 source $srcdir
/$subdir
/multi
-target.exp.tcl
22 if {![multi_target_prepare
]} {
26 #
Cache the result of calling skip_python_tests into a local
variable.
27 set run_python_tests
[expr
! [skip_python_tests
]]
29 # Test
"info inferiors" and "info connections". MULTI_PROCESS
30 # indicates whether the multi
-process feature of remote targets is
32 proc test_info_inferiors
{multi_process
} {
35 if { $
::run_python_tests
} {
36 gdb_test_no_output
"source ${::remote_python_file}" "load python file"
40 "set remote multiprocess-feature-packet $multi_process"
42 #
Get the description
for inferior INF
for when the current
43 # inferior id is CURRENT.
44 proc inf_desc
{inf current
} {
47 upvar multi_process multi_process
49 if {($multi_process
== "off") && ($inf == 2 || $inf == 5)} {
50 set desc
"Remote target"
52 set desc
"process ${decimal}"
55 set desc
"${inf}${ws}${desc}${ws}"
56 if {$inf
== $current
} {
63 #
Get the
"Num" column for CONNECTION for when the current
64 # inferior id is CURRENT_INF.
65 proc connection_num
{connection current_inf
} {
67 "4" { set current_connection "1"}
68 "5" { set current_connection "4"}
69 "6" { set current_connection "5"}
70 default
{ set current_connection $current_inf
}
72 if {$connection
== $current_connection
} {
73 return "\\* $connection"
80 global decimal binfile
82 # Test
"info connections" and "info inferior" by switching to each
83 # inferior one by one.
84 for {set inf
1} {$inf
<= 6} {incr inf
} {
85 with_test_prefix
"inferior $inf" {
86 gdb_test
"inferior $inf" "Switching to inferior $inf.*"
88 gdb_test
"info connections" \
90 "Num${ws}What${ws}Description${ws}" \
91 "[connection_num 1 $inf]${ws}native${ws}Native process${ws}" \
92 "[connection_num 2 $inf]${ws}extended-remote localhost:$decimal${ws}Extended remote target using gdb-specific protocol${ws}" \
93 "[connection_num 3 $inf]${ws}core${ws}Local core dump file${ws}" \
94 "[connection_num 4 $inf]${ws}extended-remote localhost:$decimal${ws}Extended remote target using gdb-specific protocol${ws}" \
95 "[connection_num 5 $inf]${ws}core${ws}Local core dump file${ws}" \
98 if { $
::run_python_tests
} {
99 gdb_test
"python info_connections()" \
101 "Num${ws}What${ws}Description" \
102 "[connection_num 1 $inf]${ws}native${ws}Native process" \
103 "[connection_num 2 $inf]${ws}extended-remote localhost:$decimal${ws}Extended remote target using gdb-specific protocol" \
104 "[connection_num 3 $inf]${ws}core${ws}Local core dump file" \
105 "[connection_num 4 $inf]${ws}extended-remote localhost:$decimal${ws}Extended remote target using gdb-specific protocol" \
106 "[connection_num 5 $inf]${ws}core${ws}Local core dump file" \
110 gdb_test
"info inferiors" \
112 "Num${ws}Description${ws}Connection${ws}Executable${ws}" \
113 "[inf_desc 1 $inf]1 \\(native\\)${ws}${binfile}${ws}" \
114 "[inf_desc 2 $inf]2 \\(extended-remote localhost:$decimal\\)${ws}${binfile}${ws}" \
115 "[inf_desc 3 $inf]3 \\(core\\)${ws}${binfile}${ws}" \
116 "[inf_desc 4 $inf]1 \\(native\\)${ws}${binfile}${ws}" \
117 "[inf_desc 5 $inf]4 \\(extended-remote localhost:$decimal\\)${ws}${binfile}${ws}" \
118 "[inf_desc 6 $inf]5 \\(core\\)${ws}${binfile}${ws}" \
121 if { $
::run_python_tests
} {
122 gdb_test
"python info_inferiors()" \
124 "Inferior 1, Connection #1: native" \
125 "Inferior 2, Connection #2: extended-remote localhost:$decimal" \
126 "Inferior 3, Connection #3: core" \
127 "Inferior 4, Connection #1: native" \
128 "Inferior 5, Connection #4: extended-remote localhost:$decimal" \
129 "Inferior 6, Connection #5: core" \
136 if { $run_python_tests
} {
137 set remote_python_file
[gdb_remote_download host \
138 $
{srcdir
}/$
{subdir
}/$
{testfile
}.py
]
141 # Test
"info inferiors" and "info connections" commands.
142 with_test_prefix
"info-inferiors" {
143 foreach_with_prefix multi_process
{"on" "off"} {
144 test_info_inferiors $multi_process