diff --git a/java/debugger/backend/src/com/intellij/java/debugger/impl/backend/BackendJavaDebuggerSessionApi.kt b/java/debugger/backend/src/com/intellij/java/debugger/impl/backend/BackendJavaDebuggerSessionApi.kt index e88c54b4e19d..54678f173a4d 100644 --- a/java/debugger/backend/src/com/intellij/java/debugger/impl/backend/BackendJavaDebuggerSessionApi.kt +++ b/java/debugger/backend/src/com/intellij/java/debugger/impl/backend/BackendJavaDebuggerSessionApi.kt @@ -23,7 +23,7 @@ import kotlinx.coroutines.launch internal class BackendJavaDebuggerSessionApi : JavaDebuggerSessionApi { @OptIn(ExperimentalCoroutinesApi::class) - override suspend fun dumpThreads(sessionId: XDebugSessionId, maxItems: Int): JavaThreadDumpResponseDto? { + override suspend fun dumpThreads(sessionId: XDebugSessionId, maxItems: Int, onlyPlatformThreads: Boolean): JavaThreadDumpResponseDto? { val xSession = sessionId.findValue() ?: return null val javaDebugProcess = xSession.debugProcess as JavaDebugProcess @@ -36,7 +36,7 @@ internal class BackendJavaDebuggerSessionApi : JavaDebuggerSessionApi { executeOnDMT(context.managerThread!!) { // Pass parts of the dump to the ThreadDumpPanel via a channel as soon as they are computed val dumpItemsChannel = produce(capacity = Channel.BUFFERED) { - ThreadDumpAction.buildThreadDump(context, channel) + ThreadDumpAction.buildThreadDump(context, onlyPlatformThreads, channel) } val dtosChannel = Channel(capacity = Channel.BUFFERED) launch(Dispatchers.Default) { diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/ThreadDumpAction.kt b/java/debugger/impl/src/com/intellij/debugger/actions/ThreadDumpAction.kt index 809c77f409cb..f324923b5453 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/ThreadDumpAction.kt +++ b/java/debugger/impl/src/com/intellij/debugger/actions/ThreadDumpAction.kt @@ -52,14 +52,14 @@ class ThreadDumpAction { } @ApiStatus.Internal - suspend fun buildThreadDump(context: DebuggerContextImpl, dumpItemsChannel: SendChannel>) { + suspend fun buildThreadDump(context: DebuggerContextImpl, onlyPlatformThreads: Boolean, dumpItemsChannel: SendChannel>) { suspend fun fallback() = dumpItemsChannel.send( buildJavaPlatformThreadDump(context).toDumpItems() ) - if (!Registry.`is`("debugger.thread.dump.extended")) { + if (onlyPlatformThreads || !Registry.`is`("debugger.thread.dump.extended")) { fallback() return } diff --git a/java/debugger/shared/src/com/intellij/java/debugger/impl/shared/actions/ThreadDumpAction.kt b/java/debugger/shared/src/com/intellij/java/debugger/impl/shared/actions/ThreadDumpAction.kt index ff0228ab53c4..0d51ecd3fd0f 100644 --- a/java/debugger/shared/src/com/intellij/java/debugger/impl/shared/actions/ThreadDumpAction.kt +++ b/java/debugger/shared/src/com/intellij/java/debugger/impl/shared/actions/ThreadDumpAction.kt @@ -21,6 +21,7 @@ import com.intellij.openapi.util.NlsSafe import com.intellij.openapi.util.registry.Registry import com.intellij.ui.SimpleTextAttributes import com.intellij.unscramble.DumpItem +import com.intellij.util.BitUtil import com.intellij.xdebugger.impl.frame.XDebugSessionProxy import com.intellij.xdebugger.impl.rpc.toSimpleTextAttributes import com.intellij.xdebugger.impl.ui.DebuggerUIUtil @@ -30,12 +31,15 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.ReceiveChannel import kotlinx.coroutines.launch import kotlinx.coroutines.withContext +import java.awt.event.InputEvent import javax.swing.Icon private class ThreadDumpAction : DumbAwareAction(), ActionRemoteBehaviorSpecification.FrontendOtherwiseBackend { @OptIn(ExperimentalCoroutinesApi::class) override fun actionPerformed(e: AnActionEvent) { + val onlyPlatformThreads = BitUtil.isSet(e.modifiers, InputEvent.ALT_MASK) + val project = e.project if (project == null) { return @@ -44,7 +48,7 @@ private class ThreadDumpAction : DumbAwareAction(), ActionRemoteBehaviorSpecific sessionProxy.coroutineScope.launch { val dtosWillBeSerialized = FrontendApplicationInfo.getFrontendType() !is FrontendType.Monolith val maxItems = if (dtosWillBeSerialized) Registry.intValue("debugger.thread.dump.max.items.frontend") else Int.MAX_VALUE - val (threadDumpsDtoChannel, filters) = JavaDebuggerSessionApi.getInstance().dumpThreads(sessionProxy.id, maxItems) ?: return@launch + val (threadDumpsDtoChannel, filters) = JavaDebuggerSessionApi.getInstance().dumpThreads(sessionProxy.id, maxItems, onlyPlatformThreads) ?: return@launch val threadDumpsChannel = threadDumpsDtoChannel.map(::threadDumpData) withContext(Dispatchers.EDT) { diff --git a/java/debugger/shared/src/com/intellij/java/debugger/impl/shared/rpc/JavaDebuggerSessionApi.kt b/java/debugger/shared/src/com/intellij/java/debugger/impl/shared/rpc/JavaDebuggerSessionApi.kt index 70fab7578a4d..c2be8216b9db 100644 --- a/java/debugger/shared/src/com/intellij/java/debugger/impl/shared/rpc/JavaDebuggerSessionApi.kt +++ b/java/debugger/shared/src/com/intellij/java/debugger/impl/shared/rpc/JavaDebuggerSessionApi.kt @@ -20,7 +20,7 @@ import org.jetbrains.annotations.ApiStatus @Rpc interface JavaDebuggerSessionApi : RemoteApi { - suspend fun dumpThreads(sessionId: XDebugSessionId, maxItems: Int = Int.MAX_VALUE): JavaThreadDumpResponseDto? + suspend fun dumpThreads(sessionId: XDebugSessionId, maxItems: Int = Int.MAX_VALUE, onlyPlatformThreads: Boolean): JavaThreadDumpResponseDto? companion object { @JvmStatic