From 1f3efaee500e82828d3aca06fc56a295bdeee6d7 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Fri, 24 May 2013 18:07:25 +0200 Subject: [PATCH] init WEB-7884 Node.js: breakpoints are not hit, exception on stop debugging (regression) --- .../intellij/openapi/util/AsyncResult.java | 1 + .../xdebugger/impl/XDebugSessionImpl.java | 41 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/platform/platform-api/src/com/intellij/openapi/util/AsyncResult.java b/platform/platform-api/src/com/intellij/openapi/util/AsyncResult.java index 2df99a518cfb..f516121f56b8 100644 --- a/platform/platform-api/src/com/intellij/openapi/util/AsyncResult.java +++ b/platform/platform-api/src/com/intellij/openapi/util/AsyncResult.java @@ -105,6 +105,7 @@ public class AsyncResult extends ActionCallback { return this; } + @Override @NotNull public final AsyncResult notify(@NotNull final ActionCallback child) { super.notify(child); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java index 4928340ff8a1..65979b5d7b6d 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java @@ -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 void smartStepInto(XSmartStepIntoHandler 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> { + @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) {