spacemacs

2022-02-14T09:48:14.112969Z

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-johnny 2022-02-14T10:29:54.141349Z

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?

2022-02-14T10:42:31.544759Z

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-johnny 2022-02-14T11:27:52.499579Z

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-johnny 2022-02-14T14:09:30.323809Z

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

practicalli-johnny 2022-02-14T14:11:32.884289Z

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

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

2022-02-14T16:32:35.856949Z

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-johnny 2022-02-14T16:48:43.572079Z

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

jumar 2022-02-14T18:39:33.024189Z

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

2022-02-14T19:12:08.948659Z

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.