1 # Copyright
2008-2019 Free Software Foundation
, Inc.
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.
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.
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
/>.
18 if {[prepare_for_testing
"failed to prepare" $testfile $srcfile debug]} {
22 proc address_get
{ testname
} {
29 #
Do not rely
on printf
; some test configurations don
't work with stdio.
31 gdb_breakpoint [gdb_get_line_number "print p"]
32 gdb_continue_to_breakpoint "$testname - address set"
34 gdb_test_multiple "print/x p" $testname {
35 -re "\\$\[0-9\]+ = (0x\[0-9a-f\]*)\r?\n$gdb_prompt $" {
37 return $expect_out(1,string)
42 set test "set disable-randomization off"
43 gdb_test_multiple "${test}" "${test}" {
44 -re "Disabling randomization .* unsupported .*$gdb_prompt $" {
45 untested "disabling randomization is not supported on this Linux GDB"
48 -re "No symbol .* in current context.*$gdb_prompt $" {
49 untested "disabling randomization is not supported on this GDB platform"
56 gdb_test "show disable-randomization" \
57 "Disabling randomization .* is off." \
58 "show disable-randomization off"
60 set addr1 [address_get "randomized first address"]
61 set addr2 [address_get "randomized second address"]
62 set test "randomized addresses should not match"
63 if [string equal $addr1 $addr2] {
64 untested "no randomization detected on this system"
70 gdb_test_no_output "set disable-randomization on"
71 gdb_test "show disable-randomization" \
72 "Disabling randomization .* is on." \
73 "show disable-randomization on"
75 set addr1 [address_get "fixed first address"]
76 set addr2 [address_get "fixed second address"]
77 set test "fixed addresses should match"
78 if [string equal $addr1 $addr2] {