views:

172

answers:

3

Hi,

I have a C array that contains binary x86_64 machine code, which I need to convert to assembly code on a Linux machine. I have no problem in converting the C array to a binary executable, but can't find the utility to convert it to asm code.

Any ideas?

Thanks!

+3  A: 

You are probably looking for a disassembler. A disassembler takes machine code (either from an executable, or from an object file) and turns it back into human-readable assembly language. If that's what you need, have a look at this list of disassemblers for Linux.


Some disassemblers that aren't listed there:

  • IDA Pro: Apparently one of the most powerful disassemblers. Probably overkill for your purposes.

  • ndisasm (accompanies the nasm assembler)

stakx
+2  A: 

You need a disassembler. I personally use NDISASM from the NASM package.

Simon
A: 

If you can afford to link to GPL code, you could link to libbfd and have it disassemble the array for you. Do this if you can't afford to spawn a new process that does it.

Bernd Jendrissek