diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/lib/mi-support.exp | 68 |
1 files changed, 61 insertions, 7 deletions
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index e578a7e..ca56e12 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. proc mi_runto_helper {func run_or_continue args} { global mi_gdb_prompt expect_out global hex decimal fullname_syntax - parse_args {{qualified}} + parse_args {{qualified} {pending}} 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" if {$run_or_continue == "run"} { @@ -1142,8 +1155,8 @@ proc mi_runto_helper {func run_or_continue args} { mi_expect_stop "breakpoint-hit" $func ".*" ".*" "\[0-9\]+" { "" "disp=\"del\"" } $test } -proc mi_runto {func} { - return [mi_runto_helper $func "run"] +proc mi_runto {func args} { + return [mi_runto_helper $func "run" {*}$args] } # Just like runto_main but works with the MI interface. @@ -2683,6 +2696,47 @@ proc mi_make_breakpoint_multi {args} { return $result } +# 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={number="2",type=".*",disp=".*",enabled=".*",addr="<PENDING>", +# pending="func", times="0".*original-location=".*"} + +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" "<PENDING>" + + 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. # |