]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.python/py-sync-interp.exp
cfa75db8cabda443448ddcb073ab14dc4b68c06b
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.python / py-sync-interp.exp
1 # Copyright (C) 2013 Free Software Foundation, Inc.
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
16 # This file is part of the GDB testsuite.
17
18 # This test case is copied from PR12929.
19 # http://sourceware.org/bugzilla/show_bug.cgi?id=12929
20
21 standard_testfile
22
23 # We need to use TCL's exec to get the pid.
24 if [is_remote target] then {
25 return 0
26 }
27
28 load_lib gdb-python.exp
29
30 # Start with a fresh gdb.
31
32 gdb_exit
33 gdb_start
34 gdb_reinitialize_dir $srcdir/$subdir
35
36 # Skip all tests if Python scripting is not enabled.
37 if { [skip_python_tests] } { continue }
38 gdb_exit
39
40 if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
41 return -1
42 }
43
44 # Start the program running and then wait for a bit, to be sure
45 # that it can be attached to.
46 set testpid [eval exec $binfile &]
47 exec sleep 2
48 if { [istarget "*-*-cygwin*"] } {
49 # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
50 # different due to the way fork/exec works.
51 set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
52 }
53
54 # Test command 'where' is executed when command 'attach' is done, otherwise
55 # function 'sleep' may not show up in backtrace.
56
57 gdb_test "python gdb.execute(\"attach $testpid\"); gdb.execute(\"where\")" \
58 "in .*sleep \\(.*\\) .* in foo1 \\(\\) at .* in foo2 \\(\\) at .*" \
59 "attach and where"