brake
2026-11-29
An extended breakpoint facility for Common Lisp
1Summary
This project augments standard Common Lisp BREAK facility with several conveniences.
- BRAKE in its simplest form with no arguments works as BREAK. However it can also wrap an s-expression,allowing for convenient breakpoints for instance in IF special operators.
- BRAKE can also be sequenced with two arguments: TAG and STEP. A tag keyword groups a number of BRAKE pointsacross code sequenced by their STEP numbers. BRAKE points are activated only if they are either the first inthe sequence or if a preceding step had already been reached. This allows for somewhat more manageabledebugging of complex iterations, recursive functions and multi-threaded code.
- BRAKE-WHEN is an extended from with conditional clause.
- MARK has the semantics of tagged BRAKE, except it does not interrupt the execution.
When tagged, both BRAKE(-WHEN) and MARK allow to enable tracing.
Disclaimer: this is still an experimental project, subject to changes. As it is more complex than the simple BREAK there are almost certainly scenarios where BRAKE would work counter-intuitively or fail.
2Multi-threading
BRAKE is not thread-safe per se as it uses shared state. However there's hope to make it usable for debugging race conditions and other multi-threading issues.
3Definitions
3.1(brake &optional tag-or-sexp /step/ sexp)
Sets a breakpoint.
Example: (brake)
Example: (if (oddp x) (brake (branch-odd)) (branch-even))
Example: (brake :walk 4)
3.2(brake-when conditional &optional tag-or-sexp /step/ sexp)
Sets a conditional breakpoint.
3.3(mark tag /step/ &optional sexp)
Marks the step as reached in the control flow but does not interrupt execution.
3.4(mark-when conditional &optional tag-or-sexp /step/ sexp)
Sets a conditional mark.
3.5(brake-enable &rest tags)
3.6(brake-disable &rest tags)
Enable or disable breakpoints of specified tags. Acts on all tags if none is supplied.
3.7(clear-brake-points)
Clear all tagged breakpoints. Useful when you remove breakpoints in the code, followed by recompilation.
3.8(clear-brake-tag tag)
Clear the steps for the tag and disable it.
3.9(report-brakes)
Print the summary of all tagged brakes state.
3.10(brake-trace tag &rest tags)
Print a trace of brakes or marks reached into *trace-output*.
3.11(brake-untrace &rest tags)
Untrace either specific tags or all tags if no argument is supplied.