diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/StepOverInstructionAction.kt b/java/debugger/impl/src/com/intellij/debugger/actions/StepOverInstructionAction.kt new file mode 100644 index 000000000000..ee7f7521776d --- /dev/null +++ b/java/debugger/impl/src/com/intellij/debugger/actions/StepOverInstructionAction.kt @@ -0,0 +1,24 @@ +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +package com.intellij.debugger.actions + +import com.intellij.debugger.DebuggerManagerEx +import com.intellij.openapi.actionSystem.ActionUpdateThread +import com.intellij.openapi.actionSystem.AnActionEvent +import com.intellij.openapi.diagnostic.thisLogger +import com.intellij.openapi.project.DumbAware + +class StepOverInstructionAction : DebuggerAction(), DumbAware { + override fun actionPerformed(e: AnActionEvent) { + debuggerSession(e)?.stepOverInstruction() ?: thisLogger().error("Inconsistent update") + } + + override fun update(e: AnActionEvent) { + e.presentation.isEnabledAndVisible = debuggerSession(e) != null + } + + override fun getActionUpdateThread() = ActionUpdateThread.BGT + + private fun debuggerSession(e: AnActionEvent) = + e.project?.let { DebuggerManagerEx.getInstanceEx(it).context.debuggerSession } +} + diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java index 11113f7a98f5..938377cfa74f 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java @@ -1820,7 +1820,7 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb } @Override - @NotNull + @Nullable public RequestHint getHint(SuspendContextImpl suspendContext, ThreadReferenceProxyImpl stepThread, @Nullable RequestHint parentHint) { // need this hint while stepping over for JSR45 support: // several lines of generated java code may correspond to a single line in the source file, diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java index 61211baa9124..958205daeb92 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java @@ -346,6 +346,20 @@ public final class DebuggerSession implements AbstractDebuggerSession { stepInto(ignoreFilters, smartStepFilter, StepRequest.STEP_LINE); } + public void stepOverInstruction() { + SuspendContextImpl suspendContext = getSuspendContext(); + DebugProcessImpl.ResumeCommand cmd = myDebugProcess.new StepOverCommand(suspendContext, false, null, StepRequest.STEP_MIN) { + @Override + public @Nullable RequestHint getHint(SuspendContextImpl suspendContext, + ThreadReferenceProxyImpl stepThread, + @Nullable RequestHint parentHint) { + return null; + } + }; + setSteppingThrough(cmd.getContextThread()); + resumeAction(cmd, Event.STEP); + } + public void runToCursor(@NotNull XSourcePosition position, final boolean ignoreBreakpoints) { try { SuspendContextImpl suspendContext = getSuspendContext(); diff --git a/platform/platform-resources-en/src/messages/ActionsBundle.properties b/platform/platform-resources-en/src/messages/ActionsBundle.properties index 3f6c50ceb7a7..57cd0376459f 100644 --- a/platform/platform-resources-en/src/messages/ActionsBundle.properties +++ b/platform/platform-resources-en/src/messages/ActionsBundle.properties @@ -909,6 +909,8 @@ action.StepOver.text=Step _Over action.StepOver.description=Step to the next line in this file action.StepInto.text=Step _Into action.StepInto.description=Step to the next line executed +action.StepOverInstruction.text=Step Over Instruction +action.StepOverInstruction.description=Perform stop into on instruction level action.SmartStepInto.text=Smart Ste_p Into action.SmartStepInto.description=Step into the particular method action.StepOut.text=Step Ou_t diff --git a/resources/src/idea/JavaActions.xml b/resources/src/idea/JavaActions.xml index e0fb57887363..f3265bf50123 100644 --- a/resources/src/idea/JavaActions.xml +++ b/resources/src/idea/JavaActions.xml @@ -410,6 +410,10 @@ + + + +