Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2015-2020 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 { | |
52 | -re " first-hit .*\r\n$gdb_prompt $" { | |
53 | pass $test | |
54 | } | |
55 | -re " first-retry .*\r\n$gdb_prompt $" { | |
56 | gdb_test "step" " first-hit .*" "first-hit (optimized)" | |
57 | } | |
58 | } | |
59 | ||
60 | set test "second-hit" | |
61 | gdb_test_multiple "step" $test { | |
62 | -re " second-hit .*\r\n$gdb_prompt $" { | |
63 | pass $test | |
64 | } | |
65 | -re " first-retry .*\r\n$gdb_prompt $" { | |
66 | set test "second-hit (optimized 1)" | |
67 | gdb_test_multiple "step" $test { | |
68 | -re " second-hit .*\r\n$gdb_prompt $" { | |
69 | pass $test | |
70 | } | |
71 | -re " first-hit .*\r\n$gdb_prompt $" { | |
72 | gdb_test "step" " second-hit .*" "second-hit (optimized 2)" | |
73 | } | |
74 | } | |
75 | } | |
76 | -re " second-retry .*\r\n$gdb_prompt $" { | |
77 | gdb_test "step" " second-hit .*" "second-hit (optimized 3)" | |
78 | } | |
79 | } | |
80 | ||
81 | if ![runto_main] then { | |
82 | return 0 | |
83 | } | |
84 | ||
85 | gdb_breakpoint "shlib_second" | |
86 | gdb_continue_to_breakpoint "second-hit" ".* (second-hit|second-retry) .*" |