diff options
author | Pedro Alves <pedro@palves.net> | 2020-09-18 13:40:18 +0100 |
---|---|---|
committer | Pedro Alves <pedro@palves.net> | 2020-09-18 13:40:18 +0100 |
commit | e11daf7a2e0e08e0820f528175113134151a1a14 (patch) | |
tree | 66d1b8c0ed4ef15c5f7f04344bd4c2c1a0bb7cce /gdb/testsuite/gdb.multi/multi-target-info-inferiors.exp | |
parent | 5947daaf7545b2887abb977af6700b4cc9a807be (diff) | |
download | gdb-e11daf7a2e0e08e0820f528175113134151a1a14.zip gdb-e11daf7a2e0e08e0820f528175113134151a1a14.tar.gz gdb-e11daf7a2e0e08e0820f528175113134151a1a14.tar.bz2 |
Split gdb.multi/multi-target.exp into separate testcases
gdb.multi/multi-target.exp sets up a debug environment with multiple
gdbservers, multiple native processes, and multiple cores, which has
proved useful for exercising a number of multi-target scenarios.
But, as we add more tests to gdb.base/multi-target.exp, it is growing
a bit too large (making a bit cumbersome to debug) and too slow to run
(if you have glibc debug info).
This commit thus splits the multi-target.exp into several testcases,
one per use case. The common setup code is moved to a new
multi-target.exp.tcl file that is included by all the resulting
multi-target testcases.
gdb/testsuite/ChangeLog:
* gdb.multi/multi-target-continue.exp: New file, factored out from
multi-target.exp.
* gdb.multi/multi-target-info-inferiors.exp: New file, factored out from
multi-target.exp.
* gdb.multi/multi-target-interrupt.exp: New file, factored out from
multi-target.exp.
* gdb.multi/multi-target-no-resumed.exp: New file, factored out from
multi-target.exp.
* gdb.multi/multi-target-ping-pong-next.exp: New file, factored out from
multi-target.exp.
* gdb.multi/multi-target.exp.tcl: New file, factored out from
multi-target.exp.
* gdb.multi/multi-target.exp: Delete.
Diffstat (limited to 'gdb/testsuite/gdb.multi/multi-target-info-inferiors.exp')
-rw-r--r-- | gdb/testsuite/gdb.multi/multi-target-info-inferiors.exp | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.multi/multi-target-info-inferiors.exp b/gdb/testsuite/gdb.multi/multi-target-info-inferiors.exp new file mode 100644 index 0000000..30b0013 --- /dev/null +++ b/gdb/testsuite/gdb.multi/multi-target-info-inferiors.exp @@ -0,0 +1,110 @@ +# Copyright 2017-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 "info inferiors" and "info connections" with multiple targets. + +source $srcdir/$subdir/multi-target.exp.tcl + +if {![multi_target_prepare]} { + return +} + +# Test "info inferiors" and "info connections". MULTI_PROCESS +# indicates whether the multi-process feature of remote targets is +# turned off or on. +proc test_info_inferiors {multi_process} { + setup "off" + + gdb_test_no_output \ + "set remote multiprocess-feature-packet $multi_process" + + # Get the description for inferior INF for when the current + # inferior id is CURRENT. + proc inf_desc {inf current} { + set ws "\[ \t\]+" + global decimal + upvar multi_process multi_process + + if {($multi_process == "off") && ($inf == 2 || $inf == 5)} { + set desc "Remote target" + } else { + set desc "process ${decimal}" + } + + set desc "${inf}${ws}${desc}${ws}" + if {$inf == $current} { + return "\\* $desc" + } else { + return " $desc" + } + } + + # Get the "Num" column for CONNECTION for when the current + # inferior id is CURRENT_INF. + proc connection_num {connection current_inf} { + switch $current_inf { + "4" { set current_connection "1"} + "5" { set current_connection "4"} + "6" { set current_connection "5"} + default { set current_connection $current_inf} + } + if {$connection == $current_connection} { + return "\\* $connection" + } else { + return " $connection" + } + } + + set ws "\[ \t\]+" + global decimal binfile + + # Test "info connections" and "info inferior" by switching to each + # inferior one by one. + for {set inf 1} {$inf <= 6} {incr inf} { + with_test_prefix "inferior $inf" { + gdb_test "inferior $inf" "Switching to inferior $inf.*" + + gdb_test "info connections" \ + [multi_line \ + "Num${ws}What${ws}Description${ws}" \ + "[connection_num 1 $inf]${ws}native${ws}Native process${ws}" \ + "[connection_num 2 $inf]${ws}extended-remote localhost:$decimal${ws}Extended remote serial target in gdb-specific protocol${ws}" \ + "[connection_num 3 $inf]${ws}core${ws}Local core dump file${ws}" \ + "[connection_num 4 $inf]${ws}extended-remote localhost:$decimal${ws}Extended remote serial target in gdb-specific protocol${ws}" \ + "[connection_num 5 $inf]${ws}core${ws}Local core dump file${ws}" \ + ] + + gdb_test "info inferiors" \ + [multi_line \ + "Num${ws}Description${ws}Connection${ws}Executable${ws}" \ + "[inf_desc 1 $inf]1 \\(native\\)${ws}${binfile}${ws}" \ + "[inf_desc 2 $inf]2 \\(extended-remote localhost:$decimal\\)${ws}${binfile}${ws}" \ + "[inf_desc 3 $inf]3 \\(core\\)${ws}${binfile}${ws}" \ + "[inf_desc 4 $inf]1 \\(native\\)${ws}${binfile}${ws}" \ + "[inf_desc 5 $inf]4 \\(extended-remote localhost:$decimal\\)${ws}${binfile}${ws}" \ + "[inf_desc 6 $inf]5 \\(core\\)${ws}${binfile}${ws}" \ + ] + } + } +} + +# Test "info inferiors" and "info connections" commands. +with_test_prefix "info-inferiors" { + foreach_with_prefix multi_process {"on" "off"} { + test_info_inferiors $multi_process + } +} + +multi_target_cleanup |