Hello everybody, we are trying to debug kotlin cod...
# touchlab-tools
m
Hello everybody, we are trying to debug kotlin code from xcode through https://github.com/touchlab/xcode-kotlin In order to be able to set breakpoints we followed the documentation but we had to run
add-dsym
in order to make lldb load the DSYM (although they are defined and packaged in the xcframework). The issue we are experiencing now it that everything appears as an
ObjHeader *
(screenshot attached). We are using Kotlin 1.9.0-BETA and the specs are in the other screenshot attached. There we noticed that
LLDB Xcode init sources main LLDB init: No
, could it be linked? Thanks!
Side note about `add-sym`: If we run
image list
when running the ios app in AS we see
...../SDK.framework.dSYM/Contents/Resources/DWARF/SDK
but it is not there if we run the same command in XCode, that's why we have to run
add-dsym
k
We haven't yet worked with 1.9.0 beta and the xcode debugger. We were holding off for beta to do any serious testing with our open source tools. We'll need to put some time/focus on that now that beta has been released.
OK, quick dip into the Kotlin code. lldb hasn't changed much for a while, but 1.9 looks to have at least some form of a significant refactor, so we'll need to update our tool. I've also heard Xcode 15 may change the situation somewhat as well, so there's some updates to be done.
If you want to hack things a bit, you could try replacing
konan_lldb.py
with the updated one: https://github.com/JetBrains/kotlin/blob/master/kotlin-native/llvmDebugInfoC/src/scripts/konan_lldb.py
That is in here: https://github.com/touchlab/xcode-kotlin/tree/main/data/Kotlin.ideplugin/Contents/Resources. We used to have slight edits to the "official" file, but have been removing them over time as optimizations have been added to the kotlin-repo file. IIRC, the file in our repo should now be pretty much stock, but I'd need to do some checking to confirm.
m
I'll try to run some tests 👍 We started with 1.9 because AS was not stopping at breakpoints with 1.8 (known issue fixed in 1.9). I just tried Kotlin 1.8 but in XCode we still experience the issues reported, doesn't look kotlin version related.
I dig deeper and it looks like the
konan-lldb
is doing is job
Copy code
(lldb) expression -- (int32_t)Konan_DebugPrint(_this)
(int32_t) $1 = 0
com.sample.shared.exchange.data.entrypoint.RequestExchangeRateKMMEntryPointImpl@b46427f0(lldb)
The problem looks like the xcode debugger view that is not resolving the types (screenshot attached)
110 Views