Has anyone got suggestions on why I’m struggling to break using #dbg or #break work in Spacemacs + Cider? If I , d b the same function, I can invoke, hit breakpoints, and debug successfully.
I have always used , d b
They both should sprinkle (invisible) break points throughout an expression.
I can try #dbg later today, but if it's not working the same then I assume it's a Cider issue
Is there an example you can share where it's not working?
I typically use , d b but this this case need conditional breakpoint support hence trying #dbg I’ve not got a non commercial project I’ve tried it on, but I think it will fail on all projects (I’ve never seen it work on a hand full of work projects). I’ll try at lunch on a toy project.
So I assume it's something like this. I'll also give it a try
(dotimes [i 10]
#dbg ^{:break/when (= i 7)}
(prn i))The above code does break correctly when evaluating the dotimes expression (`, e f`)
Using #break without a condition also works in this basic example
(dotimes [i 10]
#break (= i 7)
(prn i))
So.... it also works for me in my own deps.edn project, but not a more complex commercial project. Looks like I need to do into that a bit more. Thanks.
The only thing I can think of is that is not actually meeting the condition set with :break/when, or that there is a subtle bug in the cider-debug code.
This has been a useful exercise for me, thanks. I've pushed some very simple examples to the Practicalli Spacemacs book
https://practical.li/spacemacs/debug-clojure/cider-debug.html
Sometimes there used to be problems with executions in other threads like a ring handler- I can try to check if it works for our app tomorrow
Cheers @jr0cket, I had ruled out conditional syntax etc by simplifying and removing the conditional. @jumar I have similar issues when using ring handlers, but my problem earlier was a single threaded app, with the function being tested invoked indirectly and directly on the same thread.