Upgrade to Pro — share decks privately, control downloads, hide ads and more …

디버깅 시작해버깅

Gaeun
November 16, 2019

디버깅 시작해버깅

LLDB랑 친해지기

Gaeun

November 16, 2019
Tweet

Other Decks in Programming

Transcript

  1. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab
  2. LLVM? • Low Level Virtual Machine , • Compiler Toolchain

    • Chris Lattner • Apple Compiler • , • LLVM Core, Clang, LLDB, libc++, compiler-rt ..
  3. LLDB? • LLVM Debugger Component • C, C++, Objective-C, Swift

    • Xcode Debugger • LLVM • Clang Expression Parser, LLVM Disassembler
  4. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Beyond “PO” LLDB
  5. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab
  6. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup continue next rbreak image dump symtab
  7. watchpoint po breakpoint command apropo alias ivars type lookup sys

    frame variable image list pprotocol tv help keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab
  8. watchpoint po breakpoint command apropo alias ivars type lookup sys

    frame variable image list pprotocol tv help keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab ? (lldb) help breakpoint (lldb) help breakpoint read
  9. watchpoint po breakpoint command apropo alias ivars type lookup sys

    frame variable image list pprotocol tv help keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab ? (lldb) apropo “reference count” The following commands may relate to 'reference count': refcount -- Inspect the reference count data for a Swift object
  10. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab
  11. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Xcode IDE
  12. watchpoint po breakpoint help command alias ivars apropo type lookup

    sbt frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab
  13. watchpoint po breakpoint help command alias ivars apropo type lookup

    sbt frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Breakpoint , Memory Read/Write Break Code
  14. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Set (lldb) watchpoint set variable -w write user (lldb) w s v self Watchpoint created: Watchpoint 1: addr = 0x7 ee400b168 size = 8 state = enabled type = w declare @ ‘/Users/gaeun/ /ViewController.swift:25’ watchpoint spec = ‘user' new value: 0x00007 ba1506390 - ੌ߈੸ਵ۽ ୭؀ 4ѐө૑ ࢤࢿоמ - 8byteࠁ׮ ੘ইঠ Watch оמ
  15. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Current watchpoints: Watchpoint 1: addr = 0x7 ee400b168 size = 8 state = enabled type = w declare @ ‘/Users/gaeun/ /DebuggingTest/ViewController.swift:25' watchpoint spec = 'self' new value: 0x00007 ba1506390 List (lldb) watchpoint list (lldb) w l
  16. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab (lldb) watchpoint command add 1 Delete (lldb) watchpoint delete 1 1 watchpoints deleted Command प೯ೡ Command ୶оೞӝ
  17. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab
  18. watchpoint po breakpoint help command alias ivars apropo type lookup

    sbt frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab (lldb) language swift refcount self (lldb) la s refcount self 
 refcount data: (strong = 1, unowned = 0, weak = 0) Swiftীࢲ݅ ࢎਊоמೠ ݺ۸য
  19. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab
  20. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Module • Module : 
 Code / Plugin / Framework Dynamic Library Image Commandח “target modules”੄ SubCommand۽
  21. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab • Module Symbol 
 • Private 
 Framework 
 Class, Method • Crash Report 
 Backtrace Symbolicating
  22. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Dependency Module • UUID • Memory Address • Path
  23. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Module Symbol (lldb) image dump symtab Alamo re -s adress • Alamo re Symbol
  24. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Symbol Filtering • UINavigationBar “set ” Method 
 (lldb) image lookup -rn ‘\[UINavigationBar\ set\’ 

  25. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Crash Log Backtrace Symbolicating Last Exception Backtrace: 0 CoreFoundation 0x000000018708b100 0x186f80000 + 1093888 1 libobjc.A.dylib 0x00000001939441fc 0x19393c000 + 33276 2 CoreFoundation 0x000000018708b040 0x186f80000 + 1093696 3 ExampleApp 0x000000010003acc4 0x10002c000 + 60612 StackAddress LoadAddress Offset SlideValue : 32-bitח 0x4000, 64-bitח 0x100000000 FileAddress = StackAddress - LoadAddress + Slide = O set + Slide
  26. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab Crash Log Backtrace Symbolicating (lldb) target create --arch arm64 ExampleApp.dSYM Current executable set to ExampleApp.dSYM' (arm64). (lldb) image lookup --address 0x10000ECC4 Address: ExampleApp.dSYM[0x000000010000ecc4] (ExampleApp.dSYM.__TEXT.__text + 29916) Summary: ExampleApp.dSYM`-[ExampleClass buggyFunction] + 68 at ExampleClass.m:181
  27. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab UI Debugging
  28. watchpoint po breakpoint help command alias ivars apropo type lookup

    sbt frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup continue next rbreak image dump symtab
  29. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup continue next rbreak image dump symtab (lldb) command alias pojc expr -l objc++ -O -- (lldb) command alias “ ”
  30. watchpoint po breakpoint help command alias ivars apropo type lookup

    sbt frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup continue next rbreak image dump symtab
  31. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup continue next rbreak image dump symtab Command , ~/.lldbinit • Custom Command Alias • LLDB Script • Chisel (Facebook)
 https://github.com/facebook/chisel • DerekSelander
 https://github.com/DerekSelander/LLDB
  32. watchpoint po breakpoint help command alias ivars apropo type lookup

    sbt frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup continue next rbreak image dump symtab Derek Selander https://github.com/DerekSelander/LLDB
  33. watchpoint breakpoint help command alias ivars apropo type lookup sbt

    frame variable image list next pprotocol keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup tv continue rbreak image dump symtab
  34. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list next pprotocol keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup tv continue rbreak image dump symtab Protocol Required/Optional Method (Objective-C Only)
  35. watchpoint breakpoint help command alias ivars apropo type lookup sbt

    frame variable image list next pprotocol keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup tv continue rbreak image dump symtab Backtrace Symbolicating (Objective-C Symbol only)
  36. watchpoint po breakpoint help command alias ivars apropo type lookup

    sbt frame variable image list next pprotocol keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup tv continue rbreak image dump symtab Keychain DataBase
  37. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list next pprotocol keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup tv continue rbreak image dump symtab View isHidden Toggle
  38. watchpoint po breakpoint help command alias ivars apropo type lookup

    sbt frame variable image list pprotocol tv keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup continue next rbreak image dump symtab
  39. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list next pprotocol keychain p backtrace jump expression refcount thread info step register read /.lldbinit image lookup tv continue rbreak image dump symtab Reference
  40. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list next pprotocol keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup tv continue rbreak image dump symtab #WWDC16 Debugging Tips and Tricks #WWDC18 Advanced Debugging with Xcode and LLDB Advanced Apple Debugging & Reverse Engineering https://llvm.org/ https://github.com/DerekSelander/LLDB
  41. watchpoint po breakpoint help command alias ivars apropo type lookup

    sys frame variable image list next pprotocol keychain p backtrace jump expression refcount thread info step register read ./lldbinit image lookup tv continue rbreak image dump symtab