Skip to content

Instantly share code, notes, and snippets.

@naveenadi
Forked from ryanchang/lldb_cheat_sheet.md
Created March 15, 2025 06:33
Show Gist options
  • Save naveenadi/f664c92481eedea80d1fce3fd11cad52 to your computer and use it in GitHub Desktop.
Save naveenadi/f664c92481eedea80d1fce3fd11cad52 to your computer and use it in GitHub Desktop.

Revisions

  1. @ryanchang ryanchang renamed this gist Nov 26, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @ryanchang ryanchang revised this gist Sep 5, 2014. 1 changed file with 16 additions and 9 deletions.
    25 changes: 16 additions & 9 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    # LLDB Cheat Sheet
    A complete [gdb to lldb command map](http://lldb.llvm.org/lldb-gdb.html).
    ### Print out
    * po - Print object
    * Print object
    ```
    (lldb) po responseObject
    (lldb) po [responseObject objectForKey@"state"]
    @@ -10,19 +10,22 @@ A complete [gdb to lldb command map](http://lldb.llvm.org/lldb-gdb.html).
    * p - Print primitive type


    ### Break points
    * br l - List break points
    * br delete - Delete break point
    ### Breakpoints
    * List breakpoints
    ```
    br l
    ```
    * br delete - Delete breakpoint
    ```
    (lldb) br delete 1
    ```
    * br e - Enable break point
    * br di - Disable break point
    * b - Add break point
    * br e - Enable breakpoint
    * br di - Disable breakpoint
    * b - Add breakpoint
    ```
    (lldb) b MyViewController.m:30
    ```
    * br set - Add symbolic break point
    * br set - Add symbolic breakpoint
    ```
    (lldb) br set -n viewDidLoad
    ```
    @@ -32,7 +35,7 @@ for(PlayerItem *item in player.inventory) {
    totalValue += item.value;
    }
    ```
    Set a conditional break point that triggers only when `totalValue` is greater than 1000:
    Set a conditional breakpoint that triggers only when `totalValue` is greater than 1000:
    ```
    (lldb) b MerchantViewController.m:32
    Breakpoint 3: where = lootcollector`-[MerchantViewController] ...
    @@ -62,3 +65,7 @@ Enter your debugger command(s). Type 'DONE' to end.
    ```
    (lldb) s
    ```
    * Print backtrace
    ```
    (lldb) bt
    ```
  3. @ryanchang ryanchang revised this gist Sep 5, 2014. 1 changed file with 56 additions and 1 deletion.
    57 changes: 56 additions & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,63 @@
    A complete [gdb to lldb command map](http://lldb.llvm.org/lldb-gdb.html).
    ### Print out
    * po - Print object
    ```
    (lldb) po responseObject
    (lldb) po [responseObject objectForKey@"state"]
    ```

    * p - Print primitive type


    ### Break points
    * br l - List break points
    *
    * br delete - Delete break point
    ```
    (lldb) br delete 1
    ```
    * br e - Enable break point
    * br di - Disable break point
    * b - Add break point
    ```
    (lldb) b MyViewController.m:30
    ```
    * br set - Add symbolic break point
    ```
    (lldb) br set -n viewDidLoad
    ```
    * Conditional break
    ``` objc
    for(PlayerItem *item in player.inventory) {
    totalValue += item.value;
    }
    ```
    Set a conditional break point that triggers only when `totalValue` is greater than 1000:
    ```
    (lldb) b MerchantViewController.m:32
    Breakpoint 3: where = lootcollector`-[MerchantViewController] ...
    (lldb) br mod -c "totalValue > 1000" 3
    ```
    Reset the condition:
    ```
    (lldb) br mod -c "" 3
    ```
    * Run a debugger command from a breakpoint
    ```
    (lldb) br com add 2
    Enter your debugger command(s). Type 'DONE' to end.
    > bt
    > continue
    > DONE
    ```
    * Resume excution
    ```
    (lldb) continue
    ```
    * Step over
    ```
    (lldb) n
    ```
    * Step in
    ```
    (lldb) s
    ```
  4. @ryanchang ryanchang revised this gist Sep 5, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,9 @@
    # LLDB Cheat Sheet
    A complete [gdb to lldb command map](http://lldb.llvm.org/lldb-gdb.html).
    ### Print out
    * po - Print object
    * p - Print primitive type

    ### Break points
    * br l - List break points
    *
    *
  5. @ryanchang ryanchang created this gist Sep 5, 2014.
    8 changes: 8 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    # LLDB Cheat Sheet
    ### Print out
    * po - Print object
    * p - Print primitive type

    ### Break points
    * br l - List break points
    *