Day: June 22, 2006

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