* hppa.h (pa_opcodes): Use "cX" completer instead of "cx" in fstqx
[external/binutils.git] / gdb / testsuite / gdb.base / attach-pie-noexec.exp
1 # Copyright (C) 2011-2012 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 # Manipulation with PID on target is not supported.
17 if [is_remote target] then {
18     return 0
19 }
20
21 set testfile attach-pie-noexec
22 set executable ${testfile}
23 set binfile ${objdir}/${subdir}/${executable}
24
25 if { [prepare_for_testing ${testfile}.exp $executable "" [list debug "additional_flags=-fPIE -pie"]] } {
26     return -1
27 }
28
29 clean_restart $executable
30 set arch ""
31 set test "show architecture"
32 gdb_test_multiple $test $test {
33     -re "The target architecture is set automatically \\(currently (.*)\\)\r\n$gdb_prompt $" {
34         set arch $expect_out(1,string)
35         pass $test
36     }
37 }
38 if ![runto_main] {
39     return 0
40 }
41 set test "sanity check info shared"
42 gdb_test_multiple "info shared" $test {
43     -re "From\[ \t\]+To\[ \t\]+Syms Read\[ \t\]+Shared Object Library\r\n0x.*\r\n$gdb_prompt $" {
44         pass $test
45     }
46     -re "No shared libraries loaded at this time\\.\r\n$gdb_prompt $" {
47         untested ${testfile}.exp
48     }
49 }
50 gdb_exit
51
52 if {$arch == ""} {
53     untested ${testfile}.exp
54     return 0
55 }
56
57 set testpid [eval exec $binfile &]
58 exec sleep 2
59
60 gdb_start
61 file delete -- $binfile
62 gdb_test "attach $testpid" "Attaching to process $testpid\r\n.*: No such file or directory\\." "attach"
63 gdb_test "set architecture $arch" "The target architecture is assumed to be $arch"
64 gdb_test "info shared" "From\[ \t\]+To\[ \t\]+Syms Read\[ \t\]+Shared Object Library\r\n0x.*"
65
66 eval exec kill -9 $testpid