Home lldb
Post
Cancel

lldb

help

1
help breakpoint [set]

breakpoint/br

clear

Delete or disable breakpoints matching the specified source file and line

command

Commands for adding, removing and listing LLDB commands executed when a breakpoint is hit.

1
2
3
4
# Add LLDB commands to a breakpoint, to be executed whenever the breakpoint is hit.  The commands added to the breakpoint replace any commands previously added to it.  If no breakpoint is specified, adds the commands to the last created breakpoint.
breakpoint command add 2
> po self
> p self.view.backgroundColor = [UIColor redColor];
1
2
# List the script or set of commands to be executed when the breakpoint is hit.
breakpoint command list 2
1
2
# Delete the set of commands from a breakpoint.
breakpoint command delete 2

delete

Delete the specified breakpoint(s). If no breakpoints are specified, delete them all.

disable

Disable the specified breakpoint(s) without deleting them. If none are specified, disable all breakpoints.

enable

Enable the specified disabled breakpoint(s). If no breakpoints are specified, enable all of them.

list

List some or all breakpoints at configurable levels of detail.

modify

Modify the options on a breakpoint or set of breakpoints in the executable. If no breakpoint is specified, acts on the last created breakpoint. With the exception of -e, -d and -i, passing an empty argument clears the modification.

name

Commands to manage name tags for breakpoints

read

Read and set the breakpoints previously saved to a file with “breakpoint write”.

set

Sets a breakpoint or set of breakpoints in the executable.

1
2
3
4
5
# Set the breakpoint only in this shared library.  Can repeat this option multiple times to specify multiple shared libraries.
-s <shlib-name> ( --shlib <shlib-name> )

# Set the breakpoint by function name, evaluating a regular-expression to find the function name(s).
-r <regular-expression> ( --func-regex <regular-expression> )

write

Write the breakpoints listed to a file that can be read in with “breakpoint read”. If given no arguments, writes all breakpoints.

example

1
2
3
4
5
breakpoint set -n touchesBegan:withEvent:
breakpoint set -n "-[ViewController touchesBegan:withEvent]"

# regular expression
breakpoint set -r est

expression

Evaluate an expression on the current thread.

1
2
3
4
expr my_struct->a = my_array[3]
expr -f bin -- (index * 8) + 5
expr unsigned int $foo = 5
expr char c[] = \"foo\"; c[0]

p

p is an abbreviation for expression --

print is an abbreviation for expression --

po

po is an abbreviation for expression -O --

thread

backtrace

Show thread call stacks. Defaults to the currentthread, thread indexes can be specified as arguments.

continue

Continue execution of the current target process. One or more threads may be specified, by default all threads continue.

exception

Display the current exception object for a thread. Defaults to the current thread.

info

Show an extended summary of one or more threads. Defaults to the current thread.

jump

Sets the program counter to a new address.

list

Show a summary of each thread in the current target process. Use ‘settings set thread-format’ to customize the individual thread listings.

plan

Commands for managing thread plans that control execution.

return

Prematurely return from a stack frame, short-circuiting execution of newer frames and optionally yielding a specified value. Defaults to the exiting the current stack frame.

select

Change the currently selected thread.

step-in

Source level single step, stepping into calls. Defaults to current thread unless specified.

step/s

‘step’ is an abbreviation for ‘thread step-in’

’s’ is an abbreviation for ‘thread step-in’

step-inst

Instruction level single step, stepping into calls. Defaults to current thread unless specified.

stepi/si

‘si’ is an abbreviation for ‘thread step-inst’

‘stepi’ is an abbreviation for ‘thread step-inst’

step-inst-over

Instruction level single step, stepping over calls. Defaults to current thread unless specified.

nexti/ni

‘ni’ is an abbreviation for ‘thread step-inst-over’

‘nexti’ is an abbreviation for ‘thread step-inst-over’

step-out

Finish executing the current stack frame and stop after returning. Defaults to current thread unless specified.

finish

‘finish’ is an abbreviation for ‘thread step-out’

step-over

next/n

‘next’ is an abbreviation for ‘thread step-over’

‘n’ is an abbreviation for ‘thread step-over’

Source level single step, stepping over calls. Defaults to current thread unless specified.

step-scripted

Step as instructed by the script class passed in the -C option. You can also specify a dictionary of key (-k) and value (-v) pairs that will be used to populate an SBStructuredData Dictionary, which will be passed to the constructor of the class implementing the scripted step. See the Python Reference for more details.

trace

Commands for operating on traces of the threads in thecurrent process.

until

Continue until a line number or address is reached by the current or specified thread. Stops when returning from the current function as a safety measure. The target line number(s) are given as arguments, and if more than one is provided, stepping will stop when the first one is hit.

bt

Show the current thread’s call stack. Any numeric argument displays at most that many frames.

bt is an abbreviation for _regexp-bt

1
bt 10

frame

1
frame variable

process

attach

Attach to a process.

detach

Detach from the current target process.

continue

Continue execution of all threads in the current process.

continue/c

‘continue’ is an abbreviation for ‘process continue’

‘c’ is an abbreviation for ‘process continue’

connect

Connect to a remote debug service.

load

Load a shared library into the current process.

unload

Unload a shared library from the current process using the index returned by a previous call to process load.

status

Show status and stop location for the current target process.

trace

Commands for tracing the current process.

interrupt

Interrupt the current target process.

kill

Terminate the current target process.

signal

Send a UNIX signal to the current target process.

plugin

Commands for operating on a ProcessGDBRemote process.

save-core

Save the current process as a core file using an appropriate file type.

handle

Manage LLDB handling of OS signals for the current target process. Defaults to showing current policy.

continue/c

continue is an abbreviation for process continue

c is an abbreviation for process continue

watchpoint(内存断点)

Commands for operating on watchpoints.

1
2
3
4
5
# 监控_age实例变量的内存
watchpoint set variable self->_age

# 在指定内存地址上设置断点
watchpoint set expression &self->_age

target

Commands for accessing information for one or more target modules.

list

List all current targets in the current debug session.

dump

Commands for dumping information about the target.

create

Create a target using the argument as the main executable.

modules

Commands for accessing information for one or more target modules.

image

‘image’ is an abbreviation for ‘target modules’

1
2
3
4
5
6
7
8
image lookup -t NSInteger
image lookup -t ViewController
image lookup -t JXIMClient

# lookup address
image lookup -a <address>
# Lookup a function or symbol by name in one or more target modules.
image lookup -n <function-or-symbol>

select

Select a target as the current target by target index.

show-launch-environment

Shows the environment being passed to the process when launched, taking info account 3 settings: target.env-vars, target.inherit-env and target.unset-env-vars.

stop-hook

Commands for operating on debugger target stop-hooks.

symbols

Commands for adding and managing debug symbol files.

variable

Read global variables for the current target, before or while running a process.

example

1
image loo
This post is licensed under CC BY 4.0 by the author.