From c84dac7d1edbdab5c75feae84e58571059645168 Mon Sep 17 00:00:00 2001 From: Alexey Merkulov Date: Thu, 26 Sep 2024 18:51:29 +0200 Subject: [PATCH] [debugger] Add listener to track the start of debugger stepping actions IJ-MR-145237 GitOrigin-RevId: dea3c2e4e005df9531867830284af76d45891579 --- .../debugger/engine/DebugProcessImpl.java | 7 +++++++ .../intellij/debugger/engine/SteppingListener.kt | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 java/debugger/impl/src/com/intellij/debugger/engine/SteppingListener.kt 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 07f98ec8c8db..0b983cbb895f 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java @@ -2162,6 +2162,13 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb (context.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD || isResumeOnlyCurrentThread())) { myThreadBlockedMonitor.startWatching(myContextThread); } + + if (context != null) { + ApplicationManager.getApplication().getMessageBus().syncPublisher(SteppingListener.TOPIC) + .beforeSteppingStarted(context, getSteppingAction()); + } + + if (context != null && isResumeOnlyCurrentThread() && context.getSuspendPolicy() == EventRequest.SUSPEND_ALL diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/SteppingListener.kt b/java/debugger/impl/src/com/intellij/debugger/engine/SteppingListener.kt new file mode 100644 index 000000000000..ec77ebd801d6 --- /dev/null +++ b/java/debugger/impl/src/com/intellij/debugger/engine/SteppingListener.kt @@ -0,0 +1,16 @@ +// 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.engine + +import com.intellij.util.messages.Topic +import org.jetbrains.annotations.ApiStatus + +@ApiStatus.Internal +interface SteppingListener { + companion object { + @Topic.AppLevel + @JvmField + val TOPIC: Topic = Topic(SteppingListener::class.java, Topic.BroadcastDirection.NONE) + } + + fun beforeSteppingStarted(suspendContext: SuspendContextImpl, steppingAction: SteppingAction) { } +}