问题
I have an SWT application which I debug via remote debugging in eclipse. If I set a breakpoint inside an event handler of the SWT app my hole desktop freezes. I can still switch to a text console via Strg+Alt+Fx. If I kill the SWT app from the console everything continues to work.
Since this only happens when the breakpoint is inside an event handler I highly suspect SWT to block in the event loop causing everything to freeze. My guess is, that there is some magic parameter for SWT to "seperate" the applications, so I can debug properly, but I'm unable to find it.
回答1:
It's a known problem with a native widget having the X Pointer grab and not releasing it. The most common workaround is to run your inner eclipse on another display. I use Xvnc because I encounter this problem all the time, but other examples are XNest.
I've seen people try an use -Dsun.awt.disablegrab=true
. I don't know if that works or not.
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=20006 for a lengthy discussion of the problem and what people have tried.
PW
回答2:
I've repeatedly had this problem using Linux mint 11 with JRE 1.6.0.xx, although just using standard Swing components and using local debugging. When hitting a breakpoint in an event handler x11 seems to freeze completely and I need to drop to a shell to kill the java process.
Setting -Dsun.awt.disablegrab=true
solves the problem for me.
I just set the VM arguments for the debug configuration, I guess for remote debugging you'd need to make sure that the remote application was started up with this VM option on the command line (or however it's started) rather than in the IDE debug config or starting Eclipse with this option.
来源:https://stackoverflow.com/questions/6178642/debugging-an-swt-application-causes-all-gtk-application-to-freeze