Skip to content

Commit

Permalink
fixes the low-level Disasm_expert.Basic.create function (#1420)
Browse files Browse the repository at this point in the history
It was creating an incorrect encoding for instructions, namely
`bap:llvm-armv7-` (notice the dangling dash in the end).

Also affects the `Disasm_expert.Basic.with_disasm` function.
  • Loading branch information
ivg authored Feb 3, 2022
1 parent 6c1d4c4 commit bf1a107
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/bap_disasm/bap_disasm_basic.ml
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,9 @@ let lookup target encoding =
| Some create -> create target

let create ?(debug_level=0) ?(cpu="") ?(attrs="") ?(backend="llvm") triple =
let name = String.concat ~sep:"-" [backend; triple; cpu] ^ attrs in
let parts = [backend; triple; cpu] |>
List.filter ~f:(Fn.non String.is_empty) in
let name = String.concat ~sep:"-" parts ^ attrs in
match Hashtbl.find disassemblers name with
| Some d ->
d.users <- d.users + 1;
Expand Down

0 comments on commit bf1a107

Please sign in to comment.