mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
init debug NodeJs child processes as threads
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
package com.intellij.util.net
|
||||
|
||||
import java.net.InetAddress
|
||||
import java.net.InetSocketAddress
|
||||
|
||||
@JvmOverloads
|
||||
fun loopbackSocketAddress(port: Int = -1) = InetSocketAddress(InetAddress.getLoopbackAddress(), if (port == -1) NetUtils.findAvailableSocketPort() else port)
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.util.net
|
||||
|
||||
import java.net.InetAddress
|
||||
import java.net.InetSocketAddress
|
||||
|
||||
@JvmOverloads
|
||||
fun loopbackSocketAddress(port: Int = -1) = InetSocketAddress(InetAddress.getLoopbackAddress(), if (port == -1) NetUtils.findAvailableSocketPort() else port)
|
||||
+30
-3
@@ -24,7 +24,9 @@ import com.intellij.util.io.socketConnection.ConnectionStatus
|
||||
import com.intellij.xdebugger.DefaultDebugProcessHandler
|
||||
import com.intellij.xdebugger.XDebugProcess
|
||||
import com.intellij.xdebugger.XDebugSession
|
||||
import com.intellij.xdebugger.breakpoints.*
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointHandler
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointType
|
||||
import com.intellij.xdebugger.breakpoints.XLineBreakpoint
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider
|
||||
import com.intellij.xdebugger.stepping.XSmartStepIntoHandler
|
||||
import org.jetbrains.concurrency.Promise
|
||||
@@ -47,6 +49,9 @@ abstract class DebugProcessImpl<C : VmConnection<*>>(session: XDebugSession,
|
||||
|
||||
var processBreakpointConditionsAtIdeSide: Boolean = false
|
||||
|
||||
private val connectedListenerAdded = AtomicBoolean()
|
||||
private val breakpointsInitiated = AtomicBoolean()
|
||||
|
||||
private val _breakpointHandlers: Array<XBreakpointHandler<*>> by lazy(LazyThreadSafetyMode.NONE) { createBreakpointHandlers() }
|
||||
|
||||
init {
|
||||
@@ -174,10 +179,32 @@ abstract class DebugProcessImpl<C : VmConnection<*>>(session: XDebugSession,
|
||||
open fun getLocationsForBreakpoint(breakpoint: XLineBreakpoint<*>): List<Location> = throw UnsupportedOperationException()
|
||||
|
||||
override fun isLibraryFrameFilterSupported() = true
|
||||
|
||||
// todo make final (go plugin compatibility)
|
||||
override fun checkCanInitBreakpoints(): Boolean {
|
||||
if (connection.state.status == ConnectionStatus.CONNECTED) {
|
||||
// breakpointsInitiated could be set in another thread and at this point work (init breakpoints) could be not yet performed
|
||||
return setBreakpoints(false)
|
||||
}
|
||||
|
||||
if (connectedListenerAdded.compareAndSet(false, true)) {
|
||||
connection.stateChanged {
|
||||
if (it.status == ConnectionStatus.CONNECTED) {
|
||||
setBreakpoints(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
open protected fun setBreakpoints(setBreakpoints: Boolean): Boolean {
|
||||
return breakpointsInitiated.compareAndSet(false, true)
|
||||
}
|
||||
}
|
||||
|
||||
class LineBreakpointHandler(breakpointTypeClass: Class<out XLineBreakpointType<*>>, private val manager: LineBreakpointManager)
|
||||
: XBreakpointHandler<XLineBreakpoint<*>>(breakpointTypeClass as Class<out XBreakpointType<XLineBreakpoint<*>, out XBreakpointProperties<*>>>) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
class LineBreakpointHandler(breakpointTypeClass: Class<out XBreakpointType<out XLineBreakpoint<*>, *>>, private val manager: LineBreakpointManager)
|
||||
: XBreakpointHandler<XLineBreakpoint<*>>(breakpointTypeClass as Class<out XBreakpointType<XLineBreakpoint<*>, *>>) {
|
||||
override fun registerBreakpoint(breakpoint: XLineBreakpoint<*>) {
|
||||
manager.setBreakpoint(breakpoint)
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,7 +43,7 @@ abstract class LineBreakpointManager(private val debugProcess: DebugProcessImpl<
|
||||
private val breakpointResolvedListenerAdded = AtomicBoolean()
|
||||
|
||||
fun setBreakpoint(breakpoint: XLineBreakpoint<*>) {
|
||||
var target = synchronized (lock) { ideToVmBreakpoints[breakpoint] }
|
||||
val target = synchronized (lock) { ideToVmBreakpoints[breakpoint] }
|
||||
if (target == null) {
|
||||
setBreakpoint(breakpoint, debugProcess.getLocationsForBreakpoint(breakpoint))
|
||||
}
|
||||
|
||||
@@ -548,6 +548,7 @@ js.debugger.name.mappings.by.source.code=false
|
||||
js.debugger.v8.log=
|
||||
js.debugger.wip.log=
|
||||
js.debugger.member.filter.prefer.vm.source=false
|
||||
js.debugger.slave.node.as.thread=false
|
||||
|
||||
js.index.node.submodules=false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user