Commit | Line | Data |
---|---|---|
88b9d363 | 1 | # Copyright 2015-2022 Free Software Foundation, Inc. |
141c5cc4 JK |
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 | if {[skip_shlib_tests]} { | |
19 | return 0 | |
20 | } | |
21 | ||
22 | # Library file. | |
23 | set libname "${testfile}-lib" | |
24 | set srcfile_lib ${srcdir}/${subdir}/${libname}.c | |
25 | set binfile_lib [standard_output_file ${libname}.so] | |
26 | set lib_flags [list debug optimize=-O2] | |
27 | # Binary file. | |
28 | set testfile "${testfile}-main" | |
29 | set srcfile ${srcdir}/${subdir}/${testfile}.c | |
30 | set binfile [standard_output_file ${testfile}] | |
31 | set bin_flags [list debug shlib=${binfile_lib}] | |
32 | ||
33 | if [get_compiler_info] { | |
34 | return -1 | |
35 | } | |
36 | ||
37 | if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != "" | |
38 | || [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } { | |
84c93cd5 | 39 | untested "failed to compile" |
141c5cc4 JK |
40 | return -1 |
41 | } | |
42 | ||
43 | clean_restart ${binfile} | |
d9019901 | 44 | gdb_load_shlib $binfile_lib |
141c5cc4 JK |
45 | |
46 | if ![runto_main] then { | |
47 | return 0 | |
48 | } | |
49 | ||
50 | set test "first-hit" | |
51 | gdb_test_multiple "step" $test { | |
d0021af3 | 52 | -re -wrap " first-hit .*" { |
620ec3ca | 53 | pass $gdb_test_name |
141c5cc4 | 54 | } |
d0021af3 | 55 | -re -wrap " first-retry .*" { |
d0021af3 TV |
56 | send_gdb "step\n" |
57 | exp_continue | |
58 | } | |
59 | -re -wrap "get_pc_thunk.*" { | |
d0021af3 TV |
60 | send_gdb "step\n" |
61 | exp_continue | |
141c5cc4 JK |
62 | } |
63 | } | |
64 | ||
65 | set test "second-hit" | |
66 | gdb_test_multiple "step" $test { | |
d0021af3 | 67 | -re -wrap " second-hit .*" { |
620ec3ca | 68 | pass $gdb_test_name |
141c5cc4 | 69 | } |
d0021af3 | 70 | -re -wrap " second-retry .*" { |
d0021af3 TV |
71 | send_gdb "step\n" |
72 | exp_continue | |
141c5cc4 | 73 | } |
d0021af3 | 74 | -re -wrap "get_pc_thunk.*" { |
d0021af3 TV |
75 | send_gdb "step\n" |
76 | exp_continue | |
141c5cc4 JK |
77 | } |
78 | } | |
79 | ||
80 | if ![runto_main] then { | |
81 | return 0 | |
82 | } | |
83 | ||
84 | gdb_breakpoint "shlib_second" | |
85 | gdb_continue_to_breakpoint "second-hit" ".* (second-hit|second-retry) .*" |