OLD | NEW |
1 # Copyright 2009-2012 Free Software Foundation, Inc. | 1 # Copyright 2009-2012 Free Software Foundation, Inc. |
2 | 2 |
3 # This program is free software; you can redistribute it and/or modify | 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 | 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 | 5 # the Free Software Foundation; either version 3 of the License, or |
6 # (at your option) any later version. | 6 # (at your option) any later version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 # | 12 # |
13 # You should have received a copy of the GNU General Public License | 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/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 |
16 # This file is part of the GDB testsuite. It tests precord debugging | 16 # This file is part of the GDB testsuite. It tests precord debugging |
17 # with shared libraries and a logfile. | 17 # with shared libraries and a logfile. |
18 | 18 |
19 # This test suitable only for process record-replay | 19 # This test suitable only for process record-replay |
20 if ![supports_process_record] { | 20 if ![supports_process_record] { |
21 return | 21 return |
22 } | 22 } |
23 | 23 |
24 set testfile "solib-reverse" | 24 standard_testfile solib-reverse.c |
25 set srcfile ${testfile}.c | 25 set precsave [standard_output_file solib.precsave] |
26 set libfile "shr2" | 26 set libfile "shr2" |
27 set libsrc ${libfile}.c | 27 set libsrc ${libfile}.c |
28 set library ${objdir}/${subdir}/${libfile}.sl | 28 set library [standard_output_file ${libfile}.sl] |
29 set binfile ${objdir}/${subdir}/${testfile} | |
30 | 29 |
31 if [get_compiler_info ${binfile}] { | 30 if [get_compiler_info] { |
32 return -1 | 31 return -1 |
33 } | 32 } |
34 | 33 |
35 if { [gdb_compile_shlib ${srcdir}/${subdir}/${libsrc} ${library} "debug"] != ""
} { | 34 if { [gdb_compile_shlib ${srcdir}/${subdir}/${libsrc} ${library} "debug"] != ""
} { |
36 untested "Could not compile shared library." | 35 untested "Could not compile shared library." |
37 return -1 | 36 return -1 |
38 } | 37 } |
39 | 38 |
40 set exec_opts [list debug shlib=${library}] | 39 set exec_opts [list debug shlib=${library}] |
41 | 40 |
42 if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $exec_opt
s] != "" } { | 41 # Attempt to prevent -Wl,-z,relro which may happen by default with some |
| 42 # toolchain configurations. Due to PR corefiles/11804 GDB will then produce |
| 43 # invalid core file. |
| 44 |
| 45 if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable \ |
| 46 » » [concat $exec_opts additional_flags=-Wl,-z,norelro]] != "" |
| 47 && [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $exec_
opts] != "" } { |
43 untested "Could not compile $binfile." | 48 untested "Could not compile $binfile." |
44 return -1 | 49 return -1 |
45 } | 50 } |
46 | 51 |
47 # Start with a fresh gdb. | 52 # Start with a fresh gdb. |
48 | 53 |
49 gdb_exit | 54 gdb_exit |
50 gdb_start | 55 gdb_start |
| 56 |
| 57 # Clear it to never find any separate system debug infos. |
| 58 gdb_test_no_output "set debug-file-directory" |
| 59 |
51 gdb_reinitialize_dir $srcdir/$subdir | 60 gdb_reinitialize_dir $srcdir/$subdir |
52 gdb_load ${binfile} | 61 gdb_load ${binfile} |
53 | 62 |
54 | 63 |
55 runto main | 64 runto main |
56 | 65 |
57 if [supports_process_record] { | 66 if [supports_process_record] { |
58 # Activate process record/replay | 67 # Activate process record/replay |
59 gdb_test_no_output "record" "Turn on process record" | 68 gdb_test_no_output "record" "Turn on process record" |
60 } | 69 } |
61 | 70 |
62 set end_of_main [gdb_get_line_number "end of main" ] | 71 set end_of_main [gdb_get_line_number "end of main" ] |
63 gdb_test "break $end_of_main" \ | 72 gdb_test "break $end_of_main" \ |
64 "Breakpoint $decimal at .*/$srcfile, line $end_of_main\." \ | 73 "Breakpoint $decimal at .*/$srcfile, line $end_of_main\." \ |
65 "BP at end of main" | 74 "BP at end of main" |
66 | 75 |
67 gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main" | 76 gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main" |
68 | 77 |
69 gdb_test "record save solib.precsave" \ | 78 gdb_test "record save $precsave" \ |
70 "Saved core file solib.precsave with execution log\." \ | 79 "Saved core file $precsave with execution log\." \ |
71 "save process recfile" | 80 "save process recfile" |
72 | 81 |
73 gdb_test "kill" "" "Kill process, prepare to debug log file" \ | 82 gdb_test "kill" "" "Kill process, prepare to debug log file" \ |
74 "Kill the program being debugged\\? \\(y or n\\) " "y" | 83 "Kill the program being debugged\\? \\(y or n\\) " "y" |
75 | 84 |
76 gdb_test "record restore solib.precsave" \ | 85 gdb_test "record restore $precsave" \ |
77 "Program terminated with signal .*" \ | 86 "Program terminated with signal .*" \ |
78 "reload core file" | 87 "reload core file" |
79 | 88 |
80 # | 89 # |
81 # Test reverse-step over undebuggable solib functions. | 90 # Test reverse-step over undebuggable solib functions. |
82 # | 91 # |
83 | 92 |
84 # Run forward past some solib function calls. | 93 # Run forward past some solib function calls. |
85 | 94 |
86 set end_part_one [gdb_get_line_number " end part one" "$srcfile"] | 95 set end_part_one [gdb_get_line_number " end part one" "$srcfile"] |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 gdb_test "reverse-step" " begin part two.*" "reverse-step back to main two" | 141 gdb_test "reverse-step" " begin part two.*" "reverse-step back to main two" |
133 | 142 |
134 # | 143 # |
135 # Test reverse-next over debuggable solib function | 144 # Test reverse-next over debuggable solib function |
136 # | 145 # |
137 | 146 |
138 gdb_test "until $end_part_two" " end part two.*" "run until end part two" | 147 gdb_test "until $end_part_two" " end part two.*" "run until end part two" |
139 | 148 |
140 gdb_test "reverse-next" " middle part two.*" "reverse-next over solib function o
ne" | 149 gdb_test "reverse-next" " middle part two.*" "reverse-next over solib function o
ne" |
141 gdb_test "reverse-next" " begin part two.*" "reverse-next over solib function tw
o" | 150 gdb_test "reverse-next" " begin part two.*" "reverse-next over solib function tw
o" |
OLD | NEW |