【发布时间】:2018-03-14 21:37:06
【问题描述】:
作为 lldb 练习,我尝试将 lldb 附加到 Apple 的 macOS TextEdit.app 并在其中设置符号断点。我可以在 Foundation 类中设置断点。但是在私人课程中,我似乎总是无法将断点解析到任何实际位置。为什么?
我知道交付的可执行文件会被剥离,但我也知道不能剥离 Objective-C 符号名称,并且阅读了几篇解释如何“破解”应用程序的旧文章,看起来它对他们有用,尽管数据库。当我在 TextEdit 可执行文件上运行 otool -ov 时,会显示所有私有符号及其地址。
示例
看看它如何很好地适用于 Foundation 类:
(lldb) breakpoint set -F "-[NSString initWithFormat:]"
Breakpoint 1: where = Foundation`-[NSString initWithFormat:], address = 0x00007fff2c0c29d0
(lldb) breakpoint set -r '\[NSString .*\]$'
Breakpoint 2: 139 locations.
但是当我在私有 Document 类中尝试相同的方法时,或者在我使用 Steve Nygard 的 class-dump 找到的其中一种方法中,它失败了:
(lldb) breakpoint set -F "-[Document validateMenuItem:]"
Breakpoint 3: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
(lldb) breakpoint set -r '\[Document .*\]$'
Breakpoint 4: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
【问题讨论】:
标签: objective-c macos reverse-engineering lldb