deathangel908
deathangel908

Reputation: 9699

get method result in Java debugger

Lets assume I need to debug some Java compiled code which provides debug information. So I can't change this code. For example I have

SomeClass object;
object.doAction1().doAnotherAction().doAnythingElse();

So I wanna inspect an object which doAction() returns and its fields. I know there's an evaluateValue action in most IDEs but I don't need to call method twice, because it could make changes that can't be undone. I don't care which IDE (Eclipse, Idea, Netbeans... ) to use, or even pure jdb. Probably there's an appropriate expression that fits into lots of languages debuggers, not just Java.

Upvotes: 2

Views: 596

Answers (2)

Bruno Franco
Bruno Franco

Reputation: 2037

I don't know if this information is useful, but if you are using Eclipse IDE, you can choose the expression you want the result and press "ctrl + shift + i", it get's the result of that expression.

Upvotes: 2

PiRho
PiRho

Reputation: 23

It's called 'Expressions' in Eclipse. If you go to the 'Debug' Perspective, you might see it.

If you can't get to the Debug Perspective

  1. Click Window > Open Perspective > Debug.
  2. If you don't see debug, click other and search for 'Debug'.

Opening the Expressions Tab

  1. If you don't see it in debug mode, go to Window > Show View > Expressions.
  2. If you cannot see Expressions in the Show View, click on 'Other' instead of 'Expressions'.
  3. Inside the expressions, click 'Add new expression' and paste your code you want to evaluate in there.

Upvotes: 0

Related Questions