* gdb.mi/mi-nonstop.exp: Do not call perror if non-stop mode is
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-ns-stale-regcache.exp
CommitLineData
e66408ed
PA
1# Copyright 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
2# Free Software Foundation, Inc.
3
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17# Regression test for PR11557. Make sure we don't end up with a stale
18# register cache just after resuming a thread.
19
20load_lib mi-support.exp
21set MIFLAGS "-i=mi"
22
23gdb_exit
24if {[mi_gdb_start]} {
25 continue
26}
27
28proc mi_nonstop_resume { command test } {
29 if { [mi_send_resuming_command $command $test] != 0 } {
30 # If a resume fails, assume non-stop is broken or unsupported
31 # for this target. We have logged a FAIL or UNSUPPORTED; skip
32 # the remaining tests to limit timeouts.
33 return -code continue
34 }
35}
36
37#
38# Start here
39#
40set testfile "ns-stale-regcache"
41set srcfile "$testfile.c"
42set binfile "$objdir/$subdir/mi-$testfile"
43
44set options [list debug incdir=$objdir]
45if {[gdb_compile "$srcdir/$subdir/$srcfile" \
46 $binfile executable $options] != "" } {
47 return -1
48}
49
50mi_gdb_reinitialize_dir $srcdir/$subdir
51mi_gdb_load $binfile
52
53set supported 0
ec9f1212 54gdb_test_multiple "-gdb-show non-stop" "" {
e66408ed
PA
55 -re ".*\\^done,value=\"off\",supported=\"(\[^\"\]+)\"\r\n$mi_gdb_prompt$" {
56 if { $expect_out(1,string) == "1" } {
57 set supported 1
58 }
59 }
ec9f1212 60 -re ".*$mi_gdb_prompt$" {
e66408ed
PA
61 }
62}
63
64mi_gdb_test "-gdb-set non-stop 1" ".*"
65mi_gdb_test "-gdb-set target-async 1" ".*"
66detect_async
67
68if { [mi_run_to_main] < 0 } {
e66408ed
PA
69 continue
70}
71
72# Check that register and stack info don't end up stale after resuming
73# a thread.
74mi_nonstop_resume "exec-continue" "resume thread"
75
76mi_gdb_test "-data-evaluate-expression \$pc" \
77 "\\^error,msg=\".*\"" "no stale register cache of resumed thread"
78
79mi_gdb_test "-stack-info-frame" \
80 "\\^error,msg=\".*\"" "no stale frame info of resumed thread"
81
82# Check that the thread is still running. If the above tests passed,
83# we want it to be for the right reasons.
84mi_check_thread_states {"running"} "main thread still running"
85
86mi_gdb_exit
This page took 0.043454 seconds and 4 git commands to generate.