Commit | Line | Data |
---|---|---|
e2882c85 | 1 | # Copyright 2011-2018 Free Software Foundation, Inc. |
36dfb11c TT |
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 | load_lib mi-support.exp | |
17 | set MIFLAGS "-i=mi2" | |
18 | ||
19 | if {[skip_shlib_tests]} { | |
5b362f04 | 20 | untested "skipping shared library tests" |
36dfb11c TT |
21 | return -1 |
22 | } | |
23 | ||
24 | gdb_exit | |
25 | if [mi_gdb_start] { | |
26 | continue | |
27 | } | |
28 | ||
298a9cf0 TT |
29 | standard_testfile solib-main.c solib-lib.c |
30 | ||
36dfb11c | 31 | set libname "solib-lib" |
298a9cf0 TT |
32 | set srcfile_lib ${srcdir}/${subdir}/$srcfile2 |
33 | set binfile_lib [standard_output_file ${libname}.so] | |
36dfb11c TT |
34 | set lib_flags [list debug] |
35 | ||
298a9cf0 | 36 | set srcfile_main ${srcdir}/${subdir}/$srcfile |
36dfb11c TT |
37 | set bin_flags [list debug shlib=${binfile_lib}] |
38 | ||
4c93b1db | 39 | if [get_compiler_info] { |
36dfb11c TT |
40 | return -1 |
41 | } | |
42 | ||
43 | if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != "" | |
298a9cf0 | 44 | || [gdb_compile ${srcfile_main} ${binfile} executable $bin_flags] != "" } { |
84c93cd5 | 45 | untested "failed to compile" |
36dfb11c TT |
46 | return -1 |
47 | } | |
48 | ||
49 | mi_delete_breakpoints | |
50 | mi_gdb_reinitialize_dir $srcdir/$subdir | |
36dfb11c TT |
51 | mi_gdb_load ${binfile} |
52 | ||
4255c8d2 | 53 | mi_load_shlibs $binfile_lib |
36dfb11c | 54 | |
51457a05 MAL |
55 | proc_with_prefix test_stop_on_solib_events {} { |
56 | mi_gdb_test "777-gdb-set stop-on-solib-events 1" "777\\^done" \ | |
57 | "set stop-on-solib-events" | |
36dfb11c | 58 | |
51457a05 MAL |
59 | # We use "run" rather than "-exec-run" here in order to test that CLI |
60 | # commands still cause the correct MI output to be generated. | |
61 | mi_run_with_cli | |
6d0bb9f3 | 62 | |
51457a05 MAL |
63 | # Also test that the CLI solib event note is output. |
64 | set test "CLI prints solib event" | |
65 | gdb_expect { | |
66 | -re "~\"Stopped due to shared library event \\(no libraries added or removed\\)\\\\n" { | |
67 | pass "$test" | |
68 | } | |
69 | timeout { | |
70 | fail "$test (timeout)" | |
71 | } | |
17b2616c | 72 | } |
51457a05 MAL |
73 | |
74 | mi_expect_stop solib-event .* .* .* .* .* "check for solib event" | |
75 | ||
76 | # Unset solib events to avoid interfering with other tests. | |
77 | mi_gdb_test "778-gdb-set stop-on-solib-events 0" "778\\^done" \ | |
78 | "unset stop-on-solib-events" | |
79 | } | |
80 | ||
81 | proc_with_prefix test_file_list_shared_libraries {} { | |
82 | global libname | |
83 | global binfile | |
84 | ||
85 | mi_continue_to main | |
86 | ||
87 | mi_gdb_test "222-file-list-shared-libraries" \ | |
88 | "222\\^done,shared-libraries=\\\[\{id=\".*${libname}.so\",target-name=\".*${libname}.so\",host-name=\".*${libname}.so\",symbols-loaded=\"1\",thread-group=\".*\",ranges=\\\[\{from=\".*\",to=\".*\"\}]\}]" \ | |
89 | "get the list of shared libraries" | |
17b2616c PA |
90 | } |
91 | ||
51457a05 MAL |
92 | test_stop_on_solib_events |
93 | test_file_list_shared_libraries |