BinaryAnalysisPlatform/bap — pull request #42 by rvantonder (2014-12-12 22:32:30+00:00)
Title: add bap-mc

This adds a first-pass of the `bap-mc` utility for disassembling hex strings, similar to `llvm-mc`.

`echo "0x48 0x83 0xec 0x08 0xe8 0x47 0xee 0xff 0xff 0x8b 0x40 0x10 0x48 0x83 0xc4 0x08 0xc3" | ./bap-mc --show-asm --show-inst`
```
(SUB64ri8 r:44 r:44 0x8) ; subq $0x8, %rsp
(CALL64pcrel32 -0x11b9) ; callq -0x11b9
(MOV32rm r:19 r:35 0x1 r:0 0x10 r:0) ; movl 0x10(%rax), %eax
(ADD64ri8 r:44 r:44 0x8) ; addq $0x8, %rsp
(RET) ; ret
```

`echo "e1 e2 50 50 00 11 a0 10 04 15 9f 00 10 1b ff 93 04 e1 a0 00 05 e2 8d d0" | bap-mc --show-inst --arch=arm --show-asm`
```
(SUBrsi r:10 r:66 r:67 0x2c 0x5 r:3 r:3) ; subspl lr, r0, r1, ror #5
(ADCrsi r:67 r:66 r:66 0x12 0x1 r:3 r:0) ; adcne r1, r0, r0, lsl #2
(ADDrsi r:67 r:11 r:70 0x52 0x0 r:3 r:3) ; addseq r1, pc, r4, lsl #10
(LDR_POST_IMM r:11 r:69 r:69 r:0 0x24f1b 0x0 r:3) ; ldreq pc, [r3], #3867
(STRi12 r:76 r:66 0xffffff1f 0x0 r:3) ; streq r10, [r0, #-225]
```

`echo "e1 e2 50 50 00 11 a0 10 04 15 9f 00 10 1b ff 93 04 e1 a0 00 05 e2 8d d0" | bap-mc --show-inst --arch=arm --show-asm --show-kinds --imm-format=dec --reg-format=name`
```
;; may_load, may_store
(SUBrsi LR R0 R1 44 5 CPSR CPSR) ; subspl lr, r0, r1, ror #5
;; may_load, may_store
(ADCrsi R1 R0 R0 18 1 CPSR nil) ; adcne r1, r0, r0, lsl #2
;; may_load, may_store
(ADDrsi R1 PC R4 82 0 CPSR CPSR) ; addseq r1, pc, r4, lsl #10
;; may_affect_control_flow, may_load, may_store
(LDR_POST_IMM PC R3 R3 nil 151323 0 CPSR) ; ldreq pc, [r3], #3867
;; may_load, may_store
(STRi12 R10 R0 4294967071 0 CPSR) ; streq r10, [r0, #-225]
```