Update copyright year in most headers.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.reverse / solib-precsave.exp
CommitLineData
4c38e0a4 1# Copyright 2009, 2010 Free Software Foundation, Inc.
02506ff1
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 precord debugging
17# with shared libraries and a logfile.
18
19# This test suitable only for process record-replay
20if ![target_info exists gdb,use_precord] {
21 return
22}
23
24set testfile "solib-reverse"
25set srcfile ${testfile}.c
26set libfile "shr2"
27set libsrc ${libfile}.c
28set library ${objdir}/${subdir}/${libfile}.sl
29set binfile ${objdir}/${subdir}/${testfile}
30
31if [get_compiler_info ${binfile}] {
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
51gdb_reinitialize_dir $srcdir/$subdir
52gdb_load ${binfile}
53
54
55runto main
56
57if [target_info exists gdb,use_precord] {
58 # Activate process record/replay
59 gdb_test "record" "" "Turn on process record"
60 # FIXME: command ought to acknowledge, so we can test if it succeeded.
61}
62
63set end_of_main [gdb_get_line_number "end of main" ]
64gdb_test "break $end_of_main" \
65 "Breakpoint $decimal at .*/$srcfile, line $end_of_main\." \
66 "BP at end of main"
67
68gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main"
69
70gdb_test "record save solib.precsave" \
71 "Saved core file solib.precsave with execution log\." \
72 "save process recfile"
73
74gdb_test "kill" "" "Kill process, prepare to debug log file" \
75 "Kill the program being debugged\\? \\(y or n\\) " "y"
76
77gdb_test "record restore solib.precsave" \
78 "Program terminated with signal .*" \
79 "reload core file"
80
81#
82# Test reverse-step over undebuggable solib functions.
83#
84
85# Run forward past some solib function calls.
86
87set end_part_one [gdb_get_line_number " end part one" "$srcfile"]
88set end_part_two [gdb_get_line_number " end part two" "$srcfile"]
89gdb_test "until $end_part_one" " end part one.*" "run until end part one"
90
91gdb_test "reverse-step" " sleep three .*" "reverse-step third sleep"
92gdb_test "reverse-step" " sleep two .*" "reverse-step second sleep"
93gdb_test "reverse-step" " sleep one .*" \
94 "reverse-step first sleep, dynsym resolve"
95
96gdb_test "reverse-step" " printf three .*" "reverse-step third printf"
97gdb_test "reverse-step" " printf two .*" "reverse-step second printf"
98gdb_test "reverse-step" " printf one .*" \
99 "reverse-step first printf, dynsym resolve"
100gdb_test "reverse-step" " generic statement.*" "reverse-step generic"
101
102
103#
104# Test reverse-next over undebuggable solib functions.
105#
106
107# Run forward again...
108
109gdb_test "until $end_part_one" " end part one.*" "forward to end part one"
110
111gdb_test "reverse-next" " sleep three .*" "reverse-next third sleep"
112gdb_test "reverse-next" " sleep two .*" "reverse-next second sleep"
113gdb_test "reverse-next" " sleep one .*" \
114 "reverse-next first sleep, dynsym resolve"
115
116gdb_test "reverse-next" " printf three .*" "reverse-next third printf"
117gdb_test "reverse-next" " printf two .*" "reverse-next second printf"
118gdb_test "reverse-next" " printf one .*" \
119 "reverse-next first printf, dynsym resolve"
120gdb_test "reverse-next" " generic statement.*" "reverse-next generic"
121
122
123#
124# Test reverse-step into debuggable solib function
125#
126
127gdb_test "reverse-step" "${libsrc}.*" "reverse-step into solib function one"
128gdb_test "reverse-step" "return 2.x.*" "reverse-step within solib function one"
129gdb_test "reverse-step" " middle part two.*" "reverse-step back to main one"
130
131gdb_test "reverse-step" "${libsrc}.*" "reverse-step into solib function two"
132gdb_test "reverse-step" "return 2.x.*" "reverse-step within solib function two"
133gdb_test "reverse-step" " begin part two.*" "reverse-step back to main two"
134
135#
136# Test reverse-next over debuggable solib function
137#
138
139gdb_test "until $end_part_two" " end part two.*" "run until end part two"
140
141gdb_test "reverse-next" " middle part two.*" "reverse-next over solib function one"
142gdb_test "reverse-next" " begin part two.*" "reverse-next over solib function two"
This page took 0.047629 seconds and 4 git commands to generate.