]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/jit-attach-pie.exp
Automatic Copyright Year update after running gdb/copyright.py
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / jit-attach-pie.exp
CommitLineData
4a94e368 1# Copyright (C) 2016-2022 Free Software Foundation, Inc.
bb805577
JK
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
16if {![can_spawn_for_attach]} {
17 return 0
18}
19
20standard_testfile .c
21set executable ${testfile}
22
23if { [build_executable ${testfile}.exp $executable $srcfile \
6ef69a3f 24 [list debug pthreads pie]] } {
bb805577
JK
25 return -1
26}
27
28# Start the program running and then wait for a bit, to be sure
29# that it can be attached to.
30
31set test_spawn_id [spawn_wait_for_attach $binfile]
32set testpid [spawn_id_get_pid $test_spawn_id]
33
34# gdb_load ("file" command) must not be executed for the bug reproducibility.
35# That includes prepare_for_testing or clean_restart.
36gdb_start
37
38set test "attach"
39gdb_test_multiple "attach $testpid" $test {
40 -re "Attaching to process $testpid\r\n.*Cannot insert breakpoint .*\r\n$gdb_prompt $" {
41 fail $test
42 }
43 -re "Attaching to process $testpid\r\n.*\r\n$gdb_prompt $" {
44 pass $test
45 }
46}
47
48kill_wait_spawned_process $test_spawn_id