Commit | Line | Data |
---|---|---|
8acc9f48 | 1 | # Copyright 2009-2013 Free Software Foundation, Inc. |
28d41a99 MS |
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 | # This file is part of the GDB testsuite. It tests reverse debugging | |
17 | # with shared libraries. | |
18 | ||
d3895d7d | 19 | if ![supports_reverse] { |
28d41a99 MS |
20 | return |
21 | } | |
44883546 YQ |
22 | if {[skip_shlib_tests]} { |
23 | return | |
24 | } | |
28d41a99 | 25 | |
7686c074 | 26 | standard_testfile |
28d41a99 MS |
27 | set libfile "shr2" |
28 | set libsrc ${libfile}.c | |
7686c074 | 29 | set library [standard_output_file ${libfile}.sl] |
28d41a99 | 30 | |
4c93b1db | 31 | if [get_compiler_info] { |
28d41a99 MS |
32 | return -1 |
33 | } | |
34 | ||
35 | if { [gdb_compile_shlib ${srcdir}/${subdir}/${libsrc} ${library} "debug"] != "" } { | |
36 | untested "Could not compile shared library." | |
37 | return -1 | |
38 | } | |
39 | ||
40 | set exec_opts [list debug shlib=${library}] | |
41 | ||
42 | if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $exec_opts] != "" } { | |
43 | untested "Could not compile $binfile." | |
44 | return -1 | |
45 | } | |
46 | ||
47 | # Start with a fresh gdb. | |
48 | ||
49 | gdb_exit | |
50 | gdb_start | |
596ba138 JK |
51 | |
52 | # Clear it to never find any separate system debug infos. | |
53 | gdb_test_no_output "set debug-file-directory" | |
54 | ||
28d41a99 MS |
55 | gdb_reinitialize_dir $srcdir/$subdir |
56 | gdb_load ${binfile} | |
44883546 | 57 | gdb_load_shlibs $library |
28d41a99 MS |
58 | |
59 | runto main | |
60 | ||
d3895d7d | 61 | if [supports_process_record] { |
28d41a99 | 62 | # Activate process record/replay |
bcd2dc50 | 63 | gdb_test_no_output "record" "Turn on process record" |
28d41a99 MS |
64 | } |
65 | ||
66 | # | |
67 | # Test reverse-step over undebuggable solib functions. | |
68 | # | |
69 | ||
70 | # Run forward past some solib function calls. | |
71 | ||
72 | set end_part_one [gdb_get_line_number " end part one" "$srcfile"] | |
73 | set end_part_two [gdb_get_line_number " end part two" "$srcfile"] | |
74 | gdb_test "until $end_part_one" " end part one.*" "run until end part one" | |
75 | ||
76 | gdb_test "reverse-step" " sleep three .*" "reverse-step third sleep" | |
77 | gdb_test "reverse-step" " sleep two .*" "reverse-step second sleep" | |
78 | gdb_test "reverse-step" " sleep one .*" \ | |
79 | "reverse-step first sleep, dynsym resolve" | |
80 | ||
81 | gdb_test "reverse-step" " printf three .*" "reverse-step third printf" | |
82 | gdb_test "reverse-step" " printf two .*" "reverse-step second printf" | |
83 | gdb_test "reverse-step" " printf one .*" \ | |
84 | "reverse-step first printf, dynsym resolve" | |
85 | gdb_test "reverse-step" " generic statement.*" "reverse-step generic" | |
86 | ||
87 | ||
88 | # | |
89 | # Test reverse-next over undebuggable solib functions. | |
90 | # | |
91 | ||
92 | # Run forward again... | |
93 | ||
94 | gdb_test "until $end_part_one" " end part one.*" "forward to end part one" | |
95 | ||
96 | gdb_test "reverse-next" " sleep three .*" "reverse-next third sleep" | |
97 | gdb_test "reverse-next" " sleep two .*" "reverse-next second sleep" | |
98 | gdb_test "reverse-next" " sleep one .*" \ | |
99 | "reverse-next first sleep, dynsym resolve" | |
100 | ||
101 | gdb_test "reverse-next" " printf three .*" "reverse-next third printf" | |
102 | gdb_test "reverse-next" " printf two .*" "reverse-next second printf" | |
103 | gdb_test "reverse-next" " printf one .*" \ | |
104 | "reverse-next first printf, dynsym resolve" | |
105 | gdb_test "reverse-next" " generic statement.*" "reverse-next generic" | |
106 | ||
107 | ||
108 | # | |
109 | # Test reverse-step into debuggable solib function | |
110 | # | |
111 | ||
112 | gdb_test "reverse-step" "${libsrc}.*" "reverse-step into solib function one" | |
113 | gdb_test "reverse-step" "return 2.x.*" "reverse-step within solib function one" | |
114 | gdb_test "reverse-step" " middle part two.*" "reverse-step back to main one" | |
115 | ||
116 | gdb_test "reverse-step" "${libsrc}.*" "reverse-step into solib function two" | |
117 | gdb_test "reverse-step" "return 2.x.*" "reverse-step within solib function two" | |
118 | gdb_test "reverse-step" " begin part two.*" "reverse-step back to main two" | |
119 | ||
120 | # | |
121 | # Test reverse-next over debuggable solib function | |
122 | # | |
123 | ||
124 | gdb_test "until $end_part_two" " end part two.*" "run until end part two" | |
125 | ||
126 | gdb_test "reverse-next" " middle part two.*" "reverse-next over solib function one" | |
127 | gdb_test "reverse-next" " begin part two.*" "reverse-next over solib function two" |