Skip to content

Commit

Permalink
stores only code regions in the KB
Browse files Browse the repository at this point in the history
  • Loading branch information
ivg committed Nov 2, 2020
1 parent 3677778 commit d803b80
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/bap/bap_project.ml
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,23 @@ let union_memory m1 m2 =
Memmap.to_sequence m2 |> Seq.fold ~init:m1 ~f:(fun m1 (mem,v) ->
Memmap.add m1 mem v)

let with_filename spec target data code path =
let with_filename spec target _data code path =
let open KB.Syntax in
let width = Theory.Target.code_addr_size target in
let bias = query spec Image.Scheme.bias |> Option.map
~f:(fun x -> Bitvec.(int64 x mod modulus width)) in
KB.promising Theory.Label.unit ~promise:(fun label ->
KB.collect Theory.Label.addr label >>=? fun addr ->
let addr = Word.create addr width in
let memory = union_memory code data in
if Memmap.contains memory addr then
if Memmap.contains code addr then
Theory.Unit.for_file path >>= fun unit ->
KB.sequence [
KB.provide Image.Spec.slot unit spec;
KB.provide Theory.Unit.bias unit bias;
KB.provide Theory.Unit.target unit target;
KB.provide Image.Spec.slot unit spec;
KB.provide Theory.Unit.path unit (Some path);
KB.provide Memmap.slot unit memory;
KB.provide Memmap.slot unit code;
] >>| fun () ->
Some unit
else KB.return None)
Expand Down

0 comments on commit d803b80

Please sign in to comment.