mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[debugger] alt+click to dump only platform threads, IDEA-370962
^IDEA-370962 fixed GitOrigin-RevId: 6367c684f344dc2b840669ca19ad5b5975c60cc4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b9a8861233
commit
28fdadd2b6
+2
-2
@@ -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<JavaThreadDumpDto>(capacity = Channel.BUFFERED)
|
||||
launch(Dispatchers.Default) {
|
||||
|
||||
@@ -52,14 +52,14 @@ class ThreadDumpAction {
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
suspend fun buildThreadDump(context: DebuggerContextImpl, dumpItemsChannel: SendChannel<List<MergeableDumpItem>>) {
|
||||
suspend fun buildThreadDump(context: DebuggerContextImpl, onlyPlatformThreads: Boolean, dumpItemsChannel: SendChannel<List<MergeableDumpItem>>) {
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
+5
-1
@@ -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) {
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.ApiStatus
|
||||
@Rpc
|
||||
interface JavaDebuggerSessionApi : RemoteApi<Unit> {
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user