Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright (C) 2011-2020 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 | ||
d221e7ef | 16 | if {![can_spawn_for_attach]} { |
43136979 AR |
17 | return 0 |
18 | } | |
19 | ||
a64d2530 | 20 | standard_testfile .c |
43136979 | 21 | set executable ${testfile} |
43136979 | 22 | |
dc196b23 | 23 | if { [prepare_for_testing "failed to prepare" $executable "" [list debug "additional_flags=-fPIE" "ldflags=-pie"]] } { |
43136979 AR |
24 | return -1 |
25 | } | |
26 | ||
27 | clean_restart $executable | |
28 | set arch "" | |
29 | set test "show architecture" | |
30 | gdb_test_multiple $test $test { | |
31 | -re "The target architecture is set automatically \\(currently (.*)\\)\r\n$gdb_prompt $" { | |
32 | set arch $expect_out(1,string) | |
33 | pass $test | |
34 | } | |
35 | } | |
36 | if ![runto_main] { | |
37 | return 0 | |
38 | } | |
39 | set test "sanity check info shared" | |
40 | gdb_test_multiple "info shared" $test { | |
41 | -re "From\[ \t\]+To\[ \t\]+Syms Read\[ \t\]+Shared Object Library\r\n0x.*\r\n$gdb_prompt $" { | |
42 | pass $test | |
43 | } | |
44 | -re "No shared libraries loaded at this time\\.\r\n$gdb_prompt $" { | |
5b362f04 | 45 | untested "no shared libraries loaded" |
43136979 AR |
46 | } |
47 | } | |
48 | gdb_exit | |
49 | ||
50 | if {$arch == ""} { | |
5b362f04 | 51 | untested "no architecture set" |
43136979 AR |
52 | return 0 |
53 | } | |
54 | ||
d221e7ef DB |
55 | # Start the program running and then wait for a bit, to be sure |
56 | # that it can be attached to. | |
57 | ||
2c8c5d37 PA |
58 | set test_spawn_id [spawn_wait_for_attach $binfile] |
59 | set testpid [spawn_id_get_pid $test_spawn_id] | |
43136979 AR |
60 | |
61 | gdb_start | |
62 | file delete -- $binfile | |
bf74e428 | 63 | gdb_test "attach $testpid" "Attaching to process $testpid\r\n.*" "attach" |
43136979 AR |
64 | gdb_test "set architecture $arch" "The target architecture is assumed to be $arch" |
65 | gdb_test "info shared" "From\[ \t\]+To\[ \t\]+Syms Read\[ \t\]+Shared Object Library\r\n0x.*" | |
66 | ||
2c8c5d37 | 67 | kill_wait_spawned_process $test_spawn_id |