Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement some notion of debugging session #1054

Closed
Malabarba opened this issue Apr 2, 2015 · 4 comments
Closed

Implement some notion of debugging session #1054

Malabarba opened this issue Apr 2, 2015 · 4 comments

Comments

@Malabarba
Copy link
Member

Right now, the debugger on the nrepl side consists only of a series of breakpoints. That is, when a breakpoint is reached, it notifies cider and waits for a response.

This means cider has no idea of how the breakpoints relate to each other. Are they part of the same function call? Are there more breakpoints up ahead? Cider has no way of knowing, and so it can't decide to leave some overlays hanging around, and it's harder to implement more sophisticated navigation commands.

It would be useful to have this information available. And it should be possible by wrapping function bodies in a new kind of form, like debugging-session or something.

@Malabarba
Copy link
Member Author

Malabarba commented Jun 12, 2015

The best way I can think of doing this is to have the instrumented wrap the body of defns (and similar) in a form/macro. This form would set a dynamic variable identifying a session. Something like this:

(binding [*debug-session* (randomUUID)]
  ~@body)

or maybe this

(binding [*debug-session* (atom {:uuid (randomUUID)})]
  ~@body)

This way, if one instrumented function calls another instrumented
function, that would identify a new debugging session inside the
ongoing session. Advantages would be

  • The c key would only continue 'til end of function (like it is with edebug) instead of continuing forever (like it is now).
  • The o key would also be local to the function call.
  • If the uuid is sent to Emacs along with the other information, Emacs could make the display of locals be toggled per session.

I'm reporting the above mostly as a reminder to my future self. These advantages are not huge in my view, so it's kinda low priority atm.

@runejuhl
Copy link

Would this also be needed for implementing a debugging repl? I'd love to have an ability to open a repl for the current debugging context. Often times I have an idea about what's wrong and I want to try out something, and while I can hit e and evaluate on a line-by-line basis the output is shown on top of the debugger.

Having a new repl (or a possibility of somehow binding the debugging context in a new repl session) would be amazing.

@vspinu
Copy link
Contributor

vspinu commented Jun 5, 2017

This one should be (almost) fixed with clojure-emacs/cider-nrepl#405. Each breakpoint now has access to (:original-id META_) which is unique per debugged form. That gives the "debugger session id".

As to having c, o etc local rather than global, it should be fixed by moving all or parts of *skip-breaks* atom into the local context. I would like to do this next but don't want to pile on top of clojure-emacs/cider-nrepl#405 as it's already quite stuffy. You can assign this one to me.

Would this also be needed for implementing a debugging repl?

Opening #2005 for this.

@gganley
Copy link
Contributor

gganley commented Mar 2, 2018

Is this resolved through something like cider-debug-defun-at-point or is something more being referenced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants