Step In
When stepping through code in the debugger, you can only step through functions that you have explicitly instrumented beforehand.
This is still, by far, the biggest reason that I have to attach Intellij and debug from there.
I'm not sure what the interface should be - hopefully something better than what edebug does, which is a bit awkward.
Eval
While stopped in the debugger, you can press e
for eval
(although
it's not documented), but the resulting value is shown in an overlay,
as if it was the value of the last expression.
You can work around this by evaluating (prn thing)
or (pprint thing)
, but it might be nice to have an eval-and-pprint
command.
Overlays
Overlays are used to show values. (TODO: rant about overlays). I would often rather have the values pretty-printed into a dedicated buffer, so that I can search, copy, yank, etc.
Conditional Breakpoints
I want conditional breakpoints!
Strawman:
#break ^{:bp/condition (some expression)} (foo bar (baz))
I'm pretty sure that a reader literal only gets to operate on the single form that follows it, but I think attaching the condition as read-time metadata to the form would work.
Could also add a condition when instumenting a defn, perhaps with C-u C-u C-M-x
, then prompting for a the condition expression, which would
be an expression of the arguments.
Breakpoints List
You can show a list of instumented functions, but it's very spartan. Should be able to jump to the function, uninstrument, etc.
It would also be nice to integrate this with the cider namespace browser (which itself could use some vast improvements!).
Stacktrace
There is now an s
command to show the current stacktrace. Yay!
It might be nice to highlight stack-frames that are instrumented, and to instrument or uninstrument functions directly from the stacktrace buffer.
The reason for this is that sometimes I am debugging and can see that the parameters passed to the instrumented function are not what I expected. I will want to re-run whatever I'm doing with some functions higher in the stack instrumented so I can figure out where things went wrong.
Inspector
The cider inspector is used to show locals while stopped in the debugger.
Expanding maps is tedious. It should expand maps and sequeneces inline, indented. More of a tree-like view.
I also want it to live-update as I step, and retain its expansion-state whenever possible.
Break on Exceptions
Another thing that I currently turn to Intellij for is "Break on Exception". I would love it if cider could do this.
I'm not quite sure how cider could implement this, given its approach of intrumenting functions one-at-a-time.
One option is to have an option for mass-instrumenation of functions, by walking through loaded namespaces. This could be combined with an option to instrument code in such a way that it stops in the debugger at the point where an exception is thrown. As in Intellij, you would probably want to break conditionally, based on the specific exception class.
Another, perhaps more ambitious option would be to also integrate an entirely different debugger, based on JPDA. There may some code to be scavenged from the old emacs clojure debugger project, which I can't quite remember the name of right now (Hugo Duncan made it).
Thread
I want multithreaded debugging.
Imagine being able to step through two functions, executing in parallel, in side-by-side emacs windows. You could play with various ways of manually interleaving execution orders to reveal threading bugs (yes, those do happen in clojure!), race conditions, etc.
At the moment, I don't think this works well, if at all, although I need to do some experiments to see how far off we are. There certainly appear to be some bookkeeping vars in cider-nrepl's debug namespace that are not multithread-aware.
Macroexpansion
It would be pretty cool to step through the macroexpanded version of a piece of code, expanded inline.
Finding Your Place
At the moment, it's easy to lose your debug session.
Sometimes while stopped at a breakpoint, I start meta-dotting my way around the code, reading some other functions, etc. Eventually, I want to continue my debugging session, but I can't remember which function or even which namespace the debugger is stopped in. I need a way to jump back to the code that I'm currently stopped in.
Read Only
I would prefer if files were always read-only while debugging. The
fact that you can type any character you like except for n
, e
,
etc. (the debugger commands) is just weird.
Also, if I'm pounding on n
in rapid succession and hit a function
that takes some time (eg: a database call), then I accidentally start
typing n's into the code.