Commit ab40a9ed authored by Konstantin Ulitin's avatar Konstantin Ulitin
Browse files

JS debugger: empty thread name sometimes appeared on debugging several VMs

(cherry picked from commit 62f4542c)
parent 718f6a53
Branches unavailable Tags unavailable
No related merge requests found
Showing with 11 additions and 20 deletions
+11 -20
......@@ -46,8 +46,8 @@ interface Vm : UserDataHolderEx {
var captureAsyncStackTraces: Boolean
val name: String?
get() = null
val presentableName: String
get() = "main loop"
val children: MutableList<Vm>
val childVMs: MutableList<Vm>
}
\ No newline at end of file
......@@ -29,5 +29,5 @@ abstract class VmBase(override val debugListener: DebugEventListener) : Vm, Atta
get() = false
set(value) { }
override val children: MutableList<Vm> = ContainerUtil.createConcurrentList()
override val childVMs: MutableList<Vm> = ContainerUtil.createConcurrentList()
}
\ No newline at end of file
......@@ -47,7 +47,7 @@ interface MultiVmDebugProcess {
val result = mutableListOf<Vm>()
fun addRecursively(vm: Vm) {
result.add(vm)
vm.children.forEach { addRecursively(it) }
vm.childVMs.forEach { addRecursively(it) }
}
addRecursively(mainVm)
return result
......@@ -263,10 +263,10 @@ abstract class DebugProcessImpl<C : VmConnection<*>>(session: XDebugSession,
}
protected fun addChildVm(vm: Vm, childConnection: RemoteVmConnection) {
mainVm?.children?.add(vm)
mainVm?.childVMs?.add(vm)
childConnection.stateChanged {
if (it.status == ConnectionStatus.CONNECTION_FAILED || it.status == ConnectionStatus.DISCONNECTED || it.status == ConnectionStatus.DETACHED) {
mainVm?.children?.remove(vm)
mainVm?.childVMs?.remove(vm)
}
}
......
......@@ -42,30 +42,21 @@ const val MAIN_LOOP_NAME = "main loop"
* select them firstly.
*/
abstract class SuspendContextView(protected val debugProcess: MultiVmDebugProcess, protected val activeStack: ExecutionStackView) : XSuspendContext() {
protected open val stacks: Array<out XExecutionStack> by lazy {
protected open val stacks: Array<out XExecutionStack> by lazy {
val mainVm = debugProcess.mainVm
val vmList = debugProcess.collectVMs
if (mainVm != null && !vmList.isEmpty()) {
val list = ArrayList<XExecutionStack>()
if (activeStack.suspendContext.vm == mainVm) {
list.add(activeStack)
}
else {
list.add(createStackView(mainVm.suspendContextManager.context, MAIN_LOOP_NAME))
}
// main vm should go first
vmList.mapNotNullTo(list) {
val context = it.suspendContextManager.context
if (it == mainVm) {
null
}
else if (context == activeStack.suspendContext) {
if (context == activeStack.suspendContext) {
activeStack
}
else {
val displayName = it.name ?: throw IllegalStateException("Name must be not null for child VM")
createStackView(context, displayName)
createStackView(context, it.presentableName)
}
}
list.toTypedArray()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment