]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.opt/solib-intra-step.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.opt / solib-intra-step.exp
1 # Copyright 2015-2024 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 standard_testfile
17
18 require allow_shlib_tests
19
20 # Library file.
21 set libname "${testfile}-lib"
22 set srcfile_lib ${srcdir}/${subdir}/${libname}.c
23 set binfile_lib [standard_output_file ${libname}.so]
24 set lib_flags [list debug optimize=-O2]
25 # Binary file.
26 set testfile "${testfile}-main"
27 set srcfile ${srcdir}/${subdir}/${testfile}.c
28 set binfile [standard_output_file ${testfile}]
29 set bin_flags [list debug shlib=${binfile_lib}]
30
31 if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
32 || [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } {
33 untested "failed to compile"
34 return -1
35 }
36
37 clean_restart ${binfile}
38 gdb_load_shlib $binfile_lib
39
40 if {![runto_main]} {
41 return 0
42 }
43
44 set test "first-hit"
45 gdb_test_multiple "step" $test {
46 -re -wrap " first-hit .*" {
47 pass $gdb_test_name
48 }
49 -re -wrap " first-retry .*" {
50 send_gdb "step\n"
51 exp_continue
52 }
53 -re -wrap "get_pc_thunk.*" {
54 send_gdb "step\n"
55 exp_continue
56 }
57 }
58
59 set in_second 0
60 set test "second-hit"
61 gdb_test_multiple "step" $test {
62 -re -wrap " first-retry .*" {
63 if { $in_second } {
64 fail $gdb_test_name
65 } else {
66 send_gdb "step\n"
67 exp_continue
68 }
69 }
70 -re -wrap " first-hit .*" {
71 if { $in_second } {
72 fail $gdb_test_name
73 } else {
74 send_gdb "step\n"
75 exp_continue
76 }
77 }
78 -re -wrap " second-hit .*" {
79 pass $gdb_test_name
80 }
81 -re -wrap " second-retry .*" {
82 set in_second 1
83 send_gdb "step\n"
84 exp_continue
85 }
86 -re -wrap "get_pc_thunk.*" {
87 set in_second 1
88 send_gdb "step\n"
89 exp_continue
90 }
91 }
92
93 if {![runto_main]} {
94 return 0
95 }
96
97 gdb_breakpoint "shlib_second"
98 gdb_continue_to_breakpoint "second-hit" ".* (second-hit|second-retry) .*"