10

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).

1
  • 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, 2013 at 12:05

3 Answers 3

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 );
}
1
  • This looks like what I was going for! I suppose I could even use both DARM and armstorm to get full support... Apr 16, 2013 at 17:05
3

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

2
  • 1
    That's excellent to know, but I'm looking for something that can be called from within another program and hopefully has liberal licensing. Apr 16, 2013 at 1:53
  • 3
    @BrendanDolan-Gavitt: perhaps stating that in the question is a good idea then?
    – 0xC0000022L
    Apr 17, 2013 at 4:51
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.