]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.mi/mi-thread-specific-bp.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-thread-specific-bp.exp
CommitLineData
1d506c26 1# Copyright 2023-2024 Free Software Foundation, Inc.
2fd9a436
AB
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# This test is for creating thread-specific breakpoint using the MI,
17# and checking the results from GDB.
18
19load_lib mi-support.exp
20set MIFLAGS "-i=mi"
21
22if {[mi_clean_restart]} {
23 return
24}
25
26standard_testfile
27
28if [build_executable ${testfile}.exp ${binfile} ${srcfile}] {
29 return -1
30}
31
2fd9a436
AB
32proc make_loc {num} {
33 return [mi_make_breakpoint_loc -thread "1" -number "$::decimal\\.$num"]
34}
35
00cdd79a
AB
36foreach_mi_ui_mode mode {
37
38 if {$mode == "separate"} {
39 set start_ops "separate-mi-tty"
40 } else {
41 set start_ops ""
42 }
43
44 if {[mi_clean_restart $binfile $start_ops]} {
45 return -1
46 }
47
48 # Ensure we get an error when placing a b/p for thread 1 at a point
49 # where thread 1 doesn't exist.
50 mi_gdb_test "-break-insert -p 1 bar" \
51 "\\^error,msg=\"Unknown thread 1\\.\""
2fd9a436 52
00cdd79a
AB
53 # If we have a separate CLI UI then run the 'info breakpoints'
54 # command. There was a time when the previous breakpoint request
55 # would succeed, and then 'info breakpoint' on the CLI would
56 # trigger an assertion.
57 if {$mode eq "separate"} {
58 with_spawn_id $gdb_main_spawn_id {
59 gdb_test "info breakpoints" "No breakpoints or watchpoints\\." \
60 "check CLI 'info breakpoints' when there are no breakpoints"
61 }
62 }
63
64 if {[mi_runto_main] == -1} {
65 return -1
66 }
67
68 # Ensure we get an error when placing a b/p for a thread that doesn't
69 # exist (when other threads do exist).
70 mi_gdb_test "-break-insert -p 999 bar" \
71 "\\^error,msg=\"Unknown thread 999\\.\""
72
73 mi_create_breakpoint "-p 1 bar" "thread-specific b/p on bar" \
74 -thread "1"
75
76 set loc1 [make_loc 1]
77 set loc2 [make_loc 2]
78 set loc3 [make_loc 3]
79
80 mi_create_breakpoint_multi "-p 1 foo" "thread-specific b/p on foo" \
81 -thread "1" \
82 -locations "\\\[$loc1,$loc2,$loc3\\\]"
83
84 # Check that 'info breakpoints' on the CLI succeeds.
85 if {$mode eq "separate"} {
86 with_spawn_id $gdb_main_spawn_id {
87 gdb_test "info breakpoints" ".*" \
88 "check CLI 'info breakpoints' when there are some breakpoints"
89 }
90 }
91}