OLD | NEW |
1 # Copyright 2002-2005, 2007-2012 Free Software Foundation, Inc. | 1 # Copyright 2011-2012 Free Software Foundation, Inc. |
2 | 2 |
3 # This program is free software; you can redistribute it and/or modify | 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 | 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 | 5 # the Free Software Foundation; either version 3 of the License, or |
6 # (at your option) any later version. | 6 # (at your option) any later version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 # | 12 # |
13 # You should have received a copy of the GNU General Public License | 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/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 |
16 # Regression test for PR11557. Make sure we don't end up with a stale | 16 if [target_info exists gdb,no_hardware_watchpoints] { |
17 # register cache just after resuming a thread. | 17 return -1 |
| 18 } |
18 | 19 |
19 if { ![support_displaced_stepping] } { | 20 if { ![support_displaced_stepping] } { |
20 unsupported "displaced stepping" | 21 unsupported "displaced stepping" |
21 return -1 | 22 return -1 |
22 } | 23 } |
23 | 24 |
24 load_lib mi-support.exp | 25 load_lib mi-support.exp |
25 set MIFLAGS "-i=mi" | 26 set MIFLAGS "-i=mi" |
26 | 27 |
27 gdb_exit | 28 gdb_exit |
28 if {[mi_gdb_start]} { | 29 if {[mi_gdb_start]} { |
29 continue | 30 continue |
30 } | 31 } |
31 | 32 |
32 proc mi_nonstop_resume { command test } { | 33 proc mi_nonstop_resume { command test } { |
33 if { [mi_send_resuming_command $command $test] != 0 } { | 34 if { [mi_send_resuming_command $command $test] != 0 } { |
34 # If a resume fails, assume non-stop is broken or unsupported | 35 # If a resume fails, assume non-stop is broken or unsupported |
35 # for this target. We have logged a FAIL or UNSUPPORTED; skip | 36 # for this target. We have logged a FAIL or UNSUPPORTED; skip |
36 # the remaining tests to limit timeouts. | 37 # the remaining tests to limit timeouts. |
37 return -code continue | 38 return -code continue |
38 } | 39 } |
39 } | 40 } |
40 | 41 |
41 # | 42 # |
42 # Start here | 43 # Start here |
43 # | 44 # |
44 set testfile "ns-stale-regcache" | 45 standard_testfile watch-nonstop.c |
45 set srcfile "$testfile.c" | |
46 set binfile "$objdir/$subdir/mi-$testfile" | |
47 | 46 |
48 set options [list debug incdir=$objdir] | 47 if {[gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable {debug}] != "" }
{ |
49 if {[gdb_compile "$srcdir/$subdir/$srcfile" \ | |
50 » $binfile executable $options] != "" } { | |
51 return -1 | 48 return -1 |
52 } | 49 } |
53 | 50 |
54 mi_gdb_reinitialize_dir $srcdir/$subdir | 51 mi_gdb_reinitialize_dir $srcdir/$subdir |
55 mi_gdb_load $binfile | 52 mi_gdb_load $binfile |
56 | 53 |
57 mi_gdb_test "-gdb-set non-stop 1" ".*" | 54 mi_gdb_test "-gdb-set non-stop 1" ".*" |
58 mi_gdb_test "-gdb-set target-async 1" ".*" | 55 mi_gdb_test "-gdb-set target-async 1" ".*" |
59 mi_detect_async | 56 mi_detect_async |
60 | 57 |
61 if { [mi_run_to_main] < 0 } { | 58 if { [mi_run_to_main] < 0 } { |
62 continue | 59 continue |
63 } | 60 } |
64 | 61 |
65 # Check that register and stack info don't end up stale after resuming | 62 # Set a watchpoint. |
66 # a thread. | 63 mi_gdb_test "111-break-watch global" \ |
67 mi_nonstop_resume "exec-continue" "resume thread" | 64 "111\\^done,wpt=\{number=\"2\",exp=\"global\"\}" \ |
| 65 "break-watch operation" |
68 | 66 |
69 mi_gdb_test "-data-evaluate-expression \$pc" \ | 67 # Set the target running. |
70 "\\^error,msg=\".*\"" "no stale register cache of resumed thread" | 68 mi_nonstop_resume "exec-continue" "resume 1" |
71 | 69 |
72 mi_gdb_test "-stack-info-frame" \ | 70 # Now try deleting the watchpoint. This would fail with "Couldn't |
73 "\\^error,msg=\".*\"" "no stale frame info of resumed thread" | 71 # write debug register: No such process." on GNU/Linux, because we'd |
74 | 72 # try to poke at the debug registers of a running thread. |
75 # Check that the thread is still running. If the above tests passed, | 73 mi_gdb_test "777-break-delete 2" \ |
76 # we want it to be for the right reasons. | 74 "777\\^done" \ |
77 mi_check_thread_states {"running"} "main thread still running" | 75 "delete watchpoint" |
78 | |
79 mi_gdb_exit | |
OLD | NEW |