Add casts for legitimate integer to enum conversions
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / valgrind-infcall.exp
CommitLineData
32d0add0 1# Copyright 2012-2015 Free Software Foundation, Inc.
a14dd77e
JK
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
16if [is_remote target] {
17 # The test always runs locally.
18 return 0
19}
20
62cef515
TT
21standard_testfile .c
22if {[build_executable $testfile.exp $testfile $srcfile {debug}] == -1} {
a14dd77e
JK
23 return -1
24}
25
26set test "spawn valgrind"
27set cmd "valgrind --vgdb-error=0 $binfile"
4ec70201 28set res [remote_spawn host $cmd]
a14dd77e
JK
29if { $res < 0 || $res == "" } {
30 verbose -log "Spawning $cmd failed."
31 unsupported $test
32 return -1
33}
34pass $test
35# Declare GDB now as running.
717cf30c 36set gdb_spawn_id $res
a14dd77e
JK
37
38# GDB started by vgdb stops already after the startup is executed, like with
39# non-extended gdbserver. It is also not correct to run/attach the inferior.
40set use_gdb_stub 1
41
42set test "valgrind started"
43# The trailing '.' differs for different memcheck versions.
44gdb_test_multiple "" $test {
45 -re "Memcheck, a memory error detector\\.?\r\n" {
46 pass $test
47 }
48 -re "valgrind: failed to start tool 'memcheck' for platform '.*': No such file or directory" {
49 unsupported $test
50 return -1
51 }
52 -re "valgrind: wrong ELF executable class" {
53 unsupported $test
54 return -1
55 }
56 -re "command not found" {
57 # The spawn succeeded, but then valgrind was not found - e.g. if
58 # we spawned SSH to a remote system.
59 unsupported $test
60 return -1
61 }
a967a851 62 -re "valgrind: Bad option.*--vgdb-error=0" {
a14dd77e
JK
63 # valgrind is not >= 3.7.0.
64 unsupported $test
65 return -1
66 }
67}
68
69set test "vgdb prompt"
70# The trailing '.' differs for different memcheck versions.
71gdb_test_multiple "" $test {
72 -re " (target remote | \[^\r\n\]*/vgdb \[^\r\n\]*)\r\n" {
73 set vgdbcmd $expect_out(1,string)
74 pass $test
75 }
76}
77
78# Do not kill valgrind.
2c8c5d37 79set valgrind_spawn_id [board_info host fileid]
a14dd77e
JK
80unset gdb_spawn_id
81set board [host_info name]
82unset_board_info fileid
83
62cef515 84clean_restart $testfile
a14dd77e 85
0eae2cf4 86gdb_test "$vgdbcmd" " in \\.?_start .*" "target remote for vgdb"
a14dd77e
JK
87
88gdb_test "monitor v.set gdb_output" "valgrind output will go to gdb.*"
89
90set continue_count 1
5888842d
JK
91set loop 1
92while {$loop && $continue_count < 100} {
a14dd77e
JK
93 set test "continue #$continue_count"
94 gdb_test_multiple "continue" "" {
95 -re "Invalid free\\(\\).*: main .*\r\n$gdb_prompt $" {
96 pass $test
5888842d 97 set loop 0
a14dd77e 98 }
0eae2cf4
EBM
99 -re "Remote connection closed.*\r\n$gdb_prompt $" {
100 fail "$test (remote connection closed)"
a09ae1c1 101 # Only if valgrind got stuck.
2c8c5d37 102 kill_wait_spawned_process $valgrind_spawn_id
0eae2cf4
EBM
103 return -1
104 }
5888842d
JK
105 -re "The program is not being run\\.\r\n$gdb_prompt $" {
106 fail "$test (valgrind vgdb has terminated)"
a09ae1c1 107 # Only if valgrind got stuck.
2c8c5d37 108 kill_wait_spawned_process $valgrind_spawn_id
5888842d
JK
109 return -1
110 }
a14dd77e
JK
111 -re "\r\n$gdb_prompt $" {
112 pass "$test (false warning)"
113 }
114 }
115 set continue_count [expr $continue_count + 1]
116}
117
118set test "p gdb_test_infcall ()"
119gdb_test_multiple $test $test {
120 -re "unhandled instruction bytes.*\r\n$gdb_prompt $" {
121 fail $test
122 }
123 -re "Continuing \\.\\.\\..*\r\n\\\$1 = 2\r\n$gdb_prompt $" {
124 pass $test
125 }
126}
6447023f
JK
127
128# Only if valgrind got stuck.
2c8c5d37 129kill_wait_spawned_process $valgrind_spawn_id
This page took 0.400361 seconds and 4 git commands to generate.