This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: open source disassembler library recommended


Hi Dongliang,

> could you guys recommend an open source disassembler library.
Well, since you have posted to the binutils list, I am definitely
going to recommend the libopcodes library.  To be honest though,
I do not know about other disassembler libraries, so there is 
nothing else that I could recommend.

> Originally I want to try libopcodes in the binutils, but it seems not
> easy to learn and modify.

True, but I suspect that this will happen with any disassembler library
that you encounter.

If you want to see some simple examples of how to use libopcodes to
disassemble an instruction, have a look at the simulator sources.  For
example have a look at <binutils/gdb sources>/sim/rx/trace.c.  The
function sim_disasm_one() prints out the disassembly of a single RX
instruction (along with various other info, like the source line number
and so on).  It uses the libopcodes function print_insn_rx() to do this.
You can use this code as a template for whatever it is that you want to do.

Note - although this example applies to the RX architecture, similar
code can be used for any architecture supported by the libopces library.

Cheers
  Nick



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]