gpt4 book ai didi

ios - GDB/LLDB 在指定模块/共享库的所有函数处中断

转载 作者:可可西里 更新时间:2023-11-01 17:13:15 26 4
gpt4 key购买 nike

lldb 中,我得到了help breakpoint set:

       -a <address-expression> ( --address <address-expression> )
Set the breakpoint at the specified address. If the address maps uniquely to a particular binary, then the address will be converted to a "file" address, so that the
breakpoint will track that binary+offset no matter where the binary eventually loads. Alternately, if you also specify the module - with the -s option - then the
address will be treated as a file address in that module, and resolved accordingly. Again, this will allow lldb to track that offset on subsequent reloads. The
module need not have been loaded at the time you specify this breakpoint, and will get resolved when the module is loaded.

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

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

现在我想在指定模块/dylib 的每个函数处设置断点,您可以在命令 image list -f 的结果中找到它们。

libobjc.A.dylibMyOwn.dylib为例。我尝试了以下命令但失败了:

(lldb) breakpoint set -r libobjc.A.dylib
Breakpoint 1: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.

(lldb) b +[ThunderManager load]
Breakpoint 2: where = MyOwn.dylib`+[ThunderManager load] +16 at ThunderManager.m:20, address = 0x000000010489f274

(lldb) breakpoint set -r MyOwn.dylib`*
Breakpoint 3: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.

我希望 lldb 在模块 libobjc.A.dylibMyOwn.dylib 或任何其他指定的已加载模块的所有功能处中断/共享库。 lldb如何设置断点?

最佳答案

(lldb) break set -r . -s libobjc.A.dylib

-s 选项将共享库作为其值,并将断点限制为指定的共享库。您可以多次指定 -s 选项以指定多个共享库以包含在断点搜索中。

-r 选项的值是一个正则表达式;如果符号名称与该表达式匹配,它将被包含在断点中。 . 匹配所有内容。

lldb 教程:

http://lldb.llvm.org/tutorial.html

首先是对 lldb 命令结构的描述,您可能会觉得有帮助。

关于ios - GDB/LLDB 在指定模块/共享库的所有函数处中断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44928511/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com