Is it possible to have a post-mortem ( or post-exception ) debugging session in Java ? What would the workarounds be ( if there isn’t a solution for this already ) ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can attach the debugger to a java process and set a breakpoint when a specific exception is received. Is this what you need?
From http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/jdb.html
This type of breakpoints can be set with any IDE, such as Eclipse. Using eclipse you can also set a breakpoint on a specific exception type, even if it is caught in the normal code.
If you have something like a multi-threaded server running, and one of the threads servicing a client throws an unhandled exception, then you would be able to check the debugger and see what happens. I don’t think this is something for production, but definitively helps when testing.
The application does not have to run from the debugger, but it can be launched with the debug options as arguments:
The application runs normally, but switches into ‘interpreted’ mode when a breakpoint is hit, at least in more modern versions of the JVM. So the performance is not affected.
Check the section about full-speed debugging for HotSpot VM