How can I see the disassembled version of the executable (eg. a.out) of a C++ program on Mac OSx?
Asked
Active
Viewed 4,117 times
2 Answers
4
It's not exactly what you're asking for, but g++ -S
produces assembly from source code and can be expected to be more readable than a disassembled version.
If you can't recompile with -S
(e.g. no source code), then gdb
lets you disassemble, as does objdump --disassemble
. Depends what you've installed.
See also: https://superuser.com/questions/206547/how-can-i-install-objdump-on-mac-os-x

Community
- 1
- 1

Tony Delroy
- 102,968
- 15
- 177
- 252
-
+1: The binutils are pretty much superior to darwin's cctools. – Brett Hale Mar 01 '12 at 03:43
3
Look at otool
. i.e., otool -tv a.out
Edit: To add to Tony's answer, objdump
also has name demangling for C++, i.e.,
objdump -tC a.out
(IIRC)
I gave a previous answer on how to build and install the binutils for darwin.

Community
- 1
- 1

Brett Hale
- 21,653
- 2
- 61
- 90