]>
Commit | Line | Data |
---|---|---|
3666a048 | 1 | # Copyright 2002-2021 Free Software Foundation, Inc. |
e66408ed PA |
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 | # Regression test for PR11557. Make sure we don't end up with a stale | |
17 | # register cache just after resuming a thread. | |
18 | ||
d5b4a7be YQ |
19 | if { ![support_displaced_stepping] } { |
20 | unsupported "displaced stepping" | |
21 | return -1 | |
22 | } | |
23 | ||
e66408ed PA |
24 | load_lib mi-support.exp |
25 | set MIFLAGS "-i=mi" | |
26 | ||
e66408ed PA |
27 | proc mi_nonstop_resume { command test } { |
28 | if { [mi_send_resuming_command $command $test] != 0 } { | |
29 | # If a resume fails, assume non-stop is broken or unsupported | |
30 | # for this target. We have logged a FAIL or UNSUPPORTED; skip | |
31 | # the remaining tests to limit timeouts. | |
32 | return -code continue | |
33 | } | |
34 | } | |
35 | ||
36 | # | |
37 | # Start here | |
38 | # | |
298a9cf0 | 39 | standard_testfile ns-stale-regcache.c |
e66408ed | 40 | |
298a9cf0 | 41 | set options [list debug] |
e66408ed PA |
42 | if {[gdb_compile "$srcdir/$subdir/$srcfile" \ |
43 | $binfile executable $options] != "" } { | |
44 | return -1 | |
45 | } | |
46 | ||
7cb2893d SM |
47 | save_vars { GDBFLAGS } { |
48 | append GDBFLAGS " -ex \"set non-stop on\"" | |
49 | mi_clean_restart $binfile | |
50 | } | |
e66408ed | 51 | |
329ea579 | 52 | mi_gdb_test "-gdb-set mi-async 1" ".*" |
fcdfa280 | 53 | mi_detect_async |
e66408ed | 54 | |
b75d55d4 | 55 | if { [mi_runto_main] < 0 } { |
e66408ed PA |
56 | continue |
57 | } | |
58 | ||
59 | # Check that register and stack info don't end up stale after resuming | |
60 | # a thread. | |
61 | mi_nonstop_resume "exec-continue" "resume thread" | |
62 | ||
63 | mi_gdb_test "-data-evaluate-expression \$pc" \ | |
64 | "\\^error,msg=\".*\"" "no stale register cache of resumed thread" | |
65 | ||
66 | mi_gdb_test "-stack-info-frame" \ | |
67 | "\\^error,msg=\".*\"" "no stale frame info of resumed thread" | |
68 | ||
69 | # Check that the thread is still running. If the above tests passed, | |
70 | # we want it to be for the right reasons. | |
71 | mi_check_thread_states {"running"} "main thread still running" | |
72 | ||
73 | mi_gdb_exit |