How is it possible to debug Kotlin code when stepping into or out of a "suspend" function? (see example below).
fun mainFunction() = runBlocking {
println("before suspend call")
anotherFunction()
println("after suspend call")
}
suspend fun anotherFunction() {
// do something
}
I understand that Kotlin co-routines do a lot of magic when executing suspend functions and that the execution may switch threads at that moment. So when stepping out of "anotherFunction()" I only get to step through coroutine framework code and can't get back to the "mainFunction()".
However, I wonder if it is possible to debug this as if no co-routines were involved. Is there a tool or a library that enables this feature? Is it maybe on the roadmap for co-routine support?
A feature as simple as a compiler flag disabling co-routine magic would already go a long way, but I wasn't able to find anything.
The only useful thing I did find is: -ea JVM parameter also activates kotlin debug mode which will at least "fix" stack traces for exceptions.
question from:
https://stackoverflow.com/questions/55764586/how-to-step-through-suspend-function-calls-when-debugging-kotlin-coroutines 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…