Skip to content

Commit d76e282

Browse files
committed
* Fix bugs for attaching.
1 parent 5c879de commit d76e282

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

adapter/src/main/kotlin/org/javacs/ktda/adapter/KotlinDebugAdapter.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,18 +182,19 @@ class KotlinDebugAdapter(
182182
}
183183

184184
override fun attach(args: Map<String, Any>) = async.execute {
185-
performInitialization()
185+
// Fix a deadlock problem by commenting the following line.
186+
//performInitialization()
186187

187188
val projectRoot = (args["projectRoot"] as? String)?.let { Paths.get(it) }
188189
?: throw missingRequestArgument("launch", "projectRoot")
189190

190191
val hostName = (args["hostName"] as? String)
191192
?: throw missingRequestArgument("attach", "hostName")
192193

193-
val port = (args["port"] as? Int)
194+
val port = (args["port"] as? Double)?.toInt()
194195
?: throw missingRequestArgument("attach", "port")
195196

196-
val timeout = (args["timeout"] as? Int)
197+
val timeout = (args["timeout"] as? Double)?.toInt()
197198
?: throw missingRequestArgument("attach", "timeout")
198199

199200
setupCommonInitializationParams(args)

adapter/src/main/kotlin/org/javacs/ktda/jdi/launch/JDILauncher.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class JDILauncher(
7070
}
7171

7272
private fun createAttachConnector(): AttachingConnector = vmManager.attachingConnectors()
73-
.firstOrNull()
73+
.first { it.name().equals("com.sun.jdi.SocketAttach") }
7474
?: throw KotlinDAException("Could not find an attaching connector (for a new debuggee VM)")
7575

7676
private fun createLaunchConnector(): LaunchingConnector = vmManager.launchingConnectors()

0 commit comments

Comments
 (0)