Skip to content

Commit

Permalink
hoists unit in the disassemble function
Browse files Browse the repository at this point in the history
The same justification - a single piece of memory always belong to the
same unit.
  • Loading branch information
ivg committed Oct 28, 2020
1 parent 7399f35 commit 342b991
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/bap_disasm/bap_disasm_driver.ml
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,13 @@ let switch encoding s =
| Error _ -> s
| Ok dis -> Dis.switch s dis


let disassemble ~code ~data ~funs debt base : Machine.state KB.t =
unit_for_mem base >>= fun unit ->
let rec next_encoding state current mem f =
let addr = Memory.min_addr mem in
KB.Object.scoped Theory.Program.cls @@ fun obj ->
KB.provide Theory.Label.addr obj (Some (Word.to_bitvec addr)) >>= fun () ->
KB.provide Theory.Label.unit obj unit >>= fun () ->
get_encoding obj >>= fun encoding ->
if Theory.Language.is_unknown encoding.coding
then if Theory.Language.is_unknown current.coding
Expand Down

0 comments on commit 342b991

Please sign in to comment.