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

Fancy debug tips with LLDB

Pofat
January 20, 2018

Fancy debug tips with LLDB

An introduction about how to use LLDB like a boss.

Pofat

January 20, 2018
Tweet

More Decks by Pofat

Other Decks in Programming

Transcript

  1. Print Commands • p , print, call : expression —


    
 • po: expression -O —
 
 

  2. Breakpoints • -n : func or symbol name
 
 


    
 • li : list all breakpoints
 
 

  3. Better way to log maybe • Breakpoints will minimize the

    affect to flow • Need a way to import/export breakpoints
 
 

  4. Chisel in Swift context • error: error: use of undeclared

    identifier ‘CGFloat' • CGFloat is defined by macro in objc. In Swift, it’s not.

  5. Registers • $rip : Current instruct pointer • $rdi: First

    argument • $rsi, $rdx, $rcx, $R8, $R9: Second, third, forth, fifth and sixth arguments • Others will be on stack
  6. Registers • $rip : Current instruct pointer • $rdi: First

    argument • $rsi, $rdx, $rcx, $R8, $R9: Second, third, forth, fifth and sixth arguments • Others will be on stack
  7. Registers • $rsp : head of current frame ( head

    is smaller than bottom) • $rbp: bottom of current frame • $rax: Return register
  8. Reference • Dancing in the Debugger - A waltz with

    LLDB • ဤ䋊ҁ盄羊䋿ጱӾ㾴硽䋊翕ᒊ҂ • WWDC 2014 Session 410 : Advanced Debugging in LLDB