Fix null pointer dereference in process_debug_info()
[binutils-gdb.git] / gdb / testsuite / gdb.opt / solib-intra-step.exp
blob67f894c2dc00689f07773f9f5fe130e8a56dab6e
1 # Copyright 2015-2024 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 standard_testfile
18 require allow_shlib_tests
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}]
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
37 clean_restart ${binfile}
38 gdb_load_shlib $binfile_lib
40 if {![runto_main]} {
41 return 0
44 set test "first-hit"
45 gdb_test_multiple "step" $test {
46 -re -wrap " first-hit .*" {
47 pass $gdb_test_name
49 -re -wrap " first-retry .*" {
50 send_gdb "step\n"
51 exp_continue
53 -re -wrap "get_pc_thunk.*" {
54 send_gdb "step\n"
55 exp_continue
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
70 -re -wrap " first-hit .*" {
71 if { $in_second } {
72 fail $gdb_test_name
73 } else {
74 send_gdb "step\n"
75 exp_continue
78 -re -wrap " second-hit .*" {
79 pass $gdb_test_name
81 -re -wrap " second-retry .*" {
82 set in_second 1
83 send_gdb "step\n"
84 exp_continue
86 -re -wrap "get_pc_thunk.*" {
87 set in_second 1
88 send_gdb "step\n"
89 exp_continue
93 if {![runto_main]} {
94 return 0
97 gdb_breakpoint "shlib_second"
98 gdb_continue_to_breakpoint "second-hit" ".* (second-hit|second-retry) .*"