English 中文(简体)
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!)

最佳回答

To answer your second question, if the code has been compiled into a fat binary with both 64-bit and 32-bit, you can use otool -arch i386 -tv to disassemble the 32-bit slice of the binary; otool -arch x86_64 -tv will give you the 64-bit portion (on SnowLeopard, this is also the default behavior if no -arch flag is passed).

Also note that while otool doesn t support the Intel syntax, gdb (set disassembly-flavor intel) and XCode (Preferences -> Debugging -> Disassembly Style) do.

问题回答

(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

With Objdump you can disassemble with -d -M intel, and apparently -m can be used to specify the architecture.

For GDB, in your .gdbinit file, add:

set disassembly-flavor intel

then it will be the default syntax for gdb.

You can use A2I to translate from AT&T to Intel syntax: http://membres.lycos.fr/placr/a2i.html





相关问题
2 mysql instances in MAC

i recently switched to mac. first and foremost i installed xampp. then for django-python-mysql connectivity, i "somehow" ended up installing a seperate MySQL. now the seperate mysql installation is ...

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Controlling OSX windows

I m trying to control windows of a foreign OSX applications from my application. I d like to 1. move the windows on the screen 2. resize the windows on the screen 3. change the currently active window ...

Switching J2SE versions on Mac OS (SnowLeopard)

My current JDK on Mac OS (10.6) is set to 1.6 and I d like to switch to 1.5. A listing of /System/Library/Frameworks/JavaVM.framework/Versions/ shows: lrwxr-xr-x 1 root wheel 10 Nov 3 18:34 ...

Scrolling inside Vim in Mac s Terminal

I ve been googling around trying to figure out if it s possible to use my mouse wheel to scroll while inside Vim in Mac s Terminal, with no luck. It seems as if only X11 or iTerm support this. Before ...

export to MP3 from quicktime API

A question for Apple,QT programmers. Would like to know if it s possible to export a Movie object to MP3 using the QuickTime API. Preferably the ConvertMovieToFile function. I ve looked at ...

热门标签