Commit | Line | Data |
---|---|---|
7b6bb8da | 1 | # Copyright 2009, 2010, 2011 Free Software Foundation, Inc. |
02d9a9ce 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 | ||
16 | if $tracelevel then { | |
17 | strace $tracelevel | |
18 | } | |
19 | ||
20 | load_lib "ada.exp" | |
21 | ||
22 | set testdir "tasks" | |
23 | set testfile "${testdir}/foo" | |
24 | set srcfile ${srcdir}/${subdir}/${testfile}.adb | |
25 | set binfile ${objdir}/${subdir}/${testfile} | |
26 | ||
27 | file mkdir ${objdir}/${subdir}/${testdir} | |
28 | if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } { | |
29 | return -1 | |
30 | } | |
31 | ||
09050809 | 32 | clean_restart ${testfile} |
02d9a9ce JB |
33 | |
34 | set bp_location [gdb_get_line_number "STOP_HERE" ${testdir}/foo.adb] | |
35 | runto "foo.adb:$bp_location" | |
36 | ||
37 | # Make sure that all tasks appear in the "info tasks" listing, and | |
38 | # that the active task is the environment task. | |
39 | gdb_test "info tasks" \ | |
40 | [join {" ID TID P-ID Pri State Name" \ | |
41 | "\\* 1 .* main_task" \ | |
42 | " 2 .* task_list\\(1\\)" \ | |
43 | " 3 .* task_list\\(2\\)" \ | |
44 | " 4 .* task_list\\(3\\)"} \ | |
45 | "\r\n"] \ | |
46 | "info tasks before inserting breakpoint" | |
47 | ||
48 | # Now, insert a breakpoint that should stop only if task 3 stops. | |
49 | gdb_test "break break_me task 3" "Breakpoint .* at .*" | |
50 | ||
51 | # Continue to that breakpoint. Task 2 should hit it first, and GDB | |
52 | # is expected to ignore that hit and resume the execution. Only then | |
53 | # task 3 will hit our breakpoint, and GDB is expected to stop at that | |
54 | # point. | |
55 | gdb_test "continue" \ | |
56 | ".*Breakpoint.*, foo.break_me \\(\\).*" \ | |
57 | "continue to breakpoint" | |
58 | ||
59 | # Check that it is indeed task 3 that hit the breakpoint by checking | |
60 | # which is the active task. | |
61 | gdb_test "info tasks" \ | |
62 | [join {" ID TID P-ID Pri State Name" \ | |
63 | " 1 .* main_task" \ | |
64 | " 2 .* task_list\\(1\\)" \ | |
65 | "\\* 3 .* task_list\\(2\\)" \ | |
66 | " 4 .* task_list\\(3\\)"} \ | |
67 | "\r\n"] \ | |
68 | "info tasks after hitting breakpoint" | |
69 | ||
70 | # Now, resume the execution and make sure that GDB does not stop when | |
71 | # task 4 hits the breakpoint. Continuing thus results in our program | |
72 | # running to completion. | |
fda326dd | 73 | gdb_continue_to_end |
02d9a9ce | 74 |