Update years in copyright notice for the GDB files.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.reverse / solib-reverse.exp
CommitLineData
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 19if ![supports_reverse] {
28d41a99
MS
20 return
21}
44883546
YQ
22if {[skip_shlib_tests]} {
23 return
24}
28d41a99 25
7686c074 26standard_testfile
28d41a99
MS
27set libfile "shr2"
28set libsrc ${libfile}.c
7686c074 29set library [standard_output_file ${libfile}.sl]
28d41a99 30
4c93b1db 31if [get_compiler_info] {
28d41a99
MS
32 return -1
33}
34
35if { [gdb_compile_shlib ${srcdir}/${subdir}/${libsrc} ${library} "debug"] != "" } {
36 untested "Could not compile shared library."
37 return -1
38}
39
40set exec_opts [list debug shlib=${library}]
41
42if { [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
49gdb_exit
50gdb_start
596ba138
JK
51
52# Clear it to never find any separate system debug infos.
53gdb_test_no_output "set debug-file-directory"
54
28d41a99
MS
55gdb_reinitialize_dir $srcdir/$subdir
56gdb_load ${binfile}
44883546 57gdb_load_shlibs $library
28d41a99
MS
58
59runto main
60
d3895d7d 61if [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
72set end_part_one [gdb_get_line_number " end part one" "$srcfile"]
73set end_part_two [gdb_get_line_number " end part two" "$srcfile"]
74gdb_test "until $end_part_one" " end part one.*" "run until end part one"
75
76gdb_test "reverse-step" " sleep three .*" "reverse-step third sleep"
77gdb_test "reverse-step" " sleep two .*" "reverse-step second sleep"
78gdb_test "reverse-step" " sleep one .*" \
79 "reverse-step first sleep, dynsym resolve"
80
81gdb_test "reverse-step" " printf three .*" "reverse-step third printf"
82gdb_test "reverse-step" " printf two .*" "reverse-step second printf"
83gdb_test "reverse-step" " printf one .*" \
84 "reverse-step first printf, dynsym resolve"
85gdb_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
94gdb_test "until $end_part_one" " end part one.*" "forward to end part one"
95
96gdb_test "reverse-next" " sleep three .*" "reverse-next third sleep"
97gdb_test "reverse-next" " sleep two .*" "reverse-next second sleep"
98gdb_test "reverse-next" " sleep one .*" \
99 "reverse-next first sleep, dynsym resolve"
100
101gdb_test "reverse-next" " printf three .*" "reverse-next third printf"
102gdb_test "reverse-next" " printf two .*" "reverse-next second printf"
103gdb_test "reverse-next" " printf one .*" \
104 "reverse-next first printf, dynsym resolve"
105gdb_test "reverse-next" " generic statement.*" "reverse-next generic"
106
107
108#
109# Test reverse-step into debuggable solib function
110#
111
112gdb_test "reverse-step" "${libsrc}.*" "reverse-step into solib function one"
113gdb_test "reverse-step" "return 2.x.*" "reverse-step within solib function one"
114gdb_test "reverse-step" " middle part two.*" "reverse-step back to main one"
115
116gdb_test "reverse-step" "${libsrc}.*" "reverse-step into solib function two"
117gdb_test "reverse-step" "return 2.x.*" "reverse-step within solib function two"
118gdb_test "reverse-step" " begin part two.*" "reverse-step back to main two"
119
120#
121# Test reverse-next over debuggable solib function
122#
123
124gdb_test "until $end_part_two" " end part two.*" "run until end part two"
125
126gdb_test "reverse-next" " middle part two.*" "reverse-next over solib function one"
127gdb_test "reverse-next" " begin part two.*" "reverse-next over solib function two"
This page took 0.425089 seconds and 4 git commands to generate.