Skip to content

Commit

Permalink
Fix step-over behaviour for init methods
Browse files Browse the repository at this point in the history
  • Loading branch information
NipunaRanasinghe committed Nov 12, 2024
1 parent a2173fd commit d7a7723
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ void activateDynamicBreakPoints(int threadId, DynamicBreakpointMode mode, boolea
Location currentLocation = validFrames.get(0).getJStackFrame().location();
Optional<Location> prevLocation = context.getPrevLocation();
if (!validate || prevLocation.isEmpty() || !isWithinSameSource(currentLocation, prevLocation.get())) {
doActivateDynamicBreakPoints(currentLocation);
context.getEventManager().deleteAllBreakpoints();
configureBreakpointsForMethod(currentLocation);
context.setPrevLocation(currentLocation);
}
context.setPrevLocation(currentLocation);
}
Expand All @@ -243,7 +245,11 @@ void activateDynamicBreakPoints(int threadId, DynamicBreakpointMode mode, boolea
// temporary breakpoint on the location of its invocation. This is supposed to handle the situations where
// the user wants to step over on an exit point of the current function.
if (mode == DynamicBreakpointMode.CALLER && validFrames.size() > 1) {
doActivateDynamicBreakPoints(validFrames.get(1).getJStackFrame().location());
context.getEventManager().deleteAllBreakpoints();
for (int frameIndex = 1; frameIndex < validFrames.size(); frameIndex++) {
configureBreakpointsForMethod(validFrames.get(frameIndex).getJStackFrame().location());
}
context.setPrevLocation(validFrames.get(0).getJStackFrame().location());
}
} catch (JdiProxyException e) {
LOGGER.error(e.getMessage());
Expand All @@ -254,12 +260,6 @@ void activateDynamicBreakPoints(int threadId, DynamicBreakpointMode mode, boolea
}
}

private void doActivateDynamicBreakPoints(Location location) {
context.getEventManager().deleteAllBreakpoints();
configureBreakpointsForMethod(location);
context.setPrevLocation(location);
}

/**
* Checks whether the given two locations are within the same source file.
*
Expand Down

0 comments on commit d7a7723

Please sign in to comment.