open source disassembler library recommended
Nick Clifton
nickc@redhat.com
Fri Aug 4 07:52:00 GMT 2017
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
More information about the Binutils
mailing list