]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/attach-pie-noexec.exp
Update year range in copyright notice of all files owned by the GDB project.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / attach-pie-noexec.exp
CommitLineData
32d0add0 1# Copyright (C) 2011-2015 Free Software Foundation, Inc.
43136979
AR
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# Manipulation with PID on target is not supported.
17if [is_remote target] then {
18 return 0
19}
20
a64d2530 21standard_testfile .c
43136979 22set executable ${testfile}
43136979
AR
23
24if { [prepare_for_testing ${testfile}.exp $executable "" [list debug "additional_flags=-fPIE -pie"]] } {
25 return -1
26}
27
28clean_restart $executable
29set arch ""
30set test "show architecture"
31gdb_test_multiple $test $test {
32 -re "The target architecture is set automatically \\(currently (.*)\\)\r\n$gdb_prompt $" {
33 set arch $expect_out(1,string)
34 pass $test
35 }
36}
37if ![runto_main] {
38 return 0
39}
40set test "sanity check info shared"
41gdb_test_multiple "info shared" $test {
42 -re "From\[ \t\]+To\[ \t\]+Syms Read\[ \t\]+Shared Object Library\r\n0x.*\r\n$gdb_prompt $" {
43 pass $test
44 }
45 -re "No shared libraries loaded at this time\\.\r\n$gdb_prompt $" {
46 untested ${testfile}.exp
47 }
48}
49gdb_exit
50
51if {$arch == ""} {
52 untested ${testfile}.exp
53 return 0
54}
55
56set testpid [eval exec $binfile &]
57exec sleep 2
58
59gdb_start
60file delete -- $binfile
61gdb_test "attach $testpid" "Attaching to process $testpid\r\n.*: No such file or directory\\." "attach"
62gdb_test "set architecture $arch" "The target architecture is assumed to be $arch"
63gdb_test "info shared" "From\[ \t\]+To\[ \t\]+Syms Read\[ \t\]+Shared Object Library\r\n0x.*"
64
65eval exec kill -9 $testpid