Issue
Using evaluate expression/code fragment:
https://www.jetbrains.com/idea/help/evaluating-expressions.html
Is it possible to debug evaluated expression/code fragment on intellij?.
On eclipse if you launch a code evaluation on display window and that code has any breakpoint inside, eclipse debugger stops on that breakpoint. If you try again eclipse says it can execute inspections on nested debug session.
Intellij seems to launch expression in a different session.
My workflow on this is to stop on "whatever line" of code and add fragment I want to evaluate for a Q&D debug. Many times this leads to a debug restart.
Solution
Unfortunately it's not possible in Intellij 14 and stated in the official link you provided:
If a method invoked within the Expression Evaluation has a breakpoint inside its body, this breakpoint will be ignored.
To eliminate the problem you mentioned with frequent restarting of a debug session I use the following work-around with the drop-frame debug feature:
- Step in to a method and before return use the drop-frame functionality to fall back to a previous stack frame. See the drop-frame icon's location on the screenshot below:
- Now it's possible to rerun this method with different parameters without restarting the debug session (parameters can be set using Evaluate Expression dialog).
Answered By - Andrew Terekhine
Answer Checked By - Senaida (JavaFixing Volunteer)