Outra forma de disassemblar parte de um binário

Escontrei esta outra dica na Internet:

1. Create a empty C file:
$ touch a.c
2. Compile it:
$ gcc -c -o a.o a.c
3. File b.raw is your raw binary file. Add your binary as a section <raw>
to file a.o and remove section <.comment>:
$ objcopy –add-section raw=b.raw a.o
$ objcopy -R .comment a.o
4. And disassemble it:
$ objdump -D a.o

This works for i386 binutils. I test it also with binutils for NIOS and I
need change the flags of section <raw> before disassemble it.
Run this after point 3.
$ objcopy –set-section-flags raw=CONTENTS,ALLOC,LOAD,READONLY,CODE a.o

Mas ainda não sei se esta forma é melhor ou pior que a forma anterior.

Alguma idéia? Marcelo? Fernando?

Alan

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s