From: Andrew Burgess Date: Tue, 4 Apr 2023 17:10:48 +0000 (+0100) Subject: gdb/testsuite: accept script argument for mi_make_breakpoint_pending X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=393946658fe67e95abe41d3de03b36d84563e873;p=binutils-gdb.git 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 --- diff --git a/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp b/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp index 358d929f1bb..28f52938aeb 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=\"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 71c3d45fe44..79f0db8e35e 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 52c188df49d..0d830d8e4ae 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 \