Conversation
| debugEvent.shouldResume = false; | ||
| // Have to send to events to keep the UI sync with the step in operations: | ||
| context.getProtocolServer().sendEvent(new Events.StoppedEvent("step", thread.uniqueID())); | ||
| context.getProtocolServer().sendEvent(new Events.ContinuedEvent(thread.uniqueID())); |
There was a problem hiding this comment.
why to send continued event to vscode
There was a problem hiding this comment.
After the stack operation (pop/stepin), the UI is out of sync with the underlying JVM debugger status. Thus, send continue event to update the VSCode UI to let the VSCode populate the threading information. The continue event will stop at the first line of the stepin method.
| private boolean canRestartFrame(IDebugAdapterContext context, StackFrameReference frameReference) { | ||
| ThreadReference reference = frameReference.getThread(); | ||
| StackFrame[] frames = context.getStackFrameManager().reloadStackFrames(reference); | ||
| // Current stack frame cannot be the top frame of the thread: |
There was a problem hiding this comment.
// Cannot restart top stack frame.
There was a problem hiding this comment.
top stack frame is misleading.
| StepRequest request = DebugUtility.createStepIntoRequest(thread, context.getStepFilters().classNameFilters); | ||
| context.getDebugSession().getEventHub().stepEvents().filter(debugEvent -> request.equals(debugEvent.event.request())).take(1).subscribe(debugEvent -> { | ||
| debugEvent.shouldResume = false; | ||
| // Have to send to events to keep the UI sync with the step in operations: |
There was a problem hiding this comment.
with the step in operations is a little confusing at the quick glance, how about changing it to with the latest stepIn status.
| } | ||
| } | ||
|
|
||
| private void stepin(IDebugAdapterContext context, ThreadReference thread) { |
|
|
||
| if (stackFrameReference == null) { | ||
| return AdapterUtils.createAsyncErrorResponse(response, ErrorCode.RESTARTFRAME_FAILURE, | ||
| String.format("RestartFarme: cannot find the stack frame with frameID %s", restartFrameArgs.frameId)); |
There was a problem hiding this comment.
typos RestartFarme -> RestartFrame
| } | ||
|
|
||
| private void popStackFrames(IDebugAdapterContext context, ThreadReference thread, int depth) throws DebugException { | ||
| while (depth >= 0) { |
There was a problem hiding this comment.
It seems all stack frames up to the specified depth can be popped by the one invoke. See the doc https://docs.oracle.com/javase/7/docs/jdk/api/jpda/jdi/
b01414b to
2d5556c
Compare
| ThreadReference reference = frameReference.getThread(); | ||
| StackFrame[] frames = context.getStackFrameManager().reloadStackFrames(reference); | ||
| // The frame cannot be the first one of the stack: | ||
| if (frames.length <= frameReference.getDepth() + 1) { |
There was a problem hiding this comment.
From the implementation, it looks the last one, not the first one.
There was a problem hiding this comment.
The callstack first one, not the top(last) after pop
@andxu @akaroml @testforstephen