init WEB-7884 Node.js: breakpoints are not hit, exception on stop debugging (regression)

This commit is contained in:
Vladimir Krivosheev
2013-05-24 18:08:01 +02:00
parent da31a16b80
commit 1f3efaee50
2 changed files with 42 additions and 0 deletions
@@ -105,6 +105,7 @@ public class AsyncResult<T> extends ActionCallback {
return this;
}
@Override
@NotNull
public final AsyncResult<T> notify(@NotNull final ActionCallback child) {
super.notify(child);
@@ -121,11 +121,13 @@ public class XDebugSessionImpl implements XDebugSession {
myIcon = icon;
}
@Override
@NotNull
public String getSessionName() {
return mySessionName;
}
@Override
@NotNull
public RunContentDescriptor getRunContentDescriptor() {
assertSessionTabInitialized();
@@ -141,16 +143,19 @@ public class XDebugSessionImpl implements XDebugSession {
}
}
@Override
public void setPauseActionSupported(final boolean isSupported) {
myPauseActionSupported = isSupported;
}
@Override
public void rebuildViews() {
if (!myShowTabOnSuspend) {
mySessionTab.rebuildViews();
}
}
@Override
@Nullable
public RunProfile getRunProfile() {
return myEnvironment != null ? myEnvironment.getRunProfile() : null;
@@ -160,33 +165,40 @@ public class XDebugSessionImpl implements XDebugSession {
return myPauseActionSupported;
}
@Override
@NotNull
public Project getProject() {
return myDebuggerManager.getProject();
}
@Override
@NotNull
public XDebugProcess getDebugProcess() {
return myDebugProcess;
}
@Override
public boolean isSuspended() {
return myPaused.get() && mySuspendContext != null;
}
@Override
public boolean isPaused() {
return myPaused.get();
}
@Override
@Nullable
public XStackFrame getCurrentStackFrame() {
return myCurrentStackFrame;
}
@Override
public XSuspendContext getSuspendContext() {
return mySuspendContext;
}
@Override
@Nullable
public XSourcePosition getCurrentPosition() {
return myCurrentPosition;
@@ -208,6 +220,7 @@ public class XDebugSessionImpl implements XDebugSession {
dependentBreakpointManager.addListener(myDependentBreakpointListener);
myDebugProcess.getProcessHandler().addProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(final ProcessEvent event) {
stopImpl();
}
@@ -337,18 +350,22 @@ public class XDebugSessionImpl implements XDebugSession {
return !myBreakpointsMuted && b.isEnabled() && !myDisabledSlaveBreakpoints.contains(b);
}
@Override
public boolean areBreakpointsMuted() {
return myBreakpointsMuted;
}
@Override
public void addSessionListener(@NotNull final XDebugSessionListener listener) {
myDispatcher.addListener(listener);
}
@Override
public void removeSessionListener(@NotNull final XDebugSessionListener listener) {
myDispatcher.removeListener(listener);
}
@Override
public void setBreakpointMuted(boolean muted) {
if (myBreakpointsMuted == muted) return;
myBreakpointsMuted = muted;
@@ -356,6 +373,7 @@ public class XDebugSessionImpl implements XDebugSession {
myDebuggerManager.getBreakpointManager().getLineBreakpointManager().queueAllBreakpointsUpdate();
}
@Override
public void stepOver(final boolean ignoreBreakpoints) {
if (!myDebugProcess.checkCanPerformCommands()) return;
@@ -366,6 +384,7 @@ public class XDebugSessionImpl implements XDebugSession {
myDebugProcess.startStepOver();
}
@Override
public void stepInto() {
if (!myDebugProcess.checkCanPerformCommands()) return;
@@ -373,6 +392,7 @@ public class XDebugSessionImpl implements XDebugSession {
myDebugProcess.startStepInto();
}
@Override
public void stepOut() {
if (!myDebugProcess.checkCanPerformCommands()) return;
@@ -380,6 +400,7 @@ public class XDebugSessionImpl implements XDebugSession {
myDebugProcess.startStepOut();
}
@Override
public <V extends XSmartStepIntoVariant> void smartStepInto(XSmartStepIntoHandler<V> handler, V variant) {
if (!myDebugProcess.checkCanPerformCommands()) return;
@@ -387,10 +408,12 @@ public class XDebugSessionImpl implements XDebugSession {
handler.startStepInto(variant);
}
@Override
public void forceStepInto() {
stepInto();
}
@Override
public void runToPosition(@NotNull final XSourcePosition position, final boolean ignoreBreakpoints) {
if (!myDebugProcess.checkCanPerformCommands()) return;
@@ -401,6 +424,7 @@ public class XDebugSessionImpl implements XDebugSession {
myDebugProcess.runToPosition(position);
}
@Override
public void pause() {
if (!myDebugProcess.checkCanPerformCommands()) return;
@@ -418,6 +442,7 @@ public class XDebugSessionImpl implements XDebugSession {
processAllBreakpoints(false, true);
}
@Override
public void resume() {
if (!myDebugProcess.checkCanPerformCommands()) return;
@@ -457,6 +482,7 @@ public class XDebugSessionImpl implements XDebugSession {
}
@Override
public void showExecutionPoint() {
if (mySuspendContext != null) {
XExecutionStack executionStack = mySuspendContext.getActiveExecutionStack();
@@ -470,6 +496,7 @@ public class XDebugSessionImpl implements XDebugSession {
}
}
@Override
public void setCurrentStackFrame(@NotNull final XStackFrame frame) {
setCurrentStackFrame(myCurrentExecutionStack, frame);
}
@@ -517,6 +544,7 @@ public class XDebugSessionImpl implements XDebugSession {
return null;
}
@Override
public void updateBreakpointPresentation(@NotNull final XLineBreakpoint<?> breakpoint,
@Nullable final Icon icon,
@Nullable final String errorMessage) {
@@ -533,10 +561,12 @@ public class XDebugSessionImpl implements XDebugSession {
}
}
@Override
public boolean breakpointReached(@NotNull final XBreakpoint<?> breakpoint, @NotNull final XSuspendContext suspendContext) {
return breakpointReached(breakpoint, null, suspendContext);
}
@Override
public boolean breakpointReached(@NotNull final XBreakpoint<?> breakpoint, @Nullable String evaluatedLogExpression,
@NotNull XSuspendContext suspendContext) {
XDebuggerEvaluator evaluator = XDebuggerUtilImpl.getEvaluator(suspendContext);
@@ -627,6 +657,7 @@ public class XDebugSessionImpl implements XDebugSession {
private void printMessage(final String message, final String hyperLinkText, @Nullable final HyperlinkInfo info) {
DebuggerUIUtil.invokeOnEventDispatch(new Runnable() {
@Override
public void run() {
myConsoleView.print(message, ConsoleViewContentType.SYSTEM_OUTPUT);
if (info != null) {
@@ -640,6 +671,7 @@ public class XDebugSessionImpl implements XDebugSession {
});
}
@Override
public void positionReached(@NotNull final XSuspendContext suspendContext) {
enableBreakpoints();
mySuspendContext = suspendContext;
@@ -653,6 +685,7 @@ public class XDebugSessionImpl implements XDebugSession {
myDebuggerManager.setActiveSession(this, myCurrentPosition, false, getPositionIconRenderer(true));
}
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
if (myShowTabOnSuspend) {
myShowTabOnSuspend = false;
@@ -675,6 +708,7 @@ public class XDebugSessionImpl implements XDebugSession {
if (myBreakpointsDisabled) {
myBreakpointsDisabled = false;
new ReadAction() {
@Override
protected void run(final Result result) {
processAllBreakpoints(true, false);
}
@@ -682,6 +716,7 @@ public class XDebugSessionImpl implements XDebugSession {
}
}
@Override
public boolean isStopped() {
return myStopped;
}
@@ -707,6 +742,7 @@ public class XDebugSessionImpl implements XDebugSession {
return myDisabledSlaveBreakpoints.contains(breakpoint);
}
@Override
public void stop() {
ProcessHandler processHandler = myDebugProcess.getProcessHandler();
if (processHandler.isProcessTerminated() || processHandler.isProcessTerminating()) return;
@@ -741,16 +777,19 @@ public class XDebugSessionImpl implements XDebugSession {
}
private class MyBreakpointListener implements XBreakpointListener<XBreakpoint<?>> {
@Override
public void breakpointAdded(@NotNull final XBreakpoint<?> breakpoint) {
if (!myBreakpointsDisabled) {
processAllHandlers(breakpoint, true);
}
}
@Override
public void breakpointRemoved(@NotNull final XBreakpoint<?> breakpoint) {
processAllHandlers(breakpoint, false);
}
@Override
public void breakpointChanged(@NotNull final XBreakpoint<?> breakpoint) {
breakpointRemoved(breakpoint);
breakpointAdded(breakpoint);
@@ -758,6 +797,7 @@ public class XDebugSessionImpl implements XDebugSession {
}
private class MyDependentBreakpointListener implements XDependentBreakpointListener {
@Override
public void dependencySet(final XBreakpoint<?> slave, final XBreakpoint<?> master) {
boolean added = myDisabledSlaveBreakpoints.add(slave);
if (added) {
@@ -765,6 +805,7 @@ public class XDebugSessionImpl implements XDebugSession {
}
}
@Override
public void dependencyCleared(final XBreakpoint<?> breakpoint) {
boolean removed = myDisabledSlaveBreakpoints.remove(breakpoint);
if (removed) {