]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.mi/mi-py-modify-bp.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-py-modify-bp.exp
1 # Copyright (C) 2023-2024 Free Software Foundation, Inc.
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 # Check that the MI interpreter correctly emits breakpoint-modified
17 # notifications when a breakpoint's thread or inferior is set from
18 # Python code.
19
20 load_lib mi-support.exp
21 set MIFLAGS "-i=mi"
22
23 standard_testfile
24
25 require allow_python_tests
26
27 if {[build_executable $testfile.exp $testfile $srcfile] == -1} {
28 return -1
29 }
30
31 set remote_python_file [gdb_remote_download host \
32 ${srcdir}/${subdir}/${testfile}.py]
33
34 mi_clean_restart $binfile
35 mi_runto_main
36
37 # Delete all breakpoints.
38 mi_delete_breakpoints
39
40 # Create a breakpoint. At this point the breakpoint is global, but
41 # this will be adjusted from Python code.
42 mi_create_breakpoint "foo" "break in foo" -disp keep -func foo
43 set bpnum [mi_get_valueof "/d" "\$bpnum" "INVALID" \
44 "get number for thread-specific breakpoint"]
45
46 # Some patterns used in the expected output below.
47 set thr_group_re [string_to_regexp {thread-groups=["i1"]}]
48 set times_re [string_to_regexp {times="0"}]
49
50 # Source the Python script, the script changes the thread then
51 # inferior field of the first breakpoint, we expect to see the
52 # breakpoint modified four times.
53 mi_gdb_test "source $remote_python_file" \
54 [multi_line \
55 "&\"source \[^\r\n\]+\"" \
56 "=breakpoint-modified,bkpt=\\{number=\"$bpnum\",\[^\r\n\]+\\,$thr_group_re,thread=\"1\",$times_re,\[^\r\n\]+}" \
57 "=breakpoint-modified,bkpt=\\{number=\"$bpnum\",\[^\r\n\]+\\,$thr_group_re,$times_re,\[^\r\n\]+}" \
58 "=breakpoint-modified,bkpt=\\{number=\"$bpnum\",\[^\r\n\]+\\,$thr_group_re,inferior=\"1\",$times_re,\[^\r\n\]+}" \
59 "=breakpoint-modified,bkpt=\\{number=\"$bpnum\",\[^\r\n\]+\\,$thr_group_re,$times_re,\[^\r\n\]+}" \
60 "\\^done"] \
61 "source python script"