Commit | Line | Data |
---|---|---|
42a4f53d | 1 | # Copyright 2012-2019 Free Software Foundation, Inc. |
8b9a549d PA |
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 | ||
6bb90213 PA |
16 | # Test that on Linux, we don't warn about not finding the vDSO. E.g.: |
17 | # | |
18 | # warning: Could not load shared library symbols for linux-vdso.so.1. | |
19 | ||
8b9a549d PA |
20 | standard_testfile |
21 | ||
22 | if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile] } { | |
23 | return -1 | |
24 | } | |
25 | ||
6bb90213 PA |
26 | with_test_prefix "setup" { |
27 | gdb_breakpoint "main" | |
8b9a549d | 28 | |
6bb90213 PA |
29 | # At least some versions of Fedora/RHEL glibc have local patches that |
30 | # hide the vDSO. This lines re-exposes it. See PR libc/13097, | |
31 | # comment 2. There's no support for passing environment variables in | |
32 | # the remote protocol, but that's OK -- if we're testing against a | |
33 | # glibc that doesn't list the vDSO without this, the test should still | |
34 | # pass. | |
35 | gdb_test_no_output "set environment LD_DEBUG=unused" | |
36 | } | |
8b9a549d | 37 | |
6bb90213 PA |
38 | proc test_no_vdso {command} { |
39 | global srcfile | |
40 | global gdb_prompt | |
8b9a549d | 41 | |
6bb90213 PA |
42 | set message "startup" |
43 | gdb_test_multiple "$command" $message { | |
44 | -re "Could not load shared library symbols .*\r\n$gdb_prompt $" { | |
45 | fail $message | |
46 | } | |
47 | -re "main \\(\\) at .*$srcfile.*\r\n$gdb_prompt $" { | |
48 | pass $message | |
49 | } | |
8b9a549d | 50 | } |
6bb90213 PA |
51 | |
52 | # Extra testing in case the warning changes and we miss updating | |
53 | # the above. | |
54 | set test "no vdso without symbols is listed" | |
55 | gdb_test_multiple "info shared" $test { | |
56 | -re "No\[^\r\n\]+linux-(vdso|gate).*$gdb_prompt $" { | |
57 | fail $test | |
58 | } | |
59 | -re "$gdb_prompt $" { | |
60 | pass $test | |
61 | } | |
8b9a549d PA |
62 | } |
63 | } | |
64 | ||
6bb90213 PA |
65 | # First, try a live process. |
66 | with_test_prefix "run" { | |
67 | gdb_run_cmd | |
68 | test_no_vdso "" | |
69 | } | |
70 | ||
71 | # Now, dump a core, and reload it. | |
72 | with_test_prefix "core" { | |
73 | set corefile [standard_output_file $testfile.core] | |
74 | set core_supported [gdb_gcore_cmd "$corefile" "save a corefile"] | |
75 | if {!$core_supported} { | |
76 | return -1 | |
8b9a549d | 77 | } |
6bb90213 PA |
78 | |
79 | clean_restart ${testfile} | |
80 | ||
81 | test_no_vdso "core-file $corefile" | |
8b9a549d | 82 | } |