1 # Copyright 1999-2019 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 load_lib mi-support.exp
26 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
27 untested "failed to compile"
31 proc test_list_thread_groups { } {
35 # Before any run, exit-code should not be present.
37 "122-list-thread-groups" \
38 "122\\^done,groups=\\\[\{id=\"i1\",type=\"process\"\}\]" \
39 "-list-thread-groups before run shows no exit-code"
41 with_test_prefix "first run" {
44 # During the run, exit-code should not be present.
46 "123-list-thread-groups" \
47 "123\\^done,groups=\\\[\{id=\"i1\",type=\"process\",pid=\"$decimal\",executable=\".*\".*" \
48 "-list-thread-groups during run shows no exit-code"
51 mi_send_resuming_command "exec-continue" "continuing to inferior exit"
52 mi_expect_stop "exited-normally" "" "" "" "" "" "exit normally"
54 # After the run, exit-code should be present.
56 "124-list-thread-groups" \
57 "124\\^done,groups=\\\[\{id=\"i1\",type=\"process\",exit-code=\"0\",executable=\".*\"\}\]" \
58 "-list-thread-groups after exit shows exit-code"
61 with_test_prefix "second run" {
64 # Write the exit code we want in the global var
65 mi_gdb_test "set var exit_code = 8" ".*\\^done" "write exit code"
67 # During the second run, exit-code should not be present.
69 "125-list-thread-groups" \
70 "125\\^done,groups=\\\[\{id=\"i1\",type=\"process\",pid=\"$decimal\",executable=\".*\".*" \
71 "-list-thread-groups during run shows no exit-code"
74 mi_send_resuming_command "exec-continue" "continuing to inferior exit"
75 mi_expect_stop "exited" "" "" "" "" "" "exit with code"
77 # After the second run, exit-code should be present.
79 "126-list-thread-groups" \
80 "126\\^done,groups=\\\[\{id=\"i1\",type=\"process\",exit-code=\"010\",executable=\".*\"\}\]" \
81 "-list-thread-groups after exit shows exit-code"
85 test_list_thread_groups