Reputation: 1358
how can I write just a simple disassembler for linux from scratches? Are there any libs to use? I need something that "just works".
Upvotes: 1
Views: 6964
Reputation: 11
You can use libbfd and libopcodes, which are libraries distributed as part of binutils.
http://www.gnu.org/software/binutils/
As an example of the power of these libraries, check out the Online Disassembler (ODA).
http://www.onlinedisassembler.com
ODA supports a myriad of architectures and provides a basic feature set. You can enter binary data in the Live View and watch the disassembly appear as you type, or you can upload a file to disassemble. A nice feature of this site is that you can share the link to the disassembly with others.
Upvotes: 1
Reputation: 2984
You can take a look at the code of ERESI
The ERESI Reverse Engineering Software Interface is a multi-architecture binary analysis framework with a tailored domain specific language for reverse engineering and program manipulation.
Upvotes: 0
Reputation: 3717
Instead of writing one, try Objdump.
Based on your comment, and your desire to implement from scratch, I take it this is a school project. You could get the source for objdump and see what libraries and techniques it uses. The BFD library might be of use.
Upvotes: 8
Reputation: 143925
you have to understand the ELF file format first. Then, you can start processing the various sections of code according to the opcodes of your architecture.
Upvotes: 5