aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2023-04-04 18:10:48 +0100
committerAndrew Burgess <aburgess@redhat.com>2023-04-14 22:16:17 +0100
commit393946658fe67e95abe41d3de03b36d84563e873 (patch)
tree256c8003a0a274ee62530f081304dcfe7740137b /gdb/testsuite
parent5be45917f49846f4ce58d8b63473e96dff7d4e0f (diff)
downloadgdb-393946658fe67e95abe41d3de03b36d84563e873.zip
gdb-393946658fe67e95abe41d3de03b36d84563e873.tar.gz
gdb-393946658fe67e95abe41d3de03b36d84563e873.tar.bz2
gdb/testsuite: accept script argument for mi_make_breakpoint_pending
This commit changes mi_make_breakpoint_pending to accept the 'script' and 'times' arguments. I've then added a new test that makes use of 'scripts' in gdb.mi/mi-pending.exp and gdb.mi/mi-dprintf-pending.exp. There is already a test in gdb.mi/mi-pending.exp that uses the 'times' argument -- previously this argument was being ignored, but is now used. Reviewed-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/gdb.mi/mi-dprintf-pending.exp6
-rw-r--r--gdb/testsuite/gdb.mi/mi-pending.exp15
-rw-r--r--gdb/testsuite/lib/mi-support.exp5
3 files changed, 21 insertions, 5 deletions
diff --git a/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp b/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp
index 358d929..28f5293 100644
--- a/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp
+++ b/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp
@@ -48,9 +48,11 @@ mi_load_shlibs $lib_sl1
set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
# Set pending dprintf via MI.
+set bp [mi_make_breakpoint_pending -number "1" -type "dprintf" \
+ -disp "keep" -enabled "y" -pending "pendfunc1" \
+ -original-location "pendfunc1"]
mi_gdb_test "-dprintf-insert -f pendfunc1 \"hello\"" \
- ".*\\^done,bkpt={number=\"1\",type=\"dprintf\",disp=\"keep\",enabled=\"y\",addr=\"<PENDING>\",pending=\"pendfunc1\",times=\"0\",original-location=\"pendfunc1\"}" \
- "mi set dprintf"
+ ".*\\^done,$bp" "mi set dprintf"
mi_create_breakpoint $bp_location1 "mi insert breakpoint bp_location1" \
-type "breakpoint" -line $bp_location1 -file ".*$srcfile"
diff --git a/gdb/testsuite/gdb.mi/mi-pending.exp b/gdb/testsuite/gdb.mi/mi-pending.exp
index 71c3d45..79f0db8 100644
--- a/gdb/testsuite/gdb.mi/mi-pending.exp
+++ b/gdb/testsuite/gdb.mi/mi-pending.exp
@@ -61,6 +61,21 @@ mi_create_breakpoint_pending "-f pendfunc1" \
-pending "pendfunc1" \
-original-location "pendfunc1"
+# Add some commands to the pending breakpoint, use -break-info to
+# check that the commands show up, then clear the commands again.
+mi_gdb_test "-break-commands 1 \"print 1\" \"print 2\" \"print 3\""\
+ "\\^done" \
+ "set breakpoint commands on pending breakpoint"
+set bp [mi_make_breakpoint_pending -number 1 -disp keep -func pendfunc1 \
+ -disp keep -enabled y -original-location pendfunc1 \
+ -script {\["print 1","print 2","print 3"\]}]
+mi_gdb_test "-break-info 1" \
+ "\\^done,[mi_make_breakpoint_table [list $bp]]" \
+ "breakpoint commands: check that commands are set"
+mi_gdb_test "-break-commands 1"\
+ "\\^done" \
+ "clear breakpoint commands on pending breakpoint"
+
# Set pending breakpoint with a condition via MI.
mi_create_breakpoint_pending "-f -c x==4 ${libfile1}.c:pendfunc2" \
"MI pending breakpoint on ${libfile1}.c:pendfunc2 if x==4" \
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 52c188d..0d830d8 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -2685,7 +2685,8 @@ proc mi_make_breakpoint_multi {args} {
proc mi_make_breakpoint_pending {args} {
parse_args {{number .*} {type .*} {disp .*} {enabled .*}
- {pending .*} {original-location .*} {thread ""} {cond ""}}
+ {pending .*} {original-location .*} {thread ""} {cond ""}
+ {script ""} {times .*}}
set attr_list {}
foreach attr [list number type disp enabled] {
@@ -2699,8 +2700,6 @@ proc mi_make_breakpoint_pending {args} {
}
set ignore 0
- set times 0
- set script ""
set evaluated-by ""
set result [mi_make_breakpoint_1 \