]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.multi/bkpt-multi-exec.exp
RISC-V: PR31733, Change initial CFI operation from DW_CFA_def_cfa_register to DW_CFA_...
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.multi / bkpt-multi-exec.exp
CommitLineData
1d506c26 1# Copyright 2009-2024 Free Software Foundation, Inc.
b321dd90
PA
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
ec1300f6 16require target_can_use_run_cmd
b321dd90 17
2d4e0376
YQ
18# Until "catch exec" is implemented on other targets...
19#
0216141a 20if {![istarget "*-linux*"]} {
cdd42066 21 return
2d4e0376
YQ
22}
23
b321dd90
PA
24set testfile "bkpt-multi-exec"
25
26set exec1 "bkpt-multi-exec"
27set srcfile1 ${exec1}.c
7bb18ae2 28set binfile1 [standard_output_file ${exec1}]
b321dd90
PA
29
30set exec2 "crashme"
31set srcfile2 ${exec2}.c
7bb18ae2 32set binfile2 [standard_output_file ${exec2}]
b321dd90 33
762f7747 34set compile_options {debug}
3fef966c
TT
35
36if { [build_executable ${testfile}.exp ${exec1} "${srcfile1}" $compile_options] == -1 } {
b321dd90
PA
37 return -1
38}
39
3fef966c 40if { [build_executable ${testfile}.exp ${exec2} "${srcfile2}" $compile_options] == -1 } {
b321dd90
PA
41 return -1
42}
b321dd90
PA
43
44# Start with a fresh gdb
45
d8053d4d 46clean_restart ${exec1}
b321dd90
PA
47
48# Start the program running, and stop at main.
49#
0216141a 50if {![runto_main]} {
b321dd90
PA
51 return
52}
53
54delete_breakpoints
55
56# continuing should exec and trigger the bug
57gdb_test "continue" "SIGSEGV.*"
58
59# Start over, but this time, set a breakpoint before the app crashes.
60
d8053d4d 61clean_restart ${exec1}
b321dd90 62
d8053d4d
PA
63gdb_test "add-inferior -exec ${binfile2}" \
64 "Added inferior 2.*" \
65 "add inferior 2 with -exec ${exec2}"
b321dd90
PA
66
67set bp_location [gdb_get_line_number "set breakpoint here" ${srcfile2}]
68
69gdb_test "inferior 2"
f6978de9 70gdb_test "break ${srcfile2}:${bp_location}" ".*"
b321dd90
PA
71
72# Start the program running, and stop at main.
73#
74gdb_test "inferior 1"
75
76# Now run to the breakpoint. This should cross the exec, and stop at
77# the breakpoint before the crash.
78gdb_test "run" "${srcfile2}:${bp_location}.*set breakpoint here.*"