Article Directory
lldb breakpoint debugging
Lldb xcode enters debug mode, the method of case-sensitive
breakpoint
breakpoint set -n method
breakpoint of a method or function
-n indicates the name of
method represents a method or function
缩写:b -r method
For functions
void *test1() {
}
breakpoint set -n test1
缩写 b -n test1
For method
- (void)save:(NSString*)name {
//.....
}
- (void)pause:(NSString*)name {
//.....
}
breakpoint set -n "[ViewController save:]" -n "[ViewController pause:]"
缩写:b set -n "[ViewController save:]" -n "[ViewController pause:]"
For any of this method
breakpoint set --selector touchesBegan: withEvent:
This method breakpoint all touchesBegan: withEvent: method, regardless of the class
This method for file
breakpoint set --file ViewController.m --selector touchesBegan: withEvent :
Find this method only in the current ViewController.m files and breakpoints
Traversal break
breakpoint set -r Game:
traversing the project with all the Game: Method field
View Breakpoints
breakpoint list
can get all breakpoints set
group 1 can comprise 1.1, 1.2
缩写 break list
Exit lldb mode
c continue
意味continue
n next
s step
Point of the switching
breakpoint enable 1
breakpoint disable 1
Group 1 represents the breakpoint, a breakpoint or a single 1.1, obtained by the breakpoint list
缩写 break dis 1
缩写 break en 1
Delete breakpoint
breakpoint delete 1
if the group does not pass, then clear all breakpoints
breakpoint delete
only delete the specified group
If you delete a 1.1, and then disable command, is disabled
View instructions
help breakpoint
See all breakpoint instruction
help b
you can see the effect of b
全部缩写方法可以自己尝试
Code execution
expression
expression self
缩写 p self
使用 p object会获取一个对象
$0 = 地址
然后我们可以通过p $0.property来打印该对象的属性
相当于使用了一个局部变量$0接收该对象的地址,或者该值。
联想block中的对象拷贝和值拷贝
Create a variable code execution
p Person *p4 = [Person new];
At this time, hold down the Alt + Enter either write code to create p4
Stack View
bt
Use bt
to view the current stack information. Function call stack
up down
By up down
can view up the stack
Check the value of the fixed frame
By frame select 1
the instruction, frame selection view
display instruction in assembly code is
View frame variable parameters
You can view the parameters of the frame
Rollback command thread return
By thread roll back, roll back to the previous step, but will not be executed, because of the return.
Breakpoint memory
Changes in the value of listeners
watchpoint set variable p1.name
watchpoint instruction breakpoint, have a dis, en, delelte commands
When the name of the property changes p1, the breakpoint will
give two values
old value : address1
new value : address2
You can see the value of the address by the Executive po
Take Address
p &obj.name 这种写法错误,点语法不对
p &obj->_name 只能访问成员变量来获取地址
Breakpoint command
When a breakpoint to breakpoint instruction multiple commands if needed, we can add a breakpoint commands in advance
breakpoint command add 1
> po self
> p self.view
> DONE
Thus, when a breakpoint is triggered, it automatically performs two po and p breakpoint instruction.
The same command can also delete, list to view the call
target
target stop-hook
target stop-hook add -o "frame variable"
Meaning each breakpoint that they will call the frame of variable instruction, no matter which method you off to live, will print the parameter list
target stop-hook list
target stop-hook delete
target stop-hook disable
target stop-hook enalbe
And so also have list delete command.
stop-hook configuration
generally not temporary stop-hook call, usually configured. lldb has an initialization file
cd ~
ls
ls -a
//查找到.lldbinit文件,即为初始化文件,vim操作该文件即可。
vim .lldbinit
cat .lldbinit
target stop-hook add -o "frame variable"
Common instruction image
Array bounds
- bt view the call stack
- image lookup -a address
View file information
image lookup -t filename
View DLL
image list
View memory value
memory read addressValue