用于检查 iOS 编译的 ARM 反汇编器/交叉编译器
任何人都可以推荐:
- 一个在 Windows 或 MacOS 中运行的 ARM 反汇编程序,它可以理想地理解 MacOS 中 iOS 使用的可执行格式
- ,一种直接从命令行调用 XCode 安装的交叉编译 GCC 的方法(这样我可以在一个小测试文件上运行它并要求汇编输出)。
基本上,我有兴趣了解 XCode/gcc 如何为 ARM/iOS 编译某些内容,以帮助我进行优化。正如你所看到的,虽然我有 Windows 和 Linux 背景,但我本质上并不是 Mac 专家,所以我不太熟悉 XCode 在哪里安装其所有 gubbinry 或 iOS 使用的任何二进制格式的来龙去脉。
我并不特别关心我是否必须在 Mac OS 或 Windows 下进行“反汇编”,但我试图避免的是安装一个全新的 GCC 副本,配置为交叉编译到 ARM,因为 XCode 大概有一个完美的良好的安装已经坐在某处...任何帮助表示赞赏。
Can anyone recommend either:
- an ARM disassembler that runs in either Windows or MacOS and which can ideally understand the executable format used by iOS
- within MacOS, a way to call the cross-compiling GCC installed by XCode directly from the command line (so that I can run it on a small test file and ask for assembly output).
Basically, I'm interested in seeing how certain things get compiled for ARM/iOS by XCode/gcc to help me with optimisation. As you can see, although I have both a Windows and Linux background, I'm not fundamentally a Mac specialist so I'm not too familiar with e.g. where XCode intsalls all its gubbinry or the ins and outs of whatever binary format iOS uses.
I don't particularly care whether I have to do the "disassembly" under Mac OS or Windows, but what I was trying to avoid is installing a brand new copy of GCC configured to cross-compile to ARM, as XCode presumably has a perfectly good installation already sitting there somewhere... Any help appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您始终可以使用 otool 反汇编程序。这是相当基本的,但可以完成工作。
IDA Pro可以反汇编iOS中使用的ARM Mach-O文件。使用它(在我的偏见看来)比查看死列表有更好的体验。您可以使用演示版查看它的工作原理。
免责声明:我为 Hex-Rays 工作。
You can always use otool disassembler. It's rather basic but does the job.
IDA Pro can disassemble ARM Mach-O files used in iOS. Using it is (in my biased opinion) much better experience that looking at the dead listing. You can check how it works with the demo version.
Disclaimer: I work for Hex-Rays.
。我可以建议您使用 LLVM。如果使用默认选项构建,
llvm-objdump
将反汇编 ARM。另外,看起来像 http://developer.apple.com/technologies/tools/whats -new.html Apple 在 iOS SDK 中使用 LLVM 工具链。
I can suggest you a LLVM. If it is built with default options,
llvm-objdump
will disassemble ARM.Also, looks like http://developer.apple.com/technologies/tools/whats-new.html Apple is using LLVM toolchain in iOS SDK.
Xcode 中已经内置了 ARM 交叉编译工具链。您可以使用 Xcode 中内置的 gdb 调试器支持在源代码和 ASM 级别调试 iOS 应用程序。例如,打开您的 iOS 应用程序并选择设备和调试。然后在源代码行设置断点并运行程序,直到命中断点。现在从菜单中选择“运行 -> 调试器”。当调试器显示时,选择“运行 -> 调试器显示 -> 源代码和反汇编”,您将在右侧看到一个窗口,其中显示从源代码生成的 ARM asm 代码。您可以使用按钮一次单步执行一行源代码。如果您想一次单步执行一个 ARM asm 指令,请打开 gdb 控制台并使用“stepi”指令(键入一次,然后按 Enter 键重复)。
There is already an ARM cross compile toolchain built into Xcode. You can debug your iOS applications at the source and ASM level with the gdb debugger support already built into Xcode. For example, open your iOS app and select Device and Debug. Then set a breakpoint at a source line and run your program until the breakpoint is hit. Now select "Run -> Debugger" from the menu. When the debugger is showing, select "Run -> Debugger Display -> Source and Disassembly" and you will see a window on the right side that shows the ARM asm code that was generated from your source code. You can step through the code a source line at a time using the buttons. If you want to step one ARM asm instruction at a time, open up the gdb console and use the "stepi" instruction (type it once, then just hit enter to repeat).
看看Hopper。与 IDA 相比,它非常便宜(尽管没有那么强大),而且最近的版本可以处理 ARM。
Take a look at Hopper. It's darn cheap compared to IDA (though not as powerful) and the recent versions can handle ARM.
将此脚本用于为 iphone 编译的 gcc:
来源:newosxbook.com
Use this script for a gcc that compiles for iphone:
Source: newosxbook.com
看看 Radare2 它是一个开源工具,正在不断提高其功能集,并且已经支持 ARM 反汇编。
Take a look at Radare2 it is an open Source tool that is rising it's Feature-Set constantly and already supports ARM disassembling.