Kotlin iOS Debugging

Kotlin iOS Debugging

Debugging tools for iOS devs using Kotlin Native and Multiplatform

58d1281770fe55a05a96600244ec8341?s=128

Kevin Galligan

May 08, 2019
Tweet

Transcript

  1. Kotlin iOS Debugging Kevin Galligan

  2. Partner at

  3. None
  4. None
  5. None
  6. None
  7. None
  8. None
  9. Features • Kotlin Source recognition and coloring • Add breakpoints

    • Interactive debugging
  10. Xcode Demo!

  11. Dev Version about 1/3 slower than earlier version

  12. 3 Main Pieces

  13. Kotlin.xcplugindata tells Xcode that *.kt is source

  14. Kotlin.xclangspec color file (tweaked from Java, TBH)

  15. konan_lldb.py lldb formatter (where the magic happens)

  16. None
  17. None
  18. None
  19. None
  20. None
  21. Adding Kotlin Files to Xcode spoilers: the hard part

  22. xcode doesn’t “see” your folders

  23. you must add them

  24. Source or Resource?

  25. Options

  26. 1) Manually Add Them spoiler: meh

  27. 2) Gradle Plugin better

  28. xcode { projectPath = "../../iosApp/iosApp.xcodeproj" target = "iosApp" } apply

    plugin: 'co.touchlab.kotlinxcodesync'
  29. None
  30. Work in progress!

  31. 3) Cocoapods probably best option in near future…

  32. https://github.com/touchlab/DroidconKotlin/

  33. AppCode?

  34. None
  35. AppCode Demo!

  36. PR Ready! almost

  37. None
  38. None
  39. What’s Next?

  40. Performance!

  41. Better Formats

  42. this is a map?

  43. Other Stuff

  44. RUNTIME_USED int32_t Konan_DebugObjectToUtf8Array(KRef obj, char* buffer, int bufferSize); // Print

    to console string representation of an object. RUNTIME_USED int32_t Konan_DebugPrint(KRef obj); // Returns 1 if obj refers to an array, string or binary blob and 0 otherwise. RUNTIME_USED int Konan_DebugIsArray(KRef obj); // Returns number of fields in an objects, or elements in an array. RUNTIME_USED int Konan_DebugGetFieldCount(KRef obj); // Compute type of field or an array element at the index, or 0, if incorrect, // see Konan_RuntimeType. RUNTIME_USED int Konan_DebugGetFieldType(KRef obj, int index); // Compute address of field or an array element at the index, or null, if incorrect. RUNTIME_USED void* Konan_DebugGetFieldAddress(KRef obj, int index); // Compute address of field or an array element at the index, or null, if incorrect. RUNTIME_USED const char* Konan_DebugGetFieldName(KRef obj, int index);
  45. kevin@touchlab.co @kpgalligan https://medium.com/@kpgalligan