cbd3967f47a52be397183933a51cbf22d90b6444
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-catch-load.exp
1 # Copyright 2012-2021 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 if {[get_compiler_info]} {
22 warning "Could not get compiler info"
23 untested "no compiler info"
24 return -1
25 }
26
27 standard_testfile mi-catch-load.c
28
29 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug shlib_load}] != "" } {
30 untested "failed to compile"
31 return -1
32 }
33
34 set testfile2 mi-catch-load-so
35 set srcfile2 ${testfile2}.c
36 set binfile2 [standard_output_file ${testfile2}.so]
37 set binfile2_dlopen [shlib_target_file ${testfile2}.so]
38 if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfile2}" ${binfile2} {debug}] != "" } {
39 untested "failed to compile shared library"
40 return -1
41 }
42
43 mi_clean_restart $binfile
44 mi_runto_main
45
46 # test -catch-load
47 mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" "catch-load: auto-solib-add on"
48 mi_gdb_test "222-catch-load -t mi-catch-load-so.so*" \
49 "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\"\}" \
50 "catch-load: catch load"
51 mi_send_resuming_command "exec-continue" "catch-load: continue"
52
53 gdb_expect {
54 -re "\\*stopped.*reason=\"solib-event\".*added=.*\r\n.*\r\n$mi_gdb_prompt$" {
55 pass "catch-load: solib-event stop"
56 }
57 -re ".*$mi_gdb_prompt$" {
58 setup_kfail mi/15945 *-*-*mingw*
59 fail "catch-load: solib-event stop"
60 }
61 timeout {
62 fail "(timeout) catch-load: solib-event stop"
63 }
64 }
65
66 mi_clean_restart $binfile
67 mi_runto_main
68
69 # test -catch-unload
70 mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" "catch-unload: auto-solib-add on"
71 mi_gdb_test "222-catch-unload -t mi-catch-load-so.so*" \
72 "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\"\}" \
73 "catch-unload: catch unload"
74 mi_send_resuming_command "exec-continue" "catch-unload: continue"
75
76 gdb_expect {
77 -re "\\*stopped.*reason=\"solib-event\".*removed=.*\r\n.*\r\n$mi_gdb_prompt$" {
78 pass "catch-unload: solib-event stop"
79 }
80 -re ".*$mi_gdb_prompt$" {
81 setup_kfail mi/15945 *-*-*mingw*
82 fail "catch-unload: solib-event stop"
83 }
84 timeout {
85 fail "(timeout) catch-unload: solib-event stop"
86 }
87 }
This page took 0.031119 seconds and 3 git commands to generate.