Skip to content

Commit 4268081

Browse files
committed
* Fix the threads update bug.
* Move the resumeVm and updateThreads methods into the Debuggee interface.
1 parent 58d817d commit 4268081

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ class KotlinDebugAdapter(
271271
exceptionsPool.clear()
272272
converter.variablesPool.clear()
273273
converter.stackFramePool.removeAllOwnedBy(args.threadId)
274-
(debuggee as JDIDebuggee).resumeVm()
274+
// See the issue: https://github.com/fwcd/kotlin-debug-adapter/pull/40
275+
debuggee?.resumeVm()
275276
}
276277
ContinueResponse().apply {
277278
allThreadsContinued = false
@@ -354,6 +355,7 @@ class KotlinDebugAdapter(
354355
override fun source(args: SourceArguments): CompletableFuture<SourceResponse> = notImplementedDAPMethod()
355356

356357
override fun threads() = async.compute { onceDebuggeeIsPresent { debuggee ->
358+
debuggee.updateThreads()
357359
ThreadsResponse().apply {
358360
threads = debuggee.threads
359361
.asSequence()

adapter/src/main/kotlin/org/javacs/ktda/core/Debuggee.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ interface Debuggee {
1717
get() = null
1818

1919
fun exit()
20-
20+
21+
fun resumeVm()
22+
23+
fun updateThreads()
24+
2125
fun threadByID(id: Long): DebuggeeThread? = threads
2226
.asSequence()
2327
.filter { it.id == id }

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class JDIDebuggee(
5454
hookBreakpoints()
5555
}
5656

57-
private fun updateThreads() = threads.setAll(vm.allThreads().map { JDIThread(it, this) })
57+
override fun updateThreads() = threads.setAll(vm.allThreads().map { JDIThread(it, this) })
5858

5959
private fun hookBreakpoints() {
6060
context.breakpointManager.also { manager ->
@@ -134,7 +134,7 @@ class JDIDebuggee(
134134
}
135135
}
136136

137-
fun resumeVm() {
137+
override fun resumeVm() {
138138
vm.resume()
139139
}
140140

0 commit comments

Comments
 (0)