How to Play LLDB in iOS runtime?

How to Play LLDB in iOS runtime?

Ec07b93af4f1cedd674f6e7f56f29b32?s=128

Sting Su

May 28, 2019
Tweet

Transcript

  1. How to play with LLDB in iOS runtime? @stinge

  2. • slide url
 https://ppt.cc/fhdtqx • QR Code

  3. Background stinge • Mercari iOS Engineer • twitter: @StingeSu •

    hobby: traveling & cooking
  4. Outline • Why LLDB(Low Level Debugger)? • How LLDB works?

    • LLDB OSS • Custom LLDB command
  5. Why LLDB? • high-performance debugger • Clang expression parser &

    LLVM disassembler • Default debugger in Xcode • Run Swift REPL & python supported • Save your time
  6. Clang v.s GCC(GNU Compiler Collection) Clang • Apple official compiler

    • Frontend for LLVM • High performance • BSD license • …… GCC • Linux based • Support more languages • GPL license
  7. Clang (Xcode 10.2.1) GCC (Darwin Kernel on Raspberry Pi)

  8. • How Apple deprecated GCC Front-end Back-end Xcode 3 GCC

    GCC Xcode 4 GCC LLVM Xcode 5 Clang LLVM
  9. • gcc hello.c

  10. Is it good for iOS?

  11. Is it good for iOS? NO 

  12. build process

  13. Clang-Swift • The compiler process of swift cmd+B

  14. Clang-Swift • The compiler process of swift Clang AST Reference

    https://ppt.cc/fnA4Qx
  15. Clang-Swift • The compiler process of swift

  16. How LLDB works?

  17. How LLDB works? command action option argument

  18. None
  19. • p(print) → expr -- expr -- foo • po(print

    object) → expr -O -- expr -O -- foo
  20. p v.s po

  21. None
  22. • Changes the value of variables • Creates temporary variables

    • Validates the values
  23. • DEMO • Tasks 1. Changes UIButton title into red

    2. Moves UIView up
  24. • Can we use a efficient way to finish these

    commands?
 - YES
  25. LLDB Python API https://lldb.llvm.org/python_reference/index.html

  26. LLDB OSS • Facebook/chisel • DEMO

  27. Customized command • nudge(swift) • DEMO https://gist.github.com/sTinGe/059dc4c15347b7fef4ee537efdcc6e53