LLDB调试

作者: 玩呀玩 | 来源:发表于2019-03-20 18:31 被阅读14次

安装facebook/chisel DerekSelander/LLDB
LLDB会从默认的~/.lldbinit加载自定义脚本

git clone https://github.com/facebook/chisel.git
git clone https://github.com/DerekSelander/LLDB.git

touch ~/.lldbinit
vim ~/.lldbinit

# ~/.lldbinit
command script import pwd/chisel/fblldb.py
command script import pwd/LLDB/lldb_commands/dslldb.py

lldb一般最常用的就是po(print object)

  • pviews 可以打印页面结构(报错需要引用UIKit expression @import UIKit
  • presponder 0x15feab460 可以打印响应链
  • methods 0x15feab460 可以打印属性和方法
  • search UIImageView 可以查找页面元素
    • b 可以用来打断点
    • po $x1 可以打印参数
    • pblock 可以打印block (逆向可以查看block里面的参数了)
(lldb) b [LoginManager requestDirectLoginInController:completion:failure:]
Breakpoint 1: where = recipe`-[LoginManager requestDirectLoginInController:completion:failure:] at LoginManager.m:93, address = 0x0000000100748044
(lldb) po $x3
<__NSGlobalBlock__: 0x102fa9300>
(lldb) pblock 0x102fa9300
Imp: 0x100311768    Signature: void ^(NSDictionary *, bool, bool);

配合MallocStackLogging环境变量 使用lldb.macosx.heap.py
位置/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/Python/lldb/macosx/heap.py
虽然表明OS X使用但是iOS也可以使用

  • 查看一个对象分配内存的堆栈(需要配合MallocStackLogging malloc_info -s)
  • 得到内存指定类的实例对象(objc_refs)
  • 得到一个内存地址所有被引用的地方(ptr_refs)
  • 搜索内存中指定的C字符串(cstr_refs)
(lldb) command script import ;;db.macosx.heap
"malloc_info", "ptr_refs", "cstr_refs", "find_variable", and "objc_refs" commands have been installed, use the "--help" options on these commands for detailed help.

相关文章

  • [译]用 LLDB 调试 Swift 代码

    [译]用 LLDB 调试 Swift 代码 [译]用 LLDB 调试 Swift 代码

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

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

  • iOS LLDB调试

    掌握以下lldb命令,够用. ### LLDB调试总结 eNSString*$str=@"test"...

  • iOS调试工具 - LLDB

    LLDB LLDB是 Xcode 默认的调试工具, 支持调试 c, c++, Objective-C.支持的调试平...

  • iOS之LLDB常用调试命令

    iOS之LLDB常用调试命令熟练使用 LLDB,让你调试事半功倍使用facebook开源的Chisel调试Home...

  • ptrace反调试

    一、iOS调试 iOS调试里面非常常见的就是LLDB调试,LLDB是Xcode自带的调试工具,既可以本地调试Mac...

  • LLDB 调试学习

    LLDB调试必看:与调试器共舞 - LLDB 的华尔兹Facebook/Chisel 安装chisel: Alte...

  • Xcode 调试之 LLDB

    LLDB 是 Xcode 中的默认调试器,支持调试 C、Objective-C、C++,用 LLDB 调试代码的好...

  • 知识点-LLDB调试命令

    lldb是我们平时在打断点时候,打印面板出现的。 lldb是Xcode自带的调试工具,下面是常用的lldb调试命令...

  • LLDB 使用

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

网友评论

    本文标题:LLDB调试

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