在mac-osx中对g++创建的可执行文件进行拆解

Disassemble the executable created by g++ in mac osx

本文关键字:可执行文件 mac-osx 中对 g++ 创建      更新时间:2023-10-16

如何在Mac OSx上查看C++程序的可执行文件(例如a.out)的反汇编版本?

这并不是您所要求的,但g++ -S从源代码中生成程序集,并且可以预期它比反汇编版本更可读。

如果不能使用-S重新编译(例如,没有源代码),那么gdb可以像objdump --disassemble一样进行反汇编。取决于您安装了什么。

另请参阅:https://superuser.com/questions/206547/how-can-i-install-objdump-on-mac-os-x

查看otool。即otool -tv a.out

编辑:要添加到Tony的答案中,objdump还具有C++的名称映射,即

objdump -tC a.out(IIRC)

我之前给出了关于如何为darwin构建和安装binutils的答案。

相关文章: