Skip to content

Commit f63564d

Browse files
committed
Fix missing allThreadsContinued in handleDebuggerStep, skip sending continued event in certain cases
1 parent 850ed91 commit f63564d

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Common/src/main/kotlin/gay/object/hexdebug/adapter/DebugAdapter.kt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ class DebugAdapter(val player: ServerPlayer) : IDebugProtocolServer {
223223
threadId: Int,
224224
result: DebugStepResult,
225225
wasPaused: Boolean = true,
226+
sendContinuedEvent: Boolean = true,
226227
): ExecutionClientView? {
227228
val view = result.clientInfo?.also {
228229
MsgEvaluatorClientInfoS2C(threadId, it).sendToPlayer(player)
@@ -250,9 +251,12 @@ class DebugAdapter(val player: ServerPlayer) : IDebugProtocolServer {
250251
}
251252
} else if (wasPaused) {
252253
// running
253-
remoteProxy.continued(ContinuedEventArguments().also {
254-
it.threadId = threadId
255-
})
254+
if (sendContinuedEvent) {
255+
remoteProxy.continued(ContinuedEventArguments().also {
256+
it.threadId = threadId
257+
it.allThreadsContinued = false
258+
})
259+
}
256260

257261
closeEvaluator(threadId)
258262
}
@@ -287,11 +291,11 @@ class DebugAdapter(val player: ServerPlayer) : IDebugProtocolServer {
287291
}
288292
}
289293

290-
private fun resumeAllExcept(threadId: Int) {
294+
private fun resumeAllExcept(threadId: Int, sendContinuedEvent: Boolean = true) {
291295
for (index in allThreadIds) {
292296
if (index == threadId) continue
293297
inRangeDebugger(index)?.let {
294-
handleDebuggerStep(threadId, it.executeUntilStopped())
298+
handleDebuggerStep(threadId, it.executeUntilStopped(), sendContinuedEvent = sendContinuedEvent)
295299
}
296300
}
297301
}
@@ -390,11 +394,11 @@ class DebugAdapter(val player: ServerPlayer) : IDebugProtocolServer {
390394

391395
override fun continue_(args: ContinueArguments): CompletableFuture<ContinueResponse> {
392396
inRangeDebugger(args.threadId)?.let {
393-
handleDebuggerStep(args.threadId, it.executeUntilStopped())
397+
handleDebuggerStep(args.threadId, it.executeUntilStopped(), sendContinuedEvent = false)
394398
}
395399
val continueAllThreads = args.singleThread == false
396400
if (continueAllThreads) {
397-
resumeAllExcept(args.threadId)
401+
resumeAllExcept(args.threadId, sendContinuedEvent = false)
398402
}
399403
return ContinueResponse().apply {
400404
allThreadsContinued = continueAllThreads

0 commit comments

Comments
 (0)