1 # Copyright 2009-2012 Free Software Foundation, Inc.
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.
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.
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/>.
16 if { [is_remote target] || ![isnative] } then {
20 # Until "catch exec" is implemented on other targets...
22 if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then {
26 set testfile "bkpt-multi-exec"
28 set exec1 "bkpt-multi-exec"
29 set srcfile1 ${exec1}.c
30 set binfile1 ${objdir}/${subdir}/${exec1}
33 set srcfile2 ${exec2}.c
34 set binfile2 ${objdir}/${subdir}/${exec2}
36 if { [prepare_for_testing ${testfile}.exp ${exec1} "${srcfile1}" {debug nowarnings}] } {
40 if { [prepare_for_testing ${testfile}.exp ${exec2} "${srcfile2}" {debug nowarnings}] } {
44 # Start with a fresh gdb
46 clean_restart ${exec1}
48 # Start the program running, and stop at main.
50 if ![runto_main] then {
51 perror "Couldn't run ${binfile1}"
57 # continuing should exec and trigger the bug
58 gdb_test "continue" "SIGSEGV.*"
60 # Start over, but this time, set a breakpoint before the app crashes.
62 clean_restart ${exec1}
64 gdb_test "add-inferior -exec ${binfile2}" \
65 "Added inferior 2.*" \
66 "add inferior 2 with -exec ${exec2}"
68 set bp_location [gdb_get_line_number "set breakpoint here" ${srcfile2}]
71 gdb_test "break ${srcfile2}:${bp_location}" ".*"
73 # Start the program running, and stop at main.
77 # Now run to the breakpoint. This should cross the exec, and stop at
78 # the breakpoint before the crash.
79 gdb_test "run" "${srcfile2}:${bp_location}.*set breakpoint here.*"