mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
avoid hang on init breakpoints during remote debugging
This commit is contained in:
@@ -40,6 +40,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.MessageType;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.impl.XDebugSessionImpl;
|
||||
import com.sun.jdi.InternalException;
|
||||
import com.sun.jdi.ThreadReference;
|
||||
@@ -319,6 +320,17 @@ public class DebugProcessEvents extends DebugProcessImpl {
|
||||
|
||||
myDebugProcessDispatcher.getMulticaster().processAttached(this);
|
||||
|
||||
// breakpoints should be initialized after all processAttached listeners work
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
XDebugSession session = getSession().getXDebugSession();
|
||||
if (session != null) {
|
||||
session.initBreakpoints();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
final String addressDisplayName = DebuggerBundle.getAddressDisplayName(getConnection());
|
||||
final String transportName = DebuggerBundle.getTransportName(getConnection());
|
||||
showStatusText(DebuggerBundle.message("status.connected", addressDisplayName, transportName));
|
||||
|
||||
@@ -49,7 +49,7 @@ public class JavaBreakpointHandler extends XBreakpointHandler {
|
||||
if (javaBreakpoint != null) {
|
||||
final Breakpoint bpt = javaBreakpoint;
|
||||
BreakpointManager.addBreakpoint(bpt);
|
||||
myProcess.getManagerThread().invoke(new DebuggerCommandImpl() {
|
||||
myProcess.getManagerThread().schedule(new DebuggerCommandImpl() {
|
||||
@Override
|
||||
protected void action() throws Exception {
|
||||
bpt.createRequest(myProcess);
|
||||
@@ -62,7 +62,7 @@ public class JavaBreakpointHandler extends XBreakpointHandler {
|
||||
public void unregisterBreakpoint(@NotNull final XBreakpoint breakpoint, boolean temporary) {
|
||||
final Breakpoint javaBreakpoint = BreakpointManager.getJavaBreakpoint(breakpoint);
|
||||
if (javaBreakpoint != null) {
|
||||
myProcess.getManagerThread().invoke(new DebuggerCommandImpl() {
|
||||
myProcess.getManagerThread().schedule(new DebuggerCommandImpl() {
|
||||
@Override
|
||||
protected void action() throws Exception {
|
||||
javaBreakpoint.delete();
|
||||
|
||||
@@ -392,42 +392,6 @@ public class RequestManagerImpl extends DebugProcessAdapterImpl implements Reque
|
||||
|
||||
public void processAttached(DebugProcessImpl process) {
|
||||
myEventRequestManager = myDebugProcess.getVirtualMachineProxy().eventRequestManager();
|
||||
// invoke later, so that requests are for sure created only _after_ 'processAttached()' methods of other listeners are executed
|
||||
process.getManagerThread().schedule(new DebuggerCommandImpl() {
|
||||
protected void action() throws Exception {
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
XDebugSession session = myDebugProcess.getSession().getXDebugSession();
|
||||
if (session != null) {
|
||||
session.initBreakpoints();
|
||||
}
|
||||
}
|
||||
});
|
||||
//Project project = myDebugProcess.getProject();
|
||||
//final BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(project).getBreakpointManager();
|
||||
//for (final Breakpoint breakpoint : breakpointManager.getBreakpoints()) {
|
||||
// try {
|
||||
// breakpoint.createRequest(myDebugProcess);
|
||||
// } catch (Exception e) {
|
||||
// LOG.error(e);
|
||||
// }
|
||||
//}
|
||||
|
||||
//AccessToken token = ReadAction.start();
|
||||
//try {
|
||||
// JavaBreakpointAdapter adapter = new JavaBreakpointAdapter(project);
|
||||
// for (XLineBreakpoint breakpoint : XDebuggerManager.getInstance(project).getBreakpointManager()
|
||||
// .getBreakpoints(JavaLineBreakpointType.class)) {
|
||||
// //new JavaLineBreakpointRequestor(breakpoint).createRequest(myDebugProcess);
|
||||
// //adapter.getOrCreate(breakpoint).createRequest(myDebugProcess);
|
||||
// }
|
||||
//}
|
||||
//finally {
|
||||
// token.finish();
|
||||
//}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void processClassPrepared(final ClassPrepareEvent event) {
|
||||
|
||||
Reference in New Issue
Block a user