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

Debugger support for 'break on exception' #2754

Closed
alendit opened this issue Nov 24, 2019 · 8 comments
Closed

Debugger support for 'break on exception' #2754

alendit opened this issue Nov 24, 2019 · 8 comments

Comments

@alendit
Copy link

alendit commented Nov 24, 2019

Is your feature request related to a problem? Please describe.

It's helpful to examine the state of the program at the moment when something exceptional occurs. Stacktraces alone don't provide enough information, like the value of the variables at the exception time.

Describe the solution you'd like

An option to set a breakpoint on exception, similar to SLBD (or even GDB or node debugger).

Describe alternatives you've considered

Wrapping the point of exception in a try-form and setting breakpoint on except. Kind of works, but only (1) in your own source code (not on exceptions thrown in libraries) (2) only after you known the position in the code which throws.

Additional context

I'm sure that this is a very common request and that there is some really good technical reason, why it wasn't implemented here. But I didn't find any issues tracking it, so I though I'll make one.

@bbatsov
Copy link
Member

bbatsov commented Nov 24, 2019

@Malabarba can you share some thoughts what would it take to implement this? I don't recall if we've discussed it in the past, but I know that people ask about this from time to time.

@Malabarba
Copy link
Member

There are two ways I could see this feature going:

  • Debug the exception wherever it happens, as close to the throw statement as possible.
  • Mark one or more functions for debugging, and enter the debugger when an exception happens during the execution of those functions (the place of the debugging would be the place inside those functions that caught the exception).

The first item I have no idea how to do. The second item can be done by defining a new breakpoint macro.

The debugger works by walking around the code and wrapping anything that looks interesting in a breakpoint macro that will do a number of things (pause excution, ask for user input , etc). You can invoke the instrumenter with a different macro, which wraps the code in a try catch block and will only ask for user input if it catches an exception.

@alendit
Copy link
Author

alendit commented Jan 3, 2020

I found it useful to start cider with (setenv "JAVA_OPTS" "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044") and connect with a remote debugger. I used IDEA, since I am not sure if dap-mode supports breaking on exceptions. It's not ideal and far cry from the SLDB experience, but can help to find the causes of strange exceptions.

@stale
Copy link

stale bot commented Apr 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

@stale stale bot added the stale label Apr 2, 2020
@yuhan0
Copy link
Contributor

yuhan0 commented Apr 2, 2020

Could the stale bot config be changed to exclude issues with "help wanted" and "bug" tags?

Closing stale issues only decreases their visibility, I've seen a few outstanding bug reports that have been closed by stalebot and they don't turn up in a default search of the issues - once I almost ended up filing a duplicate bug report because of this.

@stale stale bot removed the stale label Apr 2, 2020
@stale
Copy link

stale bot commented Jul 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

@stale stale bot added the stale label Jul 1, 2020
@stale
Copy link

stale bot commented Jul 31, 2020

This issues been automatically closed due to lack of activity. Feel free to re-open it if you ever come back to it.

@stale stale bot closed this as completed Jul 31, 2020
@lyderichti59
Copy link

Hey, is there any news on this one ? What would it take to implement it ? I would really love to have such a feature

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