You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expose breakpoint hitcounts in the expression language through the
special variable runtime.bphitcount:
runtime.bphitcount[1]
runtime.bphitcount["bpname"]
will evaluate respectively to the hitcount of breakpoint with id == 1
and to the hitcount of the breakpoint named "bpname".
This is intended to be used in breakpoint conditions and allows
breakpoints to be chained such that one breakpoint is only hit after a
different is hit first.
A few optimizations are implemented so that chained breakpoints are
evaluated efficiently.
Copy file name to clipboardExpand all lines: Documentation/cli/README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -211,7 +211,7 @@ Set breakpoint condition.
211
211
212
212
Specifies that the breakpoint, tracepoint or watchpoint should break only if the boolean expression is true.
213
213
214
-
See [Documentation/cli/expr.md](//github.com/go-delve/delve/tree/master/Documentation/cli/expr.md) for a description of supported expressions.
214
+
See [Documentation/cli/expr.md](//github.com/go-delve/delve/tree/master/Documentation/cli/expr.md) for a description of supported expressions and [Documentation/cli/cond.md](//github.com/go-delve/delve/tree/master/Documentation/cli/cond.md) for a description of how breakpoint conditions are evaluated.
215
215
216
216
With the -hitcount option a condition on the breakpoint hit count can be set, the following operators are supported
* The normal condition, which is specified using the command `cond <breakpoint> <expr>` (or by setting the Cond field when amending a breakpoint via the API), is any [expression](expr.md) which evaluates to true or false.
6
+
* The hitcount condition, which is specified `cond <breakpoint> -hitcount <operator> <number>` (or by setting the HitCond field when amending a breakpoint via the API), is a constraint on the number of times the breakpoint has been hit.
7
+
8
+
When a breakpoint location is encountered during the execution of the program, the debugger will:
9
+
10
+
* Evaluate the normal condition
11
+
* Stop if there is an error while evaluating the normal condition
12
+
* If the normal condition evaluates to true the hit count is incremented
13
+
* Evaluate the hitcount condition
14
+
* If the hitcount condition is also satisfied stop the execution at the breakpoint
0 commit comments