Commit | Line | Data |
---|---|---|
9addecb9 TT |
1 | # Copyright 2012 Free Software Foundation, Inc. |
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 | if { [is_remote target] || ![isnative] } then { | |
17 | unsupported "inferior-died.exp" | |
18 | continue | |
19 | } | |
20 | ||
21 | # Until "set follow-fork-mode" and "catch fork" are implemented on | |
22 | # other targets... | |
23 | # | |
24 | if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-*-linux*"]} then { | |
25 | unsupported "inferior-died.exp" | |
26 | continue | |
27 | } | |
28 | ||
29 | if { ![support_displaced_stepping] } { | |
30 | unsupported "inferior-died.exp" | |
31 | return -1 | |
32 | } | |
33 | ||
34 | set testfile "inferior-died" | |
35 | set srcfile ${testfile}.c | |
36 | set binfile ${objdir}/${subdir}/${testfile} | |
37 | ||
38 | if { [prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.c] } { | |
39 | return -1 | |
40 | } | |
41 | ||
42 | gdb_test_no_output "set detach-on-fork off" | |
43 | gdb_test_no_output "set target-async on" | |
44 | gdb_test_no_output "set non-stop on" | |
45 | ||
46 | if ![runto_main] { | |
47 | return | |
48 | } | |
49 | ||
50 | set line [gdb_get_line_number "Break here"] | |
51 | gdb_breakpoint $srcfile:$line | |
52 | ||
53 | gdb_continue_to_breakpoint "breakpoint" | |
54 | ||
55 | gdb_test "inferior 2" "Switching to inferior 2.*" | |
35dc4a6b JK |
56 | |
57 | # The inferior 1 exit may come unexpectedly in any moment. | |
58 | set test "continue" | |
59 | set seen 0 | |
60 | gdb_test_multiple $test $test { | |
61 | -re "($gdb_prompt |\\\[Inferior \[^\r\n\]* exited normally\\\])" { | |
62 | incr seen | |
63 | if {$seen < 3} { | |
64 | exp_continue | |
65 | } | |
66 | pass $test | |
67 | } | |
68 | } | |
69 | ||
70 | # Internal error may show up after all the messages above. | |
71 | gdb_test "p 1" " = 1" |