Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright (C) 2013-2020 Free Software Foundation, Inc. |
67d21849 YQ |
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 | ||
60b3033e | 23 | if {![can_spawn_for_attach]} { |
67d21849 YQ |
24 | return 0 |
25 | } | |
26 | ||
27 | load_lib gdb-python.exp | |
28 | ||
29 | # Start with a fresh gdb. | |
30 | ||
31 | gdb_exit | |
32 | gdb_start | |
33 | gdb_reinitialize_dir $srcdir/$subdir | |
34 | ||
35 | # Skip all tests if Python scripting is not enabled. | |
36 | if { [skip_python_tests] } { continue } | |
37 | gdb_exit | |
38 | ||
5b362f04 | 39 | if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { |
67d21849 YQ |
40 | return -1 |
41 | } | |
42 | ||
2c8c5d37 PA |
43 | set test_spawn_id [spawn_wait_for_attach $binfile] |
44 | set testpid [spawn_id_get_pid $test_spawn_id] | |
67d21849 YQ |
45 | |
46 | # Test command 'where' is executed when command 'attach' is done, otherwise | |
47 | # function 'sleep' may not show up in backtrace. | |
48 | ||
49 | gdb_test "python gdb.execute(\"attach $testpid\"); gdb.execute(\"where\")" \ | |
50 | "in .*sleep \\(.*\\) .* in foo1 \\(\\) at .* in foo2 \\(\\) at .*" \ | |
51 | "attach and where" | |
2c8c5d37 PA |
52 | |
53 | kill_wait_spawned_process $test_spawn_id |