Skip to content

Commit 39045e6

Browse files
committed
Add more log statements and fix debuggee listener issue
1 parent aa41530 commit 39045e6

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ class KotlinDebugAdapter(
100100
config,
101101
context
102102
).also(::setupDebuggeeListeners)
103+
LOG.trace("Instantiated debuggee")
103104
}
104105

105106
private fun missingRequestArgument(requestName: String, argumentName: String) =
@@ -133,12 +134,13 @@ class KotlinDebugAdapter(
133134
eventBus.exceptionListeners.add {
134135
sendStopEvent(it.threadID, StoppedEventArgumentsReason.EXCEPTION)
135136
}
136-
stdoutAsync.run {
137+
stdoutAsync.execute {
137138
debuggee.stdout?.let { pipeStreamToOutput(it, OutputEventArgumentsCategory.STDOUT) }
138139
}
139-
stderrAsync.run {
140+
stderrAsync.execute {
140141
debuggee.stderr?.let { pipeStreamToOutput(it, OutputEventArgumentsCategory.STDERR) }
141142
}
143+
LOG.trace("Configured debuggee listeners")
142144
}
143145

144146
private fun pipeStreamToOutput(stream: InputStream, outputCategory: String) {

adapter/src/main/kotlin/org/javacs/ktda/jdi/JDIDebuggee.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ class JDIDebuggee(
4646
stdout = process?.inputStream
4747
stderr = process?.errorStream
4848

49+
LOG.trace("Updating threads")
4950
updateThreads()
51+
52+
LOG.trace("Updating breakpoints")
5053
hookBreakpoints()
5154
}
5255

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,14 @@ class JDILauncher(
3333
override fun launch(config: LaunchConfiguration, context: DebugContext): JDIDebuggee {
3434
val connector = createLaunchConnector()
3535
LOG.info("Starting JVM debug session with main class {}", config.mainClass)
36-
return JDIDebuggee(
37-
connector.launch(createLaunchArgs(config, connector)) ?: throw KotlinDAException("Could not launch a new VM"),
38-
sourcesRootsOf(config.projectRoot),
39-
context
40-
)
36+
37+
LOG.debug("Launching VM")
38+
val vm = connector.launch(createLaunchArgs(config, connector)) ?: throw KotlinDAException("Could not launch a new VM")
39+
40+
LOG.debug("Finding sourcesRoots")
41+
val sourcesRoots = sourcesRootsOf(config.projectRoot)
42+
43+
return JDIDebuggee(vm, sourcesRoots, context)
4144
}
4245

4346
override fun attach(config: AttachConfiguration, context: DebugContext): JDIDebuggee {

0 commit comments

Comments
 (0)