JVM_IR: Generate as much LINENUMBER information as possible inside

suspend functions and lambdas.

Otherwise, when state-machine builder splits instructions and adds
LINENUMBER between states, the information becomes corrupted.
This commit is contained in:
Ilmir Usmanov
2019-09-24 21:37:51 +03:00
parent 69a9559eac
commit f4a7c839d3
6 changed files with 128 additions and 2 deletions
@@ -149,7 +149,10 @@ class ExpressionCodegen(
if (fileEntry != null) {
val lineNumber = fileEntry.getLineNumber(offset) + 1
assert(lineNumber > 0)
if (lastLineNumber != lineNumber) {
// State-machine builder splits the sequence of instructions into states inside state-machine, adding additional LINENUMBERs
// between them for debugger to stop on suspension. Thus, it requires as much LINENUMBER information as possible to be present,
// otherwise, any exception will have incorrect line number. See elvisLineNumber.kt test.
if (lastLineNumber != lineNumber || irFunction.isSuspend || irFunction.isInvokeSuspendOfLambda(context)) {
lastLineNumber = lineNumber
mv.visitLineNumber(lineNumber, markNewLabel())
}