What’s the best way to debug K/N? I’m using it for...
# kotlin-native
b
What’s the best way to debug K/N? I’m using it for #advent-of-code for the first time. I started out by following https://kotlinlang.org/docs/tutorials/native/basic-kotlin-native-app.html and I also installed the “native debugging support” plugin for intellij. But when I try to create a “K/N Application” run configuration I can’t select any of my main functions. Also unlike with kotlin jvm they don’t get highlighted to run. I’m using the latest Intellij Ultimate version (2019.3)
k
Hey Burkhar, could you please try to Debug one of Gradle run tasks (like those

https://kotlinlang.org/assets/images/tutorials/native/basic-kotlin-native/idea-run-gradle-task.png

) ?
Do you define executables in your build script?
Copy code
kotlin {    
    macosX64("m1") {
        binaries {
            executable("e1") {
                entryPoint = "sample.helloworld.main1"
                runTask?.environment(
                        "Longitude" to "35.240197",
                        "Latitude" to "31.779402"
                )
                runTask?.args("Peter", "John", "James")
            }

            executable("e2") {
                entryPoint = "sample.helloworld.main2"
                runTask?.environment(
                        "Longitude" to "35.240197",
                        "Latitude" to "31.779402"
                )
                runTask?.args("Peter", "John", "James")
            }
        }
    }
}
(full example is here https://github.com/kishmakov/my-examples/tree/master/my-mpp-basic). K/N run-configurations are being created for those executables.
b
debugging the gradle task does now work. However after adding
entryPoint
to my build file it works. Thx. This should be a part of the tutorial I linked IMO.
👍 1
k
Yes, this definitely should be in tutorial. We are working on making entry experience better, but there is still a lot to be done.
b
No worries. I’m considering writing a short blog post about my experience and my roadblocks with K/N after I finished advent of code. So maybe early next year (I don’t think I have time over christmas/new year). Maybe that can help. At least by pointing out some areas where the new user experience is not that great yet.
👍 1
Also is there any chance the debugging performance for K/N will increase? Looking at individual fields/running expressions in the debugger takes ages (30 seconds and more).
k
Yes, such a slowdowns are known. You could vote for task https://youtrack.jetbrains.com/issue/KT-34304