LLDB you should know

LLDB is a next generation, high-performance debugger. It is built as a set of reusable components which highly leverage existing libraries in the larger LLVM Project, such as the Clang expression parser and LLVM disassembler.
LLDB is the default debugger in Xcode on Mac OS X and supports debugging C, Objective-C and C++ on the desktop and iOS devices and simulator.

LLDB syntax:

<command> [<subcommand> [<subcommand>...]] <action> [-options [option-value]] [argument [argument...]]

1. breakpoint

set breakpoints for all some:

breakpoint set -r some

-r: All method names including some will be set breakpoint
-n: All method names with some will be set breakpoint

// set breakpoint for all methods which including `viewDidLo`:
breakpoint set -r viewDidLo

// set breakpoint for all methods `viewDidLoad`:
breakpoint set -n viewDidLoad

// list all breakpoints
breakpoint list

// disable/enable all breakpoints
breakpoint disable/enable

// delete all breakpoints
breakpoint delete

2. register

register read Show current thread General Purpose Register:

(lldb) register read
General Purpose Registers:
       rax = 0x0000000000000001
       rbx = 0x0000000110d16c05  "count"
       rcx = 0x00007ff78b873f28
       rdx = 0x0000000000000000
       rdi = 0x00007ff78a832400
       rsi = 0x0000000120e1cc47  "viewDidLoad"
       rbp = 0x00007ffee43f7150
       rsp = 0x00007ffee43f7150
        r8 = 0x00000000000001ff
        r9 = 0x00006000029266c0
       r10 = 0x0000000000000047
       r11 = 0x000000010b90ff90  Facebook`@objc Facebook.BrowseViewController.viewDidLoad() -> () at <compiler-generated>
       r12 = 0x0000000000000018
       r13 = 0x00007ff78a832400
       r14 = 0x000000012156b9e4  UIKitCore`_UIApplicationLinkedOnVersion
       r15 = 0x0000000110206d80  libobjc.A.dylib`objc_msgSend
       rip = 0x000000010b90ff94  Casino`@objc Facebook.BrowseViewController.viewDidLoad() -> () + 4 at <compiler-generated>
    rflags = 0x0000000000000246
        cs = 0x000000000000002b
        fs = 0x0000000000000000
        gs = 0x0000000000000000

Write a new decimal 124 to current thread rax

register write rax 123

About Tang

A mobile developer, work in Stockholm, Sweden
This entry was posted in iOS and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s