11

Are there any ARM (or other non-x86) disassemblers that decompose an instruction into its component parts in a machine-friendly structure? Ideally it would be something like XED or distorm3, which disassemble into a structure and then provide an API for querying things like "Is this a call?" "Is this a conditional branch?" etc., or getting the operands of an instruction.

I found armstorm, but it currently only supports THUMB.

Edit: To clarify, I'm looking for something that can be called from within another program and hopefully has liberal licensing (GPL-compatible).

Brendan Dolan-Gavitt
  • 2,888
  • 2
  • 19
  • 37
  • For what it is worth I think it is something that will probably be added to ERESI in the near term they already have it for Intel and Sparc and are adding more ARM support. – cb88 Apr 18 '13 at 12:05

3 Answers3

11

DARM (GitHub) by Jurriaan Bremer is an ARMv7 disassembler written in C and is available under a 3-Clause BSD License.

Note: It currently does not support Thumb mode.

A simple example of using DARM could be as follows:

// The structure which will hold all the metadata about the disassembled instruction...
darm_t d;

// disassemble a 32bit opcode...
if( darm_armv7_disasm( &d, 0xE12FFF14 ) >= 0 )
{
    if( d.instr == I_BX )
    {
        // do something with a BX instructiuon...
    }

    // print the disassembled full instruction 
    darm_str_t str;
    if( darm_str( &d, &str) > 0 )
        printf( "%s\n", str.instr );
}
QAZ
  • 2,571
  • 22
  • 22
3

Yes, IDA Pro's SDK allows you to access instructions' component parts via the insn_t class (in ua.hpp).

Jason Geffner
  • 20,681
  • 1
  • 36
  • 75
1

A more up-to-date answer to this question would be to suggest Capstone library. I've used it for ARM disassembly and it's quite reliable. IMHO, It's the best open source library available.

The library is based on LLVM's TabelGen instruction descriptions. Therefore, its ISA support is as complete as LLVM.

Codoka
  • 403
  • 5
  • 7