Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Side by Side Diff: gdb/testsuite/gdb.base/attach-pie-misread.exp

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gdb/testsuite/gdb.base/attach.exp ('k') | gdb/testsuite/gdb.base/attach-twice.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2010-2012 Free Software Foundation, Inc. 1 # Copyright 2010-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 test only works on GNU/Linux. 16 # This test only works on GNU/Linux.
17 if { ![isnative] || [is_remote host] || [target_info exists use_gdb_stub] 17 if { ![isnative] || [is_remote host] || [target_info exists use_gdb_stub]
18 || ![istarget *-linux*] || [skip_shlib_tests]} { 18 || ![istarget *-linux*] || [skip_shlib_tests]} {
19 continue 19 continue
20 } 20 }
21 21
22 load_lib prelink-support.exp 22 load_lib prelink-support.exp
23 23
24 set test "attach-pie-misread" 24 set test "attach-pie-misread"
25 set srcfile ${test}.c 25 set srcfile ${test}.c
26 set genfile ${objdir}/${subdir}/${test}-gen.h 26 set genfile ${objdir}/${subdir}/${test}-gen.h
27 set executable ${test} 27 set executable ${test}
28 set binfile ${objdir}/${subdir}/${executable} 28 set binfile ${objdir}/${subdir}/${executable}
29 29
30 if {[build_executable_own_libs ${test}.exp $executable $srcfile [list "additiona l_flags=-fPIE -pie"]] == ""} { 30 if {[build_executable_own_libs ${test}.exp $executable $srcfile [list additional _flags=-fPIE ldflags=-pie]] == ""} {
31 return -1 31 return -1
32 } 32 }
33 33
34 # Program Headers: 34 # Program Headers:
35 # Type Offset VirtAddr PhysAddr FileSiz MemSi z Flg Align 35 # Type Offset VirtAddr PhysAddr FileSiz MemSi z Flg Align
36 # LOAD 0x000000 0x0000000000400000 0x0000000000400000 0x134f5ec 0x13 4f5ec R E 0x200000 36 # LOAD 0x000000 0x0000000000400000 0x0000000000400000 0x134f5ec 0x13 4f5ec R E 0x200000
37 # LOAD 0x134f5f0 0x000000000194f5f0 0x000000000194f5f0 0x1dbc60 0x21 4088 RW 0x200000 37 # LOAD 0x134f5f0 0x000000000194f5f0 0x000000000194f5f0 0x1dbc60 0x21 4088 RW 0x200000
38 # DYNAMIC 0x134f618 0x000000000194f618 0x000000000194f618 0x000200 0x00 0200 RW 0x8 38 # DYNAMIC 0x134f618 0x000000000194f618 0x000000000194f618 0x000200 0x00 0200 RW 0x8
39 # 39 #
40 proc read_phdr {binfile test} { 40 proc read_phdr {binfile test} {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 verbose -log "command is $command" 90 verbose -log "command is $command"
91 set result [catch $command output] 91 set result [catch $command output]
92 verbose -log "result is $result" 92 verbose -log "result is $result"
93 verbose -log "output is $output" 93 verbose -log "output is $output"
94 if {$result == 0} { 94 if {$result == 0} {
95 pass $test 95 pass $test
96 } else { 96 } else {
97 fail $test 97 fail $test
98 } 98 }
99 99
100 set prelink_args [build_executable_own_libs ${test}.exp $executable $srcfile [li st "additional_flags=-fPIE -pie -DGEN=\"$genfile\""]] 100 set prelink_args [build_executable_own_libs ${test}.exp $executable $srcfile [li st "additional_flags=-fPIE -DGEN=\"$genfile\"" "ldflags=-pie"]]
101 if {$prelink_args == ""} { 101 if {$prelink_args == ""} {
102 return -1 102 return -1
103 } 103 }
104 104
105 # x86_64 file has 25MB, no need to keep it. 105 # x86_64 file has 25MB, no need to keep it.
106 file delete -- $genfile 106 file delete -- $genfile
107 107
108 set phdr [read_phdr $binfile "readelf rebuilt with stub_size"] 108 set phdr [read_phdr $binfile "readelf rebuilt with stub_size"]
109 set dynamic_vaddr_prelinkno [lindex $phdr 0] 109 set dynamic_vaddr_prelinkno [lindex $phdr 0]
110 110
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 return 145 return
146 } 146 }
147 timeout { 147 timeout {
148 fail "$test (timeout)" 148 fail "$test (timeout)"
149 remote_exec host "kill -9 $pid" 149 remote_exec host "kill -9 $pid"
150 return 150 return
151 } 151 }
152 } 152 }
153 153
154 # Due to alignments it was reproducible with 1 on x86_64 but 2 on i686. 154 # Due to alignments it was reproducible with 1 on x86_64 but 2 on i686.
155 foreach align_mult {1 2} { 155 foreach align_mult {1 2} { with_test_prefix "shift-by-$align_mult" {
156 set old_ldprefix $pf_prefix
157 lappend pf_prefix "shift-by-$align_mult:"
158 156
159 # FIXME: We believe there is enough room under FIRST_OFFSET. 157 # FIXME: We believe there is enough room under FIRST_OFFSET.
160 set shifted_offset [format 0x%x [expr "$first_offset - $align_mult * $align_ max"]] 158 set shifted_offset [format 0x%x [expr "$first_offset - $align_mult * $align_ max"]]
161 verbose -log "shifted_offset is $shifted_offset" 159 verbose -log "shifted_offset is $shifted_offset"
162 160
163 # For normal prelink (prelink_yes call), we need to supply $prelink_args. 161 # For normal prelink (prelink_yes call), we need to supply $prelink_args.
164 # For the prelink `-r' option below, $prelink_args is not required. 162 # For the prelink `-r' option below, $prelink_args is not required.
165 # Moreover, if it was used, the problem would not longer be reproducible 163 # Moreover, if it was used, the problem would not longer be reproducible
166 # as the libraries would also get relocated. 164 # as the libraries would also get relocated.
167 set command "exec /usr/sbin/prelink -q -N --no-exec-shield -r $shifted_offse t $binfile" 165 set command "exec /usr/sbin/prelink -q -N --no-exec-shield -r $shifted_offse t $binfile"
(...skipping 23 matching lines...) Expand all
191 gdb_test_multiple "" $test { 189 gdb_test_multiple "" $test {
192 -re "\r\nCannot access memory at address .*$gdb_prompt $" { 190 -re "\r\nCannot access memory at address .*$gdb_prompt $" {
193 fail $test 191 fail $test
194 } 192 }
195 -re "$gdb_prompt $" { 193 -re "$gdb_prompt $" {
196 pass $test 194 pass $test
197 } 195 }
198 } 196 }
199 197
200 gdb_test "detach" "Detaching from program: .*" 198 gdb_test "detach" "Detaching from program: .*"
201 199 }}
202 set pf_prefix $old_ldprefix
203 }
204 200
205 remote_exec host "kill -9 $pid" 201 remote_exec host "kill -9 $pid"
OLDNEW
« no previous file with comments | « gdb/testsuite/gdb.base/attach.exp ('k') | gdb/testsuite/gdb.base/attach-twice.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698