Get method result in Java debugger
Suppose I need to debug some compiled Java code that provides debug information. Therefore, I cannot change this code. For example, I have
SomeClass object;
object.doAction1().doAnotherAction().doAnythingElse();
So, I want to check the object that doAction () returns and its fields. I know that most IDEs have a valuValue action, but I don't have to call the method twice because it can make changes that cannot be reversed. I don't care which IDE (Eclipse, Idea, Netbeans ...) to use or even pure jdb. Perhaps there is a corresponding expression that suits many language debuggers, not just Java.
+3
source to share
2 answers
It's called Expressions in Eclipse. If you go to the "Debug" perspective, you can see this.
If you can't get to the debug perspective
- Click Window> Open Perspective> Debug.
- If you do not see debug information, click another and search for "Debug".
Opening the Expressions tab
- If you don't see it in debug mode, go to Window> Show View> Expressions.
- If you don't see Expressions in the Show view, click Other instead of Expressions.
- Inside expressions, click Add New Expression and paste your code you want to evaluate there.
0
source to share