OLD | NEW |
1 # Copyright 1997, 1999, 2002-2004, 2007-2012 Free Software Foundation, | 1 # Copyright 1997, 1999, 2002-2004, 2007-2012 Free Software Foundation, |
2 # Inc. | 2 # Inc. |
3 | 3 |
4 # This program is free software; you can redistribute it and/or modify | 4 # This program is free software; you can redistribute it and/or modify |
5 # it under the terms of the GNU General Public License as published by | 5 # it under the terms of the GNU General Public License as published by |
6 # the Free Software Foundation; either version 3 of the License, or | 6 # the Free Software Foundation; either version 3 of the License, or |
7 # (at your option) any later version. | 7 # (at your option) any later version. |
8 # | 8 # |
9 # This program is distributed in the hope that it will be useful, | 9 # This program is distributed in the hope that it will be useful, |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 # GNU General Public License for more details. | 12 # GNU General Public License for more details. |
13 # | 13 # |
14 # You should have received a copy of the GNU General Public License | 14 # You should have received a copy of the GNU General Public License |
15 # along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 15 # along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
16 | 16 |
17 if $tracelevel then { | |
18 strace $tracelevel | |
19 } | |
20 | |
21 | 17 |
22 # On HP-UX 11.0, this test is causing a process running the program | 18 # On HP-UX 11.0, this test is causing a process running the program |
23 # "attach" to be left around spinning. Until we figure out why, I am | 19 # "attach" to be left around spinning. Until we figure out why, I am |
24 # commenting out the test to avoid polluting tiamat (our 11.0 nightly | 20 # commenting out the test to avoid polluting tiamat (our 11.0 nightly |
25 # test machine) with these processes. RT | 21 # test machine) with these processes. RT |
26 # | 22 # |
27 # Setting the magic bit in the target app should work. I added a | 23 # Setting the magic bit in the target app should work. I added a |
28 # "kill", and also a test for the R3 register warning. JB | 24 # "kill", and also a test for the R3 register warning. JB |
29 if { [istarget "hppa*-*-hpux*"] } { | 25 if { [istarget "hppa*-*-hpux*"] } { |
30 return 0 | 26 return 0 |
(...skipping 24 matching lines...) Expand all Loading... |
55 return -1 | 51 return -1 |
56 } | 52 } |
57 | 53 |
58 # Build the in-system-call test | 54 # Build the in-system-call test |
59 | 55 |
60 if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {d
ebug}] != "" } { | 56 if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {d
ebug}] != "" } { |
61 untested attach.exp | 57 untested attach.exp |
62 return -1 | 58 return -1 |
63 } | 59 } |
64 | 60 |
65 if [get_compiler_info ${binfile}] { | 61 if [get_compiler_info] { |
66 return -1 | 62 return -1 |
67 } | 63 } |
68 | 64 |
69 proc do_attach_tests {} { | 65 proc do_attach_tests {} { |
70 global gdb_prompt | 66 global gdb_prompt |
71 global binfile | 67 global binfile |
72 global escapedbinfile | 68 global escapedbinfile |
73 global srcfile | 69 global srcfile |
74 global testfile | 70 global testfile |
75 global objdir | 71 global objdir |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 pass "$test" | 153 pass "$test" |
158 } | 154 } |
159 -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"
{ | 155 -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"
{ |
160 # Response expected from /proc-based systems. | 156 # Response expected from /proc-based systems. |
161 pass "$test" | 157 pass "$test" |
162 } | 158 } |
163 -re "Can't attach to process..*$gdb_prompt $" { | 159 -re "Can't attach to process..*$gdb_prompt $" { |
164 # Response expected on Cygwin | 160 # Response expected on Cygwin |
165 pass "$test" | 161 pass "$test" |
166 } | 162 } |
| 163 -re "Attaching to.*, process $boguspid.*failed.*$gdb_prompt $" { |
| 164 # Response expected on the extended-remote target. |
| 165 pass "$test" |
| 166 } |
167 } | 167 } |
168 | 168 |
169 # Verify that we can attach to the process by first giving its | 169 # Verify that we can attach to the process by first giving its |
170 # executable name via the file command, and using attach with the | 170 # executable name via the file command, and using attach with the |
171 # process ID. | 171 # process ID. |
172 | 172 |
173 # (Actually, the test system appears to do this automatically for | 173 # (Actually, the test system appears to do this automatically for |
174 # us. So, we must also be prepared to be asked if we want to | 174 # us. So, we must also be prepared to be asked if we want to |
175 # discard an existing set of symbols.) | 175 # discard an existing set of symbols.) |
176 | 176 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 gdb_test_multiple "file" "$test" { | 221 gdb_test_multiple "file" "$test" { |
222 -re "No executable file now.*Discard symbol table.*y or n. $" { | 222 -re "No executable file now.*Discard symbol table.*y or n. $" { |
223 gdb_test "y" "No symbol file now." "$test" | 223 gdb_test "y" "No symbol file now." "$test" |
224 } | 224 } |
225 } | 225 } |
226 set timeout $old_timeout | 226 set timeout $old_timeout |
227 | 227 |
228 # Verify that we can attach to the process just by giving the | 228 # Verify that we can attach to the process just by giving the |
229 # process ID. | 229 # process ID. |
230 | 230 |
231 set test "set file, before attach2" | 231 set test "attach2, with no file" |
| 232 set found_exec_file 0 |
232 gdb_test_multiple "attach $testpid" "$test" { | 233 gdb_test_multiple "attach $testpid" "$test" { |
233 -re "Attaching to process $testpid.*Load new symbol table from \"$escape
dbinfile\.exe\".*y or n. $" { | 234 -re "Attaching to process $testpid.*Load new symbol table from \"$escape
dbinfile\.exe\".*y or n. $" { |
234 # On Cygwin, the DLL's symbol tables are loaded prior to the | 235 # On Cygwin, the DLL's symbol tables are loaded prior to the |
235 # executable's symbol table. This in turn always results in | 236 # executable's symbol table. This in turn always results in |
236 # asking the user for actually loading the symbol table of the | 237 # asking the user for actually loading the symbol table of the |
237 # executable. | 238 # executable. |
238 gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \ | 239 gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \ |
239 "$test (reset file)" | 240 "$test (reset file)" |
| 241 |
| 242 set found_exec_file 1 |
240 } | 243 } |
241 -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile
.*main.*at .*$gdb_prompt $" { | 244 -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile
.*main.*at .*$gdb_prompt $" { |
242 pass "$test" | 245 pass "$test" |
| 246 set found_exec_file 1 |
243 } | 247 } |
244 } | 248 } |
245 | 249 |
| 250 if {$found_exec_file == 0} { |
| 251 set test "load file manually, after attach2" |
| 252 gdb_test_multiple "file $binfile" "$test" { |
| 253 -re "A program is being debugged already..*Are you sure you want to
change the file.*y or n. $" { |
| 254 gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done."
\ |
| 255 "$test (re-read)" |
| 256 } |
| 257 -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"
{ |
| 258 pass "$test" |
| 259 } |
| 260 } |
| 261 } |
| 262 |
246 # Verify that we can modify the variable "should_exit" in the | 263 # Verify that we can modify the variable "should_exit" in the |
247 # program. | 264 # program. |
248 | 265 |
249 gdb_test_no_output "set should_exit=1" "after attach2, set should_exit" | 266 gdb_test_no_output "set should_exit=1" "after attach2, set should_exit" |
250 | 267 |
251 # Verify that the modification really happened. | 268 # Verify that the modification really happened. |
252 | 269 |
253 gdb_test "tbreak 19" "Temporary breakpoint .*at.*$srcfile, line 19.*" \ | 270 gdb_test "tbreak 19" "Temporary breakpoint .*at.*$srcfile, line 19.*" \ |
254 "after attach2, set tbreak postloop" | 271 "after attach2, set tbreak postloop" |
255 | 272 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 403 |
387 # Test attaching when the target is inside a system call | 404 # Test attaching when the target is inside a system call |
388 | 405 |
389 gdb_exit | 406 gdb_exit |
390 gdb_start | 407 gdb_start |
391 | 408 |
392 gdb_reinitialize_dir $srcdir/$subdir | 409 gdb_reinitialize_dir $srcdir/$subdir |
393 do_call_attach_tests | 410 do_call_attach_tests |
394 | 411 |
395 return 0 | 412 return 0 |
OLD | NEW |