Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to display toString() result in value column in Eclipse debugger?

Is it possible to display toString() result in value column in Eclipse debugger?

By default it displays values for built-in types and type name + id for user types:

enter image description here

Note, that debugger definitely CAN display toString(), but it does this only in separate section (below), not in Value column.

like image 421
Dims Avatar asked May 15 '15 14:05

Dims


People also ask

How do I show variables in Eclipse debugger?

Variables/Expression view – Shows the declared variables and their values. Press Ctrl+Shift+d or Ctrl+Shift+i on a selected variable or expression to show its value. You can also add a permanent watch on an expression/variable that will then be shown in the Expressions view when debugging is on.

How do I use expressions in Eclipse debugger?

To manually open the Expressions view, go to Window | Show View | Debug | Expressions. The Expressions view allows you to monitor certain variables which you have decided to 'watch' during the debugging process. Selecting a variable will display details in the detail pane below the view.

How do I debug multiple threads in Eclipse?

Start debug session. When the breakpoint in run is hit, you can go to another breakpoint, enable that breakpoint if it was disabled. Then right click on the breakpoint -> go to Filters, now you can select the thread you want the breakpoint to be remain enabled for and you can uncheck the rest of the threads.

How do I change the variable value in Eclipse while debugging?

Changing a Variable's Value To set a variable go to the Variables view and select the variable you want to change. Right click on the variable and select Change Value... Once you have change the value click ok. The variable now has a new value.


1 Answers

It is possible, if a bit clumsy. One picture, more than a thousand words:

enter image description here

In the preferences, search for "Detail Formatters". Optionally define a simple return command for each type you want to inspect (if you want to choose the details yourself).

Then down below, select "Show variable details > As the label for all variables" (if toString() is enough for you), or "> As the label for variables with detail formatters" if you want to use your custom formatters. The former makes the "Type + ID" display vanish, tho.

Simple formatter for "not toString()": Detail Formatter for "other"

like image 147
hiergiltdiestfu Avatar answered Oct 30 '22 18:10

hiergiltdiestfu