Fork me on GitHub
#spacemacs
<
2022-02-14
>
paulspencerwilliams09:02:14

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.

practicalli-johnny10:02:54

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?

paulspencerwilliams10:02:31

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.

practicalli-johnny11:02:52

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))

practicalli-johnny14:02:30

The above code does break correctly when evaluating the dotimes expression (`, e f`)

practicalli-johnny14:02:32

Using #break without a condition also works in this basic example

(dotimes [i 10]
  #break (= i 7)
   (prn i))

paulspencerwilliams16:02:35

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.

practicalli-johnny16:02:43

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

jumar18:02:33

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

paulspencerwilliams19:02:08

Cheers @U05254DQM, I had ruled out conditional syntax etc by simplifying and removing the conditional. @U06BE1L6T 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.