1 # Copyright 2017-2021 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 if { [skip_ada_tests] } { return -1 }
20 standard_ada_testfile crash
22 if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
26 clean_restart ${testfile}
28 # Run the program to a certain point, and then use the gcore command
29 # to generate a core file. The only objective of this part of this
30 # testcase is to generate this core file, so we can then exercise
31 # task-switching when debugging from core files.
33 if { ![runto request_for_crash ]} then {
34 untested "couldn't run to Request_For_Crash"
38 set corefile [standard_output_file crash.gcore]
39 set core_supported [gdb_gcore_cmd "$corefile" "save a corefile"]
40 if {!$core_supported} {
44 # Now taht the core file has been created, we can start the real
45 # part of this testcase, which is to debug using that core file.
46 # Restart GDB and load that core file.
48 clean_restart ${testfile}
50 set core_loaded [gdb_core_cmd "$corefile" "re-load generated corefile"]
51 if { $core_loaded == -1 } {
52 # No use proceeding from here.
56 # First, switch to task 1.
59 "crash\\.request_for_crash \\(\\) at .*crash\\.adb:$decimal.*"
62 gdb_test "info tasks" \
63 [multi_line "\\s+ID\\s+TID\\s+P-ID\\s+Pri\\s+State\\s+Name" \
64 "\\*\\s+1\\s+.*main_task" \
66 "info tasks after switching to task 1"
68 # Switch to task 2. Unlike in the case where we tested the switch to
69 # task 1, don't check the location where the debugger says the program
70 # is, as this might depend on the runtime, and in particular it might
71 # depend on whether the runtime is built with debugging information
72 # or not. Just check that we get the "switching to task" message, and
73 # we will verify right after with an additional test that the current
76 "\\\[Switching to task 2 \"my_t\"\\\].*"
78 gdb_test "info tasks" \
79 [multi_line "\\s+ID\\s+TID\\s+P-ID\\s+Pri\\s+State\\s+Name" \
80 "\\s+1\\s+.*main_task" \
82 "info tasks after switching to task 2"