1 # Copyright (C) 2016 Free Software Foundation, Inc.
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.
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.
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/>.
16 if {![can_spawn_for_attach]} {
21 set executable ${testfile}
23 if { [build_executable ${testfile}.exp $executable $srcfile \
24 [list debug pthreads "additional_flags=-fPIE -pie"]] } {
28 # Start the program running and then wait for a bit, to be sure
29 # that it can be attached to.
31 set test_spawn_id [spawn_wait_for_attach $binfile]
32 set testpid [spawn_id_get_pid $test_spawn_id]
34 # gdb_load ("file" command) must not be executed for the bug reproducibility.
35 # That includes prepare_for_testing or clean_restart.
39 gdb_test_multiple "attach $testpid" $test {
40 -re "Attaching to process $testpid\r\n.*Cannot insert breakpoint .*\r\n$gdb_prompt $" {
43 -re "Attaching to process $testpid\r\n.*\r\n$gdb_prompt $" {
48 kill_wait_spawned_process $test_spawn_id