Since my code is always golden (ya right!) and/or my memory is getting weak for remembering the names of all the classes involved, I often do not know how to find the source that is causing / exhibiting the problem.
Or I know of some UI within Eclipse or Jazz that has similar or desired behavior that I would like to emulate. Good old monkey see, monkey do.
A dumb or simple Eclipse debugger trick in case it ever might help you out:
- Launch a target Eclipse.
- Invoke the UI action to realize the wizard, dialog or editor.
- Pause the main thread of the target launch. If the code is not run on the main or UI thread, pause the VM while things are chugging away and find the interesting thread.
- Find the relevant stack frame and locate the interesting variables.
- Jump to the correct code to find the bug or the example you wish to emulate.
Hope this helps someone work faster and smarter.
6 comments:
Excuse me if I am stating something obvious, but if you are running Eclipse 3.4, you can just hit Alt-Shift-F1 and navigate directly to the dialog or wizard class without running Eclipse in debugger, thanks to Plug-in Spy plugin from Chris Aniszczyk.
It used to be possible to use same plugin for earlier versions, but it seem like update site is gone now.
We are not currently developing on Eclipse 3.4 and I have not tried the plug-in spy to see if it works on 3.3. Now I will have to :-)
If you were using Mylyn to create the wizard/dialog/whatever, you could instantly recall all the types and method involved simply by reactivating the task...
Good point Wayne. With Mylyn or Jazz you can easily recreate the scope of your own work. It is the starting point for the changes/enhancements made by others that I often use this trick for.
that's my favourite method for hunting threads with 100% CPU usage :)
Jacek, my favorite method for that is Ctrl-Break on java console. Simpler tools are always better. :)
You can also use jstack when running on Java 5 and higher...
It would be nice if Eclipse Debugger provided something like that for all locally running processes.
Post a Comment