File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
doc/modules/ROOT/pages/debugging Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -198,6 +198,41 @@ plus metadata annotation in your code. Note that you'll have to delete
198198this annotation by hand; you cannot simply use kbd:[C-M-x] as you
199199can to un-instrument kbd:[C-u C-M-x].
200200
201+ == Caveats
202+
203+ Due to the way the debugger is currently implemented there are some
204+ limitations when it comes to certain forms. Set literals are currently
205+ not instrumented at all. Map literals are currently only instrumented
206+ if they are small or the keys have some natural order. For example the
207+ following expression won't be instrumented.
208+
209+ [source,clojure]
210+ ----
211+ #dbg (count {:foo 2 :bar (inc 4) "foo" 6 "bar" 8 9
212+ 10 11 12 13 14 15 (inc 16) 17 (inc 18)})
213+ ----
214+
215+ Another construct where the debugger is currently limited is `loop`/`recur`.
216+ As `recur` always has to appear in a tail-position inside a `loop` or a `fn`
217+ and the debugger uses macros to interleave breakpoints in the forms it
218+ *might* happen that a `recur` no longer appears in a tail position. In that
219+ case we have to avoid setting up the breakpoint. An example of such a case
220+ is:
221+
222+ [source,clojure]
223+ ----
224+ (loop [i 0]
225+ #break
226+ (when (< i 10)
227+ (println i)
228+ (recur (inc i))))
229+ ----
230+
231+ Here the breakpoint is exactly in front of a form that contains as last expression
232+ a `recur` which is not wrapped in a loop. Currently this breakpoint has no
233+ effect. This does not mean you can not use the debugger with `loop`, it just means
234+ you have to set your debug statements more carefully.
235+
201236== Debugger Internals
202237
203238NOTE: This section explains a bit of the inner workings of the debugger. It is
You can’t perform that action at this time.
0 commit comments