From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7833) id 894193858D32; Tue, 26 Jul 2022 07:59:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 894193858D32 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Lancelot SIX To: gdb-cvs@sourceware.org Subject: [binutils-gdb] MI: mi_runto -pending X-Act-Checkin: binutils-gdb X-Git-Author: Pedro Alves X-Git-Refname: refs/heads/master X-Git-Oldrev: 8e883b5e112208afe488c529a1fb82116ff729f1 X-Git-Newrev: 60cd08d40309a2b4ce1daae84074893e6303ad17 Message-Id: <20220726075920.894193858D32@sourceware.org> Date: Tue, 26 Jul 2022 07:59:20 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jul 2022 07:59:20 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D60cd08d40309= a2b4ce1daae84074893e6303ad17 commit 60cd08d40309a2b4ce1daae84074893e6303ad17 Author: Pedro Alves Date: Fri Jul 8 11:37:17 2022 +0100 MI: mi_runto -pending =20 With the CLI testsuite's runto proc, we can pass "allow-pending" as an option, like: =20 runto func allow-pending =20 That is currently not possible with MI's mi_runto, however. This patch makes it possible, by adding a new "-pending" option to mi_runto. =20 A pending breakpoint shows different MI attributes compared to a breakpoint with a location, so the regexp returned by mi_make_breakpoint isn't suitable. Thus, add a new mi_make_breakpoint_pending proc for pending breakpoints. =20 Tweak mi_runto to let it take and pass down arguments. =20 Change-Id: I185fef00ab545a1df2ce12b4dbc3da908783a37c Diff: --- gdb/testsuite/lib/mi-support.exp | 68 +++++++++++++++++++++++++++++++++++-= ---- 1 file changed, 61 insertions(+), 7 deletions(-) diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-suppor= t.exp index e578a7e6f9b..ca56e12b06b 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -1114,21 +1114,34 @@ proc mi_clean_restart { args } { # Supported options: # # -qualified -- pass --qualified to -break-insert +# -pending -- pass -f to -break-insert to create a pending +# breakpoint. =20 proc mi_runto_helper {func run_or_continue args} { global mi_gdb_prompt expect_out global hex decimal fullname_syntax =20 - parse_args {{qualified}} + parse_args {{qualified} {pending}} =20 set test "mi runto $func" - set bp [mi_make_breakpoint -type breakpoint -disp del \ - -func $func\(\\\(.*\\\)\)?] + if {$pending} { + set bp [mi_make_breakpoint_pending -type breakpoint -disp del] + } else { + set bp [mi_make_breakpoint -type breakpoint -disp del \ + -func $func\(\\\(.*\\\)\)?] + } set extra_opts "" + set extra_output "" if {$qualified} { - append extra_opts "--qualified" + lappend extra_opts "--qualified" } - mi_gdb_test "200-break-insert $extra_opts -t $func" "200\\^done,$bp" \ + if {$pending} { + lappend extra_opts "-f" + # MI prints "Function FUNC not defined", "No line NNN in current + # file.", etc. to the CLI stream. + set extra_output "&\"\[^\r\n\]+\"\r\n" + } + mi_gdb_test "200-break-insert [join $extra_opts " "] -t $func" "${extra_= output}200\\^done,$bp" \ "breakpoint at $func" =20 if {$run_or_continue =3D=3D "run"} { @@ -1142,8 +1155,8 @@ proc mi_runto_helper {func run_or_continue args} { mi_expect_stop "breakpoint-hit" $func ".*" ".*" "\[0-9\]+" { "" "disp=3D= \"del\"" } $test } =20 -proc mi_runto {func} { - return [mi_runto_helper $func "run"] +proc mi_runto {func args} { + return [mi_runto_helper $func "run" {*}$args] } =20 # Just like runto_main but works with the MI interface. @@ -2683,6 +2696,47 @@ proc mi_make_breakpoint_multi {args} { return $result } =20 +# Construct a breakpoint regexp, for a pending breakpoint. This may +# be used to test the output of -break-insert, -dprintf-insert, or +# -break-info for pending breakpoints. +# +# Arguments for the breakpoint may be specified using the options +# number, type, disp, enabled, pending. +# +# Example: mi_make_breakpoint_pending -number 2 -pending func +# will return the breakpoint: +# bkpt=3D{number=3D"2",type=3D".*",disp=3D".*",enabled=3D".*",addr=3D"", +# pending=3D"func", times=3D"0".*original-location=3D".*"} + +proc mi_make_breakpoint_pending {args} { + parse_args {{number .*} {type .*} {disp .*} {enabled .*} + {pending .*} {original-location .*}} + + set attr_list {} + foreach attr [list number type disp enabled] { + lappend attr_list $attr [set $attr] + } + + lappend attr_list "addr" "" + + foreach attr [list pending] { + lappend attr_list $attr [set $attr] + } + + set ignore 0 + set times 0 + set script "" + set cond "" + set evaluated-by "" + + set result [mi_make_breakpoint_1 \ + $attr_list $cond ${evaluated-by} $times \ + $ignore $script ${original-location}] + + append result "\\\}" + return $result +} + # Construct a breakpoint regexp. This may be used to test the output of # -break-insert, -dprintf-insert, or -break-info. #