Prevent debugger to stop twice on breakpoints after suspension point

#KT-18453 In Progress
This commit is contained in:
Nikolay Krasko
2017-06-09 16:00:13 +03:00
parent 49baba017a
commit 6d7ce6cec1
@@ -524,6 +524,12 @@ class CoroutineTransformerMethodVisitor(
val afterSuspensionPointLineNumber = nextLineNumberNode?.line ?: suspendElementLineNumber val afterSuspensionPointLineNumber = nextLineNumberNode?.line ?: suspendElementLineNumber
visitLineNumber(afterSuspensionPointLineNumber, continuationLabelAfterLoadedResult.label) visitLineNumber(afterSuspensionPointLineNumber, continuationLabelAfterLoadedResult.label)
}) })
if (nextLineNumberNode != null) {
// Remove the line number instruction as it now covered with line number on continuation label.
// If both linenumber are present in bytecode, debugger will trigger line specific events twice.
remove(nextLineNumberNode)
}
} }
return continuationLabel return continuationLabel
@@ -713,6 +719,7 @@ private fun findSafelyReachableReturns(methodNode: MethodNode): Array<Set<Int>?>
for (index in 0 until insns.size()) { for (index in 0 until insns.size()) {
if (insns[index].opcode == Opcodes.ARETURN) continue if (insns[index].opcode == Opcodes.ARETURN) continue
@Suppress("RemoveExplicitTypeArguments")
val newResult = val newResult =
controlFlowGraph controlFlowGraph
.getSuccessorsIndices(index).plus(index) .getSuccessorsIndices(index).plus(index)