Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
LLDB Cheat Sheet

LLDB Cheat Sheet

A complete gdb to lldb command map.

Print out

  • Print object
(lldb) po responseObject
(lldb) po [responseObject objectForKey@"state"]
  • p - Print primitive type

Breakpoints

  • List breakpoints
br l
  • br delete - Delete breakpoint
(lldb) br delete 1
  • br e - Enable breakpoint
  • br di - Disable breakpoint
  • b - Add breakpoint
(lldb) b MyViewController.m:30
  • br set - Add symbolic breakpoint
(lldb) br set -n viewDidLoad
  • Conditional break
for(PlayerItem *item in player.inventory) {
    totalValue += item.value;
}

Set a conditional breakpoint 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
  • Print backtrace
(lldb) bt
@adamdahan

This comment has been minimized.

Copy link

commented Jun 28, 2017

is there a quick command for clearing all breakpoints? BTW thanks for this <3

@bruno-rocha-movile

This comment has been minimized.

Copy link

commented Jul 2, 2017

@adamdahan br delete without any number deletes all breakpoints :)

@Josue198s

This comment has been minimized.

Copy link

commented Aug 30, 2017

Thanks Dude..

@happivlee

This comment has been minimized.

Copy link

commented May 21, 2018

Thanks! Useful reference sheet - found what I was was looking for and added 2 things to immediate use :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.