]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | # Copyright 2009-2024 Free Software Foundation, Inc. |
9f2982ff 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 | ||
4f69f0a2 | 16 | # Valgrind gdbserver requires gdb with xml support. |
b963a97f | 17 | require allow_xml_test |
60767909 | 18 | |
68b9ac18 TV |
19 | load_lib valgrind.exp |
20 | ||
52c0551e | 21 | require {!is_remote target} |
75d9f9ff | 22 | |
62cef515 TT |
23 | standard_testfile .c |
24 | if {[build_executable $testfile.exp $testfile $srcfile {debug}] == -1} { | |
9f2982ff JK |
25 | return -1 |
26 | } | |
27 | ||
68b9ac18 | 28 | if { [vgdb_start] == -1 } { |
9f2982ff JK |
29 | return -1 |
30 | } | |
bfcc0eba | 31 | |
9f2982ff JK |
32 | set double_free [gdb_get_line_number "double-free"] |
33 | ||
6d5702a5 CL |
34 | gdb_breakpoint "main" |
35 | ||
bfcc0eba TV |
36 | set test "continue" |
37 | gdb_test_multiple "continue" $test { | |
38 | -re "Invalid free\\(\\).*: main \\(${srcfile}:$double_free\\)\r\n.*$gdb_prompt $" { | |
39 | pass $test | |
40 | } | |
41 | -re "Remote connection closed.*\r\n$gdb_prompt $" { | |
42 | fail "$test (remote connection closed)" | |
43 | # Only if valgrind got stuck. | |
44 | kill_wait_spawned_process $valgrind_spawn_id | |
45 | return -1 | |
9f2982ff | 46 | } |
bfcc0eba TV |
47 | -re "The program is not being run\\.\r\n$gdb_prompt $" { |
48 | fail "$test (valgrind vgdb has terminated)" | |
49 | # Only if valgrind got stuck. | |
50 | kill_wait_spawned_process $valgrind_spawn_id | |
51 | return -1 | |
52 | } | |
53 | -re "\r\n$gdb_prompt $" { | |
54 | pass "$test (false warning)" | |
9f2982ff JK |
55 | } |
56 | } | |
57 | ||
9f2982ff | 58 | # Initialization from default_gdb_start. |
27d3a1a2 MS |
59 | gdb_test_no_output "set height 0" |
60 | gdb_test_no_output "set width 0" | |
9f2982ff | 61 | |
6d5702a5 | 62 | gdb_test "bt" "#\[0-9 ]+main \\(.*\\) at .*${srcfile}.*" |
a391a2f6 PA |
63 | |
64 | # Explicitly kill the program so it doesn't dump core when we quit->detach. | |
65 | gdb_test "kill" "" "kill program" "Kill the program being debugged.*y or n. $" "y" | |
bfcc0eba | 66 | |
68b9ac18 | 67 | vgdb_stop |