]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | # Copyright 2009-2024 Free Software Foundation, Inc. |
8a18382f TT |
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 | # Test task-specific watchpoints. | |
17 | ||
18 | load_lib "ada.exp" | |
19 | ||
74dcf082 | 20 | require allow_ada_tests |
8a18382f | 21 | |
e379cbb1 | 22 | require allow_hw_watchpoint_tests |
14970066 | 23 | |
8a18382f TT |
24 | standard_ada_testfile foo |
25 | ||
26 | if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} { | |
27 | return -1 | |
28 | } | |
29 | ||
30 | clean_restart ${testfile} | |
31 | ||
32 | set bp_location [gdb_get_line_number "STOP_HERE" ${testdir}/foo.adb] | |
33 | runto "foo.adb:$bp_location" | |
34 | ||
35 | # Make sure that all tasks appear in the "info tasks" listing, and | |
36 | # that the active task is the environment task. | |
37 | gdb_test "info tasks" \ | |
38 | [join {" +ID +TID P-ID Pri State +Name" \ | |
39 | "\\* +1 .* main_task" \ | |
40 | " +2 .* task_list\\(1\\)" \ | |
41 | " +3 .* task_list\\(2\\)" \ | |
42 | " +4 .* task_list\\(3\\)"} \ | |
43 | "\r\n"] \ | |
44 | "info tasks before inserting breakpoint" | |
45 | ||
46 | # Insert a watchpoint that should stop only if task 3 stops, and | |
47 | # extract its number. | |
48 | set bp_number -1 | |
49 | set test "watch -location value task 3" | |
50 | gdb_test_multiple $test $test { | |
51 | -re "atchpoint ($decimal): -location value\r\n$gdb_prompt $" { | |
52 | set bp_number $expect_out(1,string) | |
53 | pass $test | |
54 | } | |
55 | } | |
56 | ||
57 | if {$bp_number < 0} { | |
58 | return | |
59 | } | |
60 | ||
61 | # Continue to that watchpoint. Task 2 should hit it first, and GDB | |
62 | # is expected to ignore that hit and resume the execution. Only then | |
63 | # task 3 will hit our watchpoint, and GDB is expected to stop at that | |
64 | # point. Also make sure that GDB reports the correct watchpoint number. | |
65 | gdb_test "continue" \ | |
66 | ".* hit .*atchpoint $bp_number: -location value.*Old value = 1.*New value = 2.*" \ | |
67 | "continue to watchpoint" | |
68 | ||
69 | # Check that it is indeed task 3 that hit the watchpoint by checking | |
70 | # which is the active task. | |
71 | gdb_test "info tasks" \ | |
72 | [join {" +ID +TID P-ID Pri State +Name" \ | |
73 | " +1 .* main_task" \ | |
74 | " +2 .* task_list\\(1\\)" \ | |
75 | "\\* +3 .* task_list\\(2\\)" \ | |
76 | " +4 .* task_list\\(3\\)"} \ | |
77 | "\r\n"] \ | |
78 | "info tasks after hitting watchpoint" | |
79 | ||
80 | # Now, resume the execution and make sure that GDB does not stop when | |
81 | # task 4 hits the watchpoint. Continuing thus results in our program | |
82 | # running to completion. | |
83 | set bp_location [gdb_get_line_number "STOP_HERE_2" ${testdir}/foo.adb] | |
84 | gdb_breakpoint foo.adb:$bp_location | |
85 | gdb_continue_to_breakpoint second ".*foo.adb:$bp_location.*null; -- STOP_HERE_2" |