美文网首页
lldb简单使用

lldb简单使用

作者: 肖无情 | 来源:发表于2017-04-11 18:20 被阅读74次
1、工具调试键
JH{ZSKIZ[0HBKYA07Q`}F]L.jpg

从左到右:(有点装了)

1、Hide the Debug area 收起窗口
2、Deactivate breakpOINTS所有的断点全部起作用/不起作用
3、Continue paogram execution Step over 调过该断点 程序恢复正常继续执行
4、 Step over 单步执行的意思,每点这个按钮一次,程序就会从我们断点开始的地方,向下执行一步
5、Step into 进入执行的意思,断点会继续进入这个函数的内部进行调试
6、step out跳出的意思, 它会跳出当前的函数,回到函数的调用处

3、4、5、6、对应的lldb指令:
<pre>
(lldb) thread continue
(lldb) thread step-over
(lldb) thread step-in
(lldb) thread step-out
</pre>


2、设置断点(列几个例子)

main.m 文件的第12航设置断点

 (lldb) breakpoint set --file main.m --line 12 
 (lldb) breakpoint set -f main.m -l 12

在函数名为foo处设置断点:

 (lldb) breakpoint set --name foo
 (lldb) breakpoint set -n foo
  (lldb) breakpoint set --name foo --name bar

给选择器名为alignLeftEdges:的设置断点

 (lldb) breakpoint set --selector alignLeftEdges: 
 (lldb) breakpoint set -S alignLeftEdges:
也可以写成:

 (lldb) breakpoint set -n "-[SKTGraphicView alignLeftEdges:]" 
 (lldb) br s -n "-[SKTGraphicView alignLeftEdges:]"

将断点限定在一个特定的可执行库中

  (lldb) breakpoint set --shlib foo.dylib --n foo
3打印

<li> print (缩写p)是expression - - 的简写 所以当想要输出某一个值得时候 可以 p var 可以 print var 还可以 expression - - var

<pre>
lldb) p number
(NSInteger) $0 = 1
可以给 print 指定不同的打印格式 print/<fmt>
(lldb) p/x number
(NSInteger) $1 = 0x0000000000000001
16进制 p/x ,二进制(t=two) p/t , 打印字符 p/c , 打印以\0终止的字符串 p/s 。
</pre>
</li>

<li>expression(简写 e)可改变程序中的值 (lldb) e string = @“xxx” 此时string的值已经被改变再次输出就是string=xxx

 (lldb) e ((UIButton *)sender).backgroundColor =          [UIColor redColor]
 (UICachedDeviceRGBColor *) $41 =      0x00007fdd10715b00

所有格式 https://sourceware.org/gdb/onlinedocs/gdb/Output-Formats.html
</li>

<li>po 打印对象
(lldb) po string
可以看到到对象的 description 方法的结果。和命令 (lldb) e -O -- string一个效果,e -o -- 的别名就是 po (print object 的缩写)。
<pre>
(lldb) po [blogName uppercaseString]
(lldb) po [blogName substringFromIndex:2]

视图层次结构
po [self.view recursiveDescription]</pre>

0RV}IDAQ5X98XYMXSP(FZFS.jpg
4设置别名

如果觉得命令行太麻烦可以自定义简单的名称,例如:
<pre>
(lldb) command alias bfl breakpoint set -f %1 -l %2
(lldb) bfl foo.c 12
出去已创建的别名命令
(lldb) command unaries bel
</pre>

5设置断点触发条件

当condition的条件满足的时候才会执行着一个断点

T)987YZ)T%90%REEIJPK5WM.jpg

相关文章

  • lldb - 简单使用

    lldb 的相关内容特别多。 https://developer.apple.com/library/mac/do...

  • lldb简单使用

    1、工具调试键 从左到右:(有点装了) 1、Hide the Debug area 收起窗口2、Deactivat...

  • LLDB的简单使用

    程序员大部分时间都在调试,有效率的调试可以节省很多时间,下面是LLDB的简单的应用1.首先在程序中打一个断点屏幕快...

  • LLDB watchpoint 简单使用

  • 七 LLDB简单使用

    在上篇文章中,我们讲了Hook的原理分析,fishHook的简单使用,在使用的过程中,我们也详细的了解了一下Mac...

  • LLDB 使用

    LLDB 使用 LLDB(Low Lever Debug)命令结构 其中: (命令)和 (子命令):LLDB调试命...

  • iOS -LLDB简单命令

    LLDB语法 在使用LLDB之前,我们来先看看LLDB的语法,了解语法可以帮助我们清晰的使用LLDB: 一眼看上去...

  • LLDB - 在Python中使用lldb.py

    lldb官方添加办法-在Python中使用lldb.py模块[https://lldb.llvm.org/use/...

  • iOS逆向 lldb动态调试

    前言 使用 lldb 调试需要准备 debugserver。使用 OSX 中的 lldb 远程连接 iOS 上的 ...

  • android jni开放中的一些知识点

    lldb调试查看内存 lldb调试更多使用方式问百度

网友评论

      本文标题:lldb简单使用

      本文链接:https://www.haomeiwen.com/subject/gsrjattx.html