ThoughtGang / opdis

libopcodes-based disassembler
GNU General Public License v2.0
35 stars 10 forks source link

ARM support #8

Open mkfs opened 11 years ago

mkfs commented 11 years ago

Add ARM support to Opdis.

This will require two enhancements:

Unfortunately, I cannot provide a target date for this. If I can work it in to the current project (deadline: June) I will, otherwise it will have to wait for summer.

mkfs commented 10 years ago

I have created a library that wraps multiple installed version of binutils: https://github.com/mkfs/binutils_mgr

Integrating this with opdis will take some doing. The binutils_mgr library uses dlopen to load and register the various binutils versions specified by the user. This kinda conflicts with how opdis does things -- opdis was intended to be a front-end to whatever the installed binutils is.

mkfs commented 10 years ago

Attempted to add support for a user-specified binutils dir on the command line. Unfortunately, this requires rewriting most of binutils-mgr, so I scrapped it. Requiring binutils-mgr is a possibility, but it will break OS X and Win32 builds (and probably FreeBSD as well), as I only bothered to write the dynamic linking code for Linux.

People using the opdis library can do the following:

  1. dynamically load the desired libopcodes shared library
  2. resolve the "init_disassemble_info" symbol
  3. resolve whatever "print_insn" routine is to be called
  4. invoke init_disassemble_info() on opdis_info_t.config
  5. use opdis_set_arch to set the print_insn function, or set opdis_info_t.disassembler directly

Obviously, tools using BFD will have to load the appropriate libbfd shared library, call its bfd_init(), and usr its functions to create a struct bfd* for passing to opdis.

The binutils-mgr project can be used for this. Example forthcoming.