@@ -80,7 +80,7 @@ internal object DebugProbesImpl {
80
80
check(isInstalled) { " Debug probes are not installed" }
81
81
val jobToStack = capturedCoroutines
82
82
.filter { it.delegate.context[Job ] != null }
83
- .associateBy({ it.delegate.context[Job ]!! }, {it.info})
83
+ .associateBy({ it.delegate.context[Job ]!! }, { it.info })
84
84
return buildString {
85
85
job.build(jobToStack, this , " " )
86
86
}
@@ -118,7 +118,7 @@ internal object DebugProbesImpl {
118
118
public fun dumpCoroutinesInfo (): List <CoroutineInfo > {
119
119
check(isInstalled) { " Debug probes are not installed" }
120
120
return capturedCoroutines.asSequence()
121
- .map { CoroutineInfo ( it.delegate, it. info) }
121
+ .map { it.info.copy( ) } // Copy as CoroutineInfo can be mutated concurrently by DebugProbes
122
122
.sortedBy { it.sequenceNumber }
123
123
.toList()
124
124
}
@@ -373,7 +373,7 @@ internal object DebugProbesImpl {
373
373
private fun <T : Throwable > sanitizeStackTrace (throwable : T ): List <StackTraceElement > {
374
374
val stackTrace = throwable.stackTrace
375
375
val size = stackTrace.size
376
- val probeIndex = stackTrace.indexOfLast { it.className == " kotlin.coroutines.jvm.internal.DebugProbesKt" }
376
+ val probeIndex = stackTrace.indexOfLast { it.className == " kotlin.coroutines.jvm.internal.DebugProbesKt" }
377
377
378
378
if (! DebugProbes .sanitizeStackTraces) {
379
379
return List (size - probeIndex) {
0 commit comments