step into should stop in a different invocation of the same method

This commit is contained in:
Egor.Ushakov
2015-06-08 13:22:10 +03:00
parent fb9afaee54
commit ce4128707f
@@ -48,6 +48,7 @@ public class RequestHint {
private final int myDepth;
private final SourcePosition myPosition;
private final int myFrameCount;
private boolean mySteppedOut = false;
@Nullable
private final MethodFilter myMethodFilter;
@@ -139,11 +140,14 @@ public class RequestHint {
return myMethodFilter instanceof BreakpointStepMethodFilter || myTargetMethodMatched;
}
private boolean isTheSameDepth(SuspendContextImpl context) {
private boolean isTheSameFrame(SuspendContextImpl context) {
if (mySteppedOut) return false;
final ThreadReferenceProxyImpl contextThread = context.getThread();
if (contextThread != null) {
try {
return myFrameCount == contextThread.frameCount();
int currentDepth = contextThread.frameCount();
if (currentDepth < myFrameCount) mySteppedOut = true;
return currentDepth == myFrameCount;
}
catch (EvaluateException ignored) {
}
@@ -170,7 +174,7 @@ public class RequestHint {
frameProxy != null &&
!(myMethodFilter instanceof BreakpointStepMethodFilter) &&
myMethodFilter.locationMatches(context.getDebugProcess(), frameProxy.location()) &&
!isTheSameDepth(context)
!isTheSameFrame(context)
) {
myTargetMethodMatched = true;
return STOP;
@@ -181,7 +185,7 @@ public class RequestHint {
public Integer compute() {
final SourcePosition locationPosition = ContextUtil.getSourcePosition(context);
if (locationPosition != null) {
if (myPosition.getFile().equals(locationPosition.getFile()) && isTheSameDepth(context)) {
if (myPosition.getFile().equals(locationPosition.getFile()) && isTheSameFrame(context) && !mySteppedOut) {
return isOnTheSameLine(locationPosition) ? myDepth : STOP;
}
}