kpgalligan
11/30/2018, 8:09 PMpajatopmr
11/30/2018, 10:08 PMtylerwilson
11/30/2018, 11:27 PMLanderl Young
12/03/2018, 2:29 AMdmitriy.dolovov
12/03/2018, 3:11 AM-g
command line argument to Kotlin/Native compiler (konanc
or kotlinc-native
command).
- Then run the app in LLDB console. Something like this:
bash-3.2$ lldb myapp.kexe
(lldb) target create "myapp.kexe"
Current executable set to 'myapp.kexe' (x86_64).
(lldb) breakpoint set -l 24
Breakpoint 1: where = myapp.kexe`kfun:main(kotlin.Array<kotlin.String>) + 14 at Sample.kt:24, address = 0x000000010000894e
(lldb) run 123 hello world
Process 34209 launched: '/Users/dmitriy.dolovov/temp/myapp.kexe' (x86_64)
Process 34209 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x000000010000894e myapp.kexe`kfun:main(kotlin.Array<kotlin.String>) at Sample.kt:24
21 }
22 }
23
-> 24 fun main(args: Array<String>) {
25 MyApplication().runMe()
26 }
Target 0: (myapp.kexe) stopped.
(lldb) s
Process 34209 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step in
frame #0: 0x0000000100008978 myapp.kexe`kfun:main(kotlin.Array<kotlin.String>) at Sample.kt:25
22 }
23
24 fun main(args: Array<String>) {
-> 25 MyApplication().runMe()
26 }
Target 0: (myapp.kexe) stopped.
(lldb) frame var
(ObjHeader *) args = 0x0000000100506df8
- In order to inspect non-primitive values on the frame you will need to apply LLDB formatters for Kotlin/Native:
(lldb) command script import ~/.konan/kotlin-native-macos-1.0.2/tools/konan_lldb.py
(lldb) frame var
(ObjHeader *) args = [123', 'hello', 'world']
- And, if you are using the recent version of CLion (2018.3) with up-to-date Kotlin/Native plugin, then debugging is available right in the IDE. Just launch your run configuration in debug mode.kpgalligan
12/03/2018, 4:29 AMsergey.bogolepov
12/03/2018, 7:07 AMkonan-lldb
that launches lldb
and loads konan_lldb.py
for you.