How to use Eclipse's Display View for Debug?
You can view the Display
view as a place where you can inspect all sorts of variables and boolean expressions during runtime. While your debugger is frozen on a breakpoint start typing the name of an object variable for instance and you'll get autocomplete functionality as you start calling methods or fields to reach deeper class datastructures. Then when you select/mark the portion you need to inspect or everything, the buttons on the Display view will be clickable. You can always perform the Ctrl+Shift+I
shortcut on the selection to view what's the current runtime state of your selection i.e. variable, object, boolean exrepssion etc
I think this powerful feature should be used way more often.
- In the debug perspective:
Window -> Show View -> (search for) Display
- Put a break point in your code
- Trigger the breakpoint by executing this code
- Once on the breakpoint go to the Display view
- Write some code like
myObject.getSomeData();
, you can autocomplete (Ctrl+Space) - Select the expression (code) you want to evaluate
- Use one of the many display view buttons which should now be enabled
- Save some precious time...
Not sure why this view is not there by default, it should be !
As of Eclipse Photon Release (4.8.0)
This same functionality can be performed inside the the Debug Shell
. I do this by:
- Make sure I'm at a breakpoint in a Debug execution of some script
- Open the
Debug Shell
- Type in the code that I want to run
- Highlight the specific line of code
- Use either of the buttons for:
Execute Selected Text
, orDisplay Result of Evaluating Selected Text
I'm including this answer because as of 2018, with the Photon Release, I was unable to get the Display view to work in any capacity or to even show up. But I was able to perform the same work through this method.