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:
Note, that debugger definitely CAN display toString()
, but it does this only in separate section (below), not in Value
column.
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.
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.
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.
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.
It is possible, if a bit clumsy. One picture, more than a thousand words:
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()":
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With