Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disassemble into x86_64 on OSX10.6 (But with _Intel_ Syntax)

I know of otool -tv, but I would much rather use the Intel syntax rather than AT&Ts, mainly to easily follow along in a book and not have to look over thousands of %'s and $'s.

I'd also appreciate any tips to where I might find gdb's config file.

EDIT: I forgot: I'm running a 64bit processor, but was wondering if it would be possible to also disassemble into 32 bit assembly? Not only that, but does OSX's gdb's list command work differently than the standard GNU version?

Thanks so much!

(Also, if you have any idea where I might find a little disassembler from C -> MIPS, that'd be very fun to play with. But not necessary!)

like image 859
Isaac Avatar asked Nov 13 '09 08:11

Isaac


1 Answers

(I know this is an old question, but I want to provide an updated answer for people who come here through search engines).

On recent versions of macOS (I'm running 10.14.5), an objdump command is available, which is based on LLVM and is not the one from the GNU project. It offers a (hidden) option to disassemble using Intel syntax. For example, /bin/echo can be disassembled as follows:

objdump -disassemble -x86-asm-syntax=intel /bin/echo
like image 175
Michel Schinz Avatar answered Oct 17 '22 17:10

Michel Schinz