Output the Ada task name in more messages.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.ada / task_switch_in_core.exp
CommitLineData
42a4f53d 1# Copyright 2017-2019 Free Software Foundation, Inc.
e05fa6f9
JB
2
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.
7#
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.
12#
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/>.
15
16load_lib "ada.exp"
17
18standard_ada_testfile crash
19
20if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
21 return -1
22}
23
24clean_restart ${testfile}
25
26# Run the program to a certain point, and then use the gcore command
27# to generate a core file. The only objective of this part of this
28# testcase is to generate this core file, so we can then exercise
29# task-switching when debugging from core files.
30
31if { ![runto request_for_crash ]} then {
32 untested "couldn't run to Request_For_Crash"
33 return -1
34}
35
36set corefile [standard_output_file crash.gcore]
37set core_supported [gdb_gcore_cmd "$corefile" "save a corefile"]
38if {!$core_supported} {
39 return -1
40}
41
42# Now taht the core file has been created, we can start the real
43# part of this testcase, which is to debug using that core file.
44# Restart GDB and load that core file.
45
46clean_restart ${testfile}
47
48set core_loaded [gdb_core_cmd "$corefile" "re-load generated corefile"]
49if { $core_loaded == -1 } {
50 # No use proceeding from here.
51 return
52}
53
54# First, switch to task 1.
55
56gdb_test "task 1" \
57 "crash\\.request_for_crash \\(\\) at .*crash\\.adb:$decimal.*"
58
59
60gdb_test "info tasks" \
61 [multi_line "\\s+ID\\s+TID\\s+P-ID\\s+Pri\\s+State\\s+Name" \
62 "\\*\\s+1\\s+.*main_task" \
63 "\\s+2.*my_t"] \
64 "info tasks after switching to task 1"
65
66# Switch to task 2. Unlike in the case where we tested the switch to
67# task 1, don't check the location where the debugger says the program
68# is, as this might depend on the runtime, and in particular it might
69# depend on whether the runtime is built with debugging information
70# or not. Just check that we get the "switching to task" message, and
71# we will verify right after with an additional test that the current
72# task is now task 2.
73gdb_test "task 2" \
4993045d 74 "\\\[Switching to task 2 \"my_t\"\\\].*"
e05fa6f9
JB
75
76gdb_test "info tasks" \
77 [multi_line "\\s+ID\\s+TID\\s+P-ID\\s+Pri\\s+State\\s+Name" \
78 "\\s+1\\s+.*main_task" \
79 "\\*\\s+2.*my_t"] \
80 "info tasks after switching to task 2"
This page took 0.237183 seconds and 4 git commands to generate.