]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.multi/bkpt-multi-exec.exp
Adding files to HEAD that cvs had declared dead due to existing on
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.multi / bkpt-multi-exec.exp
CommitLineData
b321dd90
PA
1# Copyright 2009 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
16if { [is_remote target] || ![isnative] } then {
17 continue
18}
19
20set testfile "bkpt-multi-exec"
21
22set exec1 "bkpt-multi-exec"
23set srcfile1 ${exec1}.c
24set binfile1 ${objdir}/${subdir}/${exec1}
25
26set exec2 "crashme"
27set srcfile2 ${exec2}.c
28set binfile2 ${objdir}/${subdir}/${exec2}
29
30if { [prepare_for_testing ${testfile}.exp ${exec1} "${srcfile1}" {debug nowarnings}] } {
31 return -1
32}
33
34if { [prepare_for_testing ${testfile}.exp ${exec2} "${srcfile2}" {debug nowarnings}] } {
35 return -1
36}
37# Until "catch exec" is implemented on other targets...
38#
39if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then {
40 continue
41}
42
43# Start with a fresh gdb
44
45gdb_exit
46gdb_start
47gdb_reinitialize_dir $srcdir/$subdir
48gdb_load ${binfile1}
49
50# Start the program running, and stop at main.
51#
52if ![runto_main] then {
53 perror "Couldn't run ${binfile1}"
54 return
55}
56
57delete_breakpoints
58
59# continuing should exec and trigger the bug
60gdb_test "continue" "SIGSEGV.*"
61
62# Start over, but this time, set a breakpoint before the app crashes.
63
64gdb_exit
65gdb_start
66gdb_reinitialize_dir $srcdir/$subdir
67gdb_load ${binfile1}
68
69gdb_test "add-inferior -exec ${binfile2}"
70
71set bp_location [gdb_get_line_number "set breakpoint here" ${srcfile2}]
72
73gdb_test "inferior 2"
74gdb_test "break ${srcfile2}:${bp_location}" ""
75
76# Start the program running, and stop at main.
77#
78gdb_test "inferior 1"
79
80# Now run to the breakpoint. This should cross the exec, and stop at
81# the breakpoint before the crash.
82gdb_test "run" "${srcfile2}:${bp_location}.*set breakpoint here.*"
83
84return 0