]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.mi/mi-catch-load.exp
fb0c024cfc00f12bbf3378609830ec4e7ddd4c02
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-catch-load.exp
1 # Copyright 2012-2017 Free Software Foundation, Inc.
2 # This program is free software; you can redistribute it and/or modify
3 # it under the terms of the GNU General Public License as published by
4 # the Free Software Foundation; either version 3 of the License, or
5 # (at your option) any later version.
6 #
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License for more details.
11 #
12 # You should have received a copy of the GNU General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 #
15 load_lib mi-support.exp
16
17 if {[skip_shlib_tests]} {
18 return -1
19 }
20
21 gdb_exit
22 if [mi_gdb_start] {
23 continue
24 }
25
26 if {[get_compiler_info]} {
27 warning "Could not get compiler info"
28 untested "no compiler info"
29 return -1
30 }
31
32 standard_testfile mi-catch-load.c
33
34 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug shlib_load}] != "" } {
35 untested "failed to compile"
36 return -1
37 }
38
39 set testfile2 mi-catch-load-so
40 set srcfile2 ${testfile2}.c
41 set binfile2 [standard_output_file ${testfile2}.so]
42 set binfile2_dlopen [shlib_target_file ${testfile2}.so]
43 if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfile2}" ${binfile2} {debug}] != "" } {
44 untested "failed to compile shared library"
45 return -1
46 }
47 mi_run_to_main
48
49 # test -catch-load
50 mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" "catch-load: auto-solib-add on"
51 mi_gdb_test "222-catch-load -t mi-catch-load-so.so*" \
52 "222\\^done,bkpt=\{number=\"2\",type=\"catchpoint\",disp=\"del\",enabled=\"y\",what=\"load of library matching mi-catch-load-so\.so\\*\",catch-type=\"load\",thread-groups=\\\[\"i1\"\\\],times=\"0\"\}" \
53 "catch-load: catch load"
54 mi_send_resuming_command "exec-continue" "catch-load: continue"
55
56 gdb_expect {
57 -re "\\*stopped.*reason=\"solib-event\".*added=.*\r\n.*\r\n$mi_gdb_prompt$" {
58 pass "catch-load: solib-event stop"
59 }
60 -re ".*$mi_gdb_prompt$" {
61 setup_kfail mi/15945 *-*-*mingw*
62 fail "catch-load: solib-event stop"
63 }
64 timeout {
65 fail "(timeout) catch-load: solib-event stop"
66 }
67 }
68
69 mi_gdb_exit
70
71
72 if [mi_gdb_start] {
73 continue
74 }
75 mi_run_to_main
76
77 # test -catch-unload
78 mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" "catch-unload: auto-solib-add on"
79 mi_gdb_test "222-catch-unload -t mi-catch-load-so.so*" \
80 "222\\^done,bkpt=\{number=\"2\",type=\"catchpoint\",disp=\"del\",enabled=\"y\",what=\"unload of library matching mi-catch-load-so\.so\\*\",catch-type=\"unload\",thread-groups=\\\[\"i1\"\\\],times=\"0\"\}" \
81 "catch-unload: catch unload"
82 mi_send_resuming_command "exec-continue" "catch-unload: continue"
83
84 gdb_expect {
85 -re "\\*stopped.*reason=\"solib-event\".*removed=.*\r\n.*\r\n$mi_gdb_prompt$" {
86 pass "catch-unload: solib-event stop"
87 }
88 -re ".*$mi_gdb_prompt$" {
89 setup_kfail mi/15945 *-*-*mingw*
90 fail "catch-unload: solib-event stop"
91 }
92 timeout {
93 fail "(timeout) catch-unload: solib-event stop"
94 }
95 }