What's the easiest way to debug the native compile...
# kotlin-native
m
What's the easiest way to debug the native compiler (in a multiplatform project)?
k
The compiler or debug native code?
m
The compiler. I get so many exceptions with little info and it takes quite a while to comment out code until I can pin down the cause 😅 I hope that debugging the compiler gives context and helps me speed that up.
That one alone took me four hours to resolve all causes: https://github.com/JetBrains/kotlin-native/issues/3019
k
I don’t know how you’d “debug” it. I think it’s a combo of experience and the compiler stabilizing over time. I started around version 0.6, and would get problems quite often. I get them rarely now, but I generally do what I’d call a “binary compiler search”. Remove a large chunk of code (ideally “half”). If it still fails, remove more, if it compiles, add back and remove half of the suspect batch.
m
That's what I'm doing but it's slow. What I'd like to do is to set a breakpoint at the location where the compiler exception is thrown and just check the variables/properties to get a hint which variable/function/class of the source code is causing the exception.
k
Well, I think I can help, oddly enough. Hold on…
I made a blog post, in case anybody else wants to do it.
m
Thanks, will check it out!