Re: disassembling machine code
On Fri, Mar 21, 2008 at 01:39:09PM +0100, bounce-debian-user=Mirko.Parthey=Informatik.TU-Chemnitz.DE@lists.debian.org wrote:
> On Wed, Mar 19, 2008 at 12:26:19PM -0700, PETER EASTHOPE wrote:
> > I have these 5 bytes of machine code to
> > disassemble.
> >
> > b8 12 00 cd 10
> >
> > I've looked at gdb and objdump. Appears they
> > need a complete object file. Someone please
> > give a clue.
>
> Write the machine code to a file:
> $ perl -e 'print pack "H*", "b81200cd10";' > /tmp/binfile
> $ hd /tmp/binfile
> 00000000 b8 12 00 cd 10 |¸..Í.|
> 00000005
>
> Then use objdump, specifying the object file format as raw.
> Because the raw file has no metadata, you need to give the CPU
> architecture as well.
>
> $ objdump -m i386 -b binary -D /tmp/binfile
Sorry, I meant to write i8086 instead of i386:
$ objdump -m i8086 -b binary -D /tmp/binfile
because because this looks like 16 bit x86 code to me.
You should have told us the CPU architecture in the first place...
Regards,
Mirko
Reply to: