displaying Java objects in debugger (as in Smalltalk) [message #262216] |
Wed, 30 July 2008 00:30 |
Eclipse User |
|
|
|
Originally posted by: rpboland.gmail.com
In smalltalk when in the debugger if you display a variable it prints the
object using the printOn: method which is roughly analogous to the
toString()
method of Java.
So when I wanted a variable of a type (say X) to display nicely in the
eclipse Java debugger I wrote a toString() method for X expecting that the
toString() method would then be used to display my variable of type X.
Alas X's toString() method was ignored by the debugger.
Is there a way to get the debugger to display objects nicely?
If not, is there a reason for not providing such a facility?
I can live with having to write some method, say debugDisplay(), for X.
Classes not having a debugDisplay() method would of course behave as now.
Sincerely,
Ralph Boland
rpboland@gmail.com
|
|
|
Re: displaying Java objects in debugger (as in Smalltalk) [message #262224 is a reply to message #262216] |
Wed, 30 July 2008 02:06 |
Paul A. Rubin Messages: 188 Registered: July 2009 |
Senior Member |
|
|
Ralph Boland wrote:
> In smalltalk when in the debugger if you display a variable it prints the
> object using the printOn: method which is roughly analogous to the
> toString()
> method of Java.
>
> So when I wanted a variable of a type (say X) to display nicely in the
> eclipse Java debugger I wrote a toString() method for X expecting that
> the toString() method would then be used to display my variable of type X.
>
> Alas X's toString() method was ignored by the debugger.
>
> Is there a way to get the debugger to display objects nicely?
>
I assume you want to do this at a breakpoint? If so, go to the Display
view. For me it usually shows up automatically in the Debug perspective
(as a tab alongside the Console view), but if not you can open it via
Windows -> Show View -> Display. Type the name of the variable in the
window, highlight it, and click the icon that looks like a J on a sheet
of note paper (tooltip: Display Result of Evaluating Selected Text), or
click Run -> Display, or use the equivalent key combo (Control - Shift -
D by default). That should do the trick. If not, try adding the
..toString() method to the variable name, highlight the whole thing, and
repeat.
/Paul
|
|
|
|
Powered by
FUDForum. Page generated in 0.29091 seconds