You also might want to set a breakpoint at a specific line to better understand what's happening in your contract.
With ::debug, you can add breakpoints at a specific line of a contract or function to better understand what's happening in your contracts.
To illustrate the power of breakpoints, first add a couple new functions to your contract:
;; Existing contract code...
(define-public(count-twice)
(double)
)
(define-private(double)
(begin
(unwrap-panic(count-up))
(count-up)
)
)
Now add a break on the count-up function when calling the new double function.
Terminal
$
::debug (contract-call? .counter count-twice)
$
break count-up
Breakpoint Commands
To step through these breakpoints, you can use one of the following commands:
Step-in (step or s): Step into the sub-expressions.
Step-out (finish or f): Complete execution of the current expression and return the result to the parent.
Step-over (next or n): Continue to completion of the current expression, stepping over sub-expressions.
Continue (continue or c): Continue execution until hitting a breakpoint or completing execution.
Using the continue command, the breakpoint you set in the double function will trigger twice due to two count-up calls, which enables you to do variable and map analysis.