Remember a forced step into at its call stack (IDEADEV-39365)

This commit is contained in:
Eugene Zhuravlev
2009-09-17 17:39:45 +04:00
parent 1532f28ec0
commit cac8614b48
3 changed files with 43 additions and 7 deletions
@@ -48,12 +48,12 @@ public class SmartStepIntoActionHandler extends DebuggerActionHandler {
final List<PsiMethod> methods = findReferencedMethods(position);
if (methods.size() > 0) {
if (methods.size() == 1) {
session.stepInto(false, createSmartStepFilter(methods.get(0)));
session.stepInto(true, createSmartStepFilter(methods.get(0)));
}
else {
final PsiMethodListPopupStep popupStep = new PsiMethodListPopupStep(methods, new PsiMethodListPopupStep.OnChooseRunnable() {
public void execute(PsiMethod chosenMethod) {
session.stepInto(false, createSmartStepFilter(chosenMethod));
session.stepInto(true, createSmartStepFilter(chosenMethod));
}
});
final ListPopup popup = JBPopupFactory.getInstance().createListPopup(popupStep);
@@ -63,7 +63,7 @@ public class SmartStepIntoActionHandler extends DebuggerActionHandler {
return;
}
}
session.stepInto(false, null);
session.stepInto(true, null);
}
@Nullable
@@ -1354,6 +1354,7 @@ public abstract class DebugProcessImpl implements DebugProcess {
final SuspendContextImpl suspendContext = getSuspendContext();
final ThreadReferenceProxyImpl thread = suspendContext.getThread();
RequestHint hint = new RequestHint(thread, suspendContext, StepRequest.STEP_OUT);
hint.setIgnoreFilters(mySession.shouldIgnoreSteppingFilters());
if (myReturnValueWatcher != null) {
myReturnValueWatcher.setTrackingEnabled(true);
}
@@ -1363,12 +1364,12 @@ public abstract class DebugProcessImpl implements DebugProcess {
}
private class StepIntoCommand extends ResumeCommand {
private final boolean myIgnoreFilters;
private final boolean myForcedIgnoreFilters;
private final RequestHint.SmartStepFilter mySmartStepFilter;
public StepIntoCommand(SuspendContextImpl suspendContext, boolean ignoreFilters, final @Nullable RequestHint.SmartStepFilter smartStepFilter) {
super(suspendContext);
myIgnoreFilters = ignoreFilters || smartStepFilter != null;
myForcedIgnoreFilters = ignoreFilters || smartStepFilter != null;
mySmartStepFilter = smartStepFilter;
}
@@ -1379,7 +1380,15 @@ public abstract class DebugProcessImpl implements DebugProcess {
final RequestHint hint = mySmartStepFilter != null?
new RequestHint(stepThread, suspendContext, mySmartStepFilter) :
new RequestHint(stepThread, suspendContext, StepRequest.STEP_INTO);
hint.setIgnoreFilters(myIgnoreFilters);
if (myForcedIgnoreFilters) {
try {
mySession.setIgnoreStepFiltersFlag(stepThread.frameCount());
}
catch (EvaluateException e) {
LOG.info(e);
}
}
hint.setIgnoreFilters(myForcedIgnoreFilters || mySession.shouldIgnoreSteppingFilters());
doStep(suspendContext, stepThread, StepRequest.STEP_INTO, hint);
super.contextAction();
}
@@ -1402,7 +1411,7 @@ public abstract class DebugProcessImpl implements DebugProcess {
// from which the java code was generated
RequestHint hint = new RequestHint(steppingThread, suspendContext, StepRequest.STEP_OVER);
hint.setRestoreBreakpoints(myIsIgnoreBreakpoints);
hint.setIgnoreFilters(myIsIgnoreBreakpoints);
hint.setIgnoreFilters(myIsIgnoreBreakpoints || mySession.shouldIgnoreSteppingFilters());
if (myReturnValueWatcher != null) {
myReturnValueWatcher.setTrackingEnabled(true);
@@ -74,6 +74,7 @@ public class DebuggerSession implements AbstractDebuggerSession {
public static final int EVENT_REFRESH_VIEWS_ONLY = 11;
private volatile boolean myIsEvaluating;
private volatile int myIgnoreFiltersFrameCountThreshold = 0;
private DebuggerSessionState myState = null;
@@ -252,10 +253,23 @@ public class DebuggerSession implements AbstractDebuggerSession {
final SuspendContextImpl suspendContext = getSuspendContext();
if(suspendContext != null) {
mySteppingThroughThreads.remove(suspendContext.getThread());
resetIgnoreStepFiltersFlag();
resumeAction(myDebugProcess.createResumeCommand(suspendContext), EVENT_RESUME);
}
}
private void resetIgnoreStepFiltersFlag() {
myIgnoreFiltersFrameCountThreshold = 0;
}
public void setIgnoreStepFiltersFlag(int currentStackFrameCount) {
myIgnoreFiltersFrameCountThreshold = currentStackFrameCount;
}
public boolean shouldIgnoreSteppingFilters() {
return myIgnoreFiltersFrameCountThreshold > 0;
}
public void pause() {
myDebugProcess.getManagerThread().schedule(myDebugProcess.createPauseCommand());
}
@@ -415,6 +429,19 @@ public class DebuggerSession implements AbstractDebuggerSession {
positionContext = suspendContext;
}
if (currentThread != null) {
try {
final int frameCount = currentThread.frameCount();
if (frameCount == 0 || (frameCount < myIgnoreFiltersFrameCountThreshold)) {
resetIgnoreStepFiltersFlag();
}
}
catch (EvaluateException e) {
LOG.info(e);
resetIgnoreStepFiltersFlag();
}
}
SourcePosition position = PsiDocumentManager.getInstance(getProject()).commitAndRunReadAction(new Computable<SourcePosition>() {
public @Nullable SourcePosition compute() {
return ContextUtil.getSourcePosition(positionContext);