[debugger] Thread Dump fixes

* better handle errors in case of dumping on the breakpoint

(cherry picked from commit bcae96acbdfea3f6a6046683edd57724e41fda92)

IJ-CR-167309

GitOrigin-RevId: 2438988f7ebedf23b0f8620b79bfddaa7b5b5ccf
This commit is contained in:
Vladimir Parfinenko
2025-06-26 22:43:44 +02:00
committed by intellij-monorepo-bot
parent b5af4845b0
commit e52eacf97e

View File

@@ -40,15 +40,15 @@ internal suspend fun <R> suspendAllAndEvaluate(
tryToBreakOnAnyMethodAndEvaluate(context, process, null, timeToSuspend, action)
} else {
// We are on a Suspend All breakpoint, we can evaluate right here.
val result = Channel<R>(capacity = 1)
val result = CompletableDeferred<R>()
// We have to evaluate inside SuspendContextCommandImpl, so we just start a new command.
// TODO: are there any better ways to do this? Should we create proper command above?
executeOnDMT(suspendContext) {
result.send(action(suspendContext))
result.completeWith(runCatching { action(suspendContext) })
}
result.receive()
result.await()
}
}
else {