OLD | NEW |
1 # Copyright 1997, 1999, 2002-2004, 2007-2012 Free Software Foundation, | 1 # Copyright 1997-2013 Free Software Foundation, Inc. |
2 # Inc. | |
3 | 2 |
4 # 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 |
5 # 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 |
6 # the Free Software Foundation; either version 3 of the License, or | 5 # the Free Software Foundation; either version 3 of the License, or |
7 # (at your option) any later version. | 6 # (at your option) any later version. |
8 # | 7 # |
9 # 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, |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
(...skipping 11 matching lines...) Expand all Loading... |
24 # "kill", and also a test for the R3 register warning. JB | 23 # "kill", and also a test for the R3 register warning. JB |
25 if { [istarget "hppa*-*-hpux*"] } { | 24 if { [istarget "hppa*-*-hpux*"] } { |
26 return 0 | 25 return 0 |
27 } | 26 } |
28 | 27 |
29 # are we on a target board | 28 # are we on a target board |
30 if [is_remote target] then { | 29 if [is_remote target] then { |
31 return 0 | 30 return 0 |
32 } | 31 } |
33 | 32 |
34 set testfile "attach" | 33 standard_testfile attach.c attach2.c |
35 set srcfile ${testfile}.c | 34 set binfile2 ${binfile}2 |
36 set srcfile2 ${testfile}2.c | 35 set escapedbinfile [string_to_regexp $binfile] |
37 set binfile ${objdir}/${subdir}/${testfile} | |
38 set binfile2 ${objdir}/${subdir}/${testfile}2 | |
39 set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}] | |
40 | 36 |
41 #execute_anywhere "rm -f ${binfile} ${binfile2}" | 37 #execute_anywhere "rm -f ${binfile} ${binfile2}" |
42 remote_exec build "rm -f ${binfile} ${binfile2}" | 38 remote_exec build "rm -f ${binfile} ${binfile2}" |
43 # For debugging this test | 39 # For debugging this test |
44 # | 40 # |
45 #log_user 1 | 41 #log_user 1 |
46 | 42 |
47 # build the first test case | 43 # build the first test case |
48 # | 44 # |
49 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug}] != "" } { | 45 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug}] != "" } { |
(...skipping 11 matching lines...) Expand all Loading... |
61 if [get_compiler_info] { | 57 if [get_compiler_info] { |
62 return -1 | 58 return -1 |
63 } | 59 } |
64 | 60 |
65 proc do_attach_tests {} { | 61 proc do_attach_tests {} { |
66 global gdb_prompt | 62 global gdb_prompt |
67 global binfile | 63 global binfile |
68 global escapedbinfile | 64 global escapedbinfile |
69 global srcfile | 65 global srcfile |
70 global testfile | 66 global testfile |
71 global objdir | |
72 global subdir | 67 global subdir |
73 global timeout | 68 global timeout |
74 | 69 |
75 # Start the program running and then wait for a bit, to be sure | 70 # Start the program running and then wait for a bit, to be sure |
76 # that it can be attached to. | 71 # that it can be attached to. |
77 | 72 |
78 set testpid [eval exec $binfile &] | 73 set testpid [eval exec $binfile &] |
79 exec sleep 2 | 74 exec sleep 2 |
80 if { [istarget "*-*-cygwin*"] } { | 75 if { [istarget "*-*-cygwin*"] } { |
81 # testpid is the Cygwin PID, GDB uses the Windows PID, which might be | 76 # testpid is the Cygwin PID, GDB uses the Windows PID, which might be |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 if { [istarget "*-*-cygwin*"] } { | 287 if { [istarget "*-*-cygwin*"] } { |
293 # testpid is the Cygwin PID, GDB uses the Windows PID, which might be | 288 # testpid is the Cygwin PID, GDB uses the Windows PID, which might be |
294 # different due to the way fork/exec works. | 289 # different due to the way fork/exec works. |
295 set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ] | 290 set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ] |
296 } | 291 } |
297 | 292 |
298 # Verify that we can attach to the process, and find its a.out | 293 # Verify that we can attach to the process, and find its a.out |
299 # when we're cd'd to some directory that doesn't contain the | 294 # when we're cd'd to some directory that doesn't contain the |
300 # a.out. (We use the source path set by the "dir" command.) | 295 # a.out. (We use the source path set by the "dir" command.) |
301 | 296 |
302 gdb_test "dir ${objdir}/${subdir}" "Source directories searched: .*" \ | 297 gdb_test "dir [standard_output_file {}]" "Source directories searched: .*" \ |
303 "set source path" | 298 "set source path" |
304 | 299 |
305 gdb_test "cd /tmp" "Working directory /tmp." \ | 300 gdb_test "cd /tmp" "Working directory /tmp." \ |
306 "cd away from process working directory" | 301 "cd away from process working directory" |
307 | 302 |
308 # Explicitly flush out any knowledge of the previous attachment. | 303 # Explicitly flush out any knowledge of the previous attachment. |
309 | 304 |
310 set test "before attach3, flush symbols" | 305 set test "before attach3, flush symbols" |
311 gdb_test_multiple "symbol-file" "$test" { | 306 gdb_test_multiple "symbol-file" "$test" { |
312 -re "Discard symbol table from.*y or n. $" { | 307 -re "Discard symbol table from.*y or n. $" { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 | 398 |
404 # Test attaching when the target is inside a system call | 399 # Test attaching when the target is inside a system call |
405 | 400 |
406 gdb_exit | 401 gdb_exit |
407 gdb_start | 402 gdb_start |
408 | 403 |
409 gdb_reinitialize_dir $srcdir/$subdir | 404 gdb_reinitialize_dir $srcdir/$subdir |
410 do_call_attach_tests | 405 do_call_attach_tests |
411 | 406 |
412 return 0 | 407 return 0 |
OLD | NEW |