Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
06ee098
Update LLVM backend to work with version 12
bmourad01 Oct 23, 2021
c3f1f26
Merge branch 'BinaryAnalysisPlatform:master' into master
bmourad01 Nov 3, 2021
3b8b06c
Merge branch 'BinaryAnalysisPlatform:master' into master
bmourad01 Nov 4, 2021
53677fc
Merge branch 'BinaryAnalysisPlatform:master' into master
bmourad01 Nov 6, 2021
4695b07
Merge branch 'BinaryAnalysisPlatform:master' into master
bmourad01 Nov 13, 2021
c6c89c1
Merge branch 'BinaryAnalysisPlatform:master' into master
bmourad01 Nov 16, 2021
a1fb592
Merge branch 'BinaryAnalysisPlatform:master' into master
bmourad01 Nov 19, 2021
fa3c6da
Merge branch 'BinaryAnalysisPlatform:master' into master
bmourad01 Nov 20, 2021
d5dc07f
Merge branch 'BinaryAnalysisPlatform:master' into master
bmourad01 Nov 25, 2021
896a34d
Merge branch 'BinaryAnalysisPlatform:master' into master
bmourad01 Dec 1, 2021
3cce21b
Merge branch 'BinaryAnalysisPlatform:master' into master
bmourad01 Dec 2, 2021
96874e4
Merge branch 'BinaryAnalysisPlatform:master' into master
bmourad01 Dec 3, 2021
c25c801
Merge branch 'BinaryAnalysisPlatform:master' into master
bmourad01 Dec 3, 2021
cf3352a
Merge branch 'BinaryAnalysisPlatform:master' into master
bmourad01 Dec 8, 2021
9cc0b14
Merge branch 'BinaryAnalysisPlatform:master' into master
bmourad01 Dec 8, 2021
5a38191
Merge branch 'BinaryAnalysisPlatform:master' into master
bmourad01 Dec 9, 2021
542ba10
Merge branch 'BinaryAnalysisPlatform:master' into master
bmourad01 Dec 9, 2021
59e5358
Adds `label-bytes` slot to the `Theory.program` objects
Dec 17, 2021
f187e83
Runs `make indent`
Dec 17, 2021
6f4ee42
Uses a nicer `inspect` function for `bytes` domain
Dec 17, 2021
14e4b38
Merge branch 'BinaryAnalysisPlatform:master' into master
bmourad01 Jan 5, 2022
ba8827f
Merge branch 'master' of https://github.com/bmourad01/bap into adds-l…
Jan 5, 2022
1ec0c57
Moves the property to the `Theory.Semantics.cls`
Jan 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/bap_core_theory/bap_core_theory.mli
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,9 @@ module Theory : sig
@since 2.3.0 *)
val value : (cls, unit Value.t) Knowledge.slot

(** the memory contents of the program. *)
val code : (cls, string option) Knowledge.slot

include Knowledge.Value.S with type t := t
end

Expand Down Expand Up @@ -1798,7 +1801,6 @@ module Theory : sig
(** the address of the label. *)
val addr : (program, Bitvec.t option) KB.slot


(** the linkage name of the label *)
val name : (program, string option) KB.slot

Expand Down
13 changes: 13 additions & 0 deletions lib/bap_core_theory/bap_core_theory_program.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ let word = Knowledge.Domain.optional "word"
~equal:Bitvec.equal
~inspect:Bitvec_sexp.sexp_of_t

let hexcode = Knowledge.Domain.optional "hexcode"
~equal:String.equal
~inspect:(Fn.compose sexp_of_string @@
String.concat_map ~sep:" " ~f:(fun c ->
Format.sprintf "%02x" @@ Char.to_int c))

let name = Knowledge.Domain.optional "name"
~equal:String.equal
~inspect:sexp_of_string
Expand Down Expand Up @@ -296,6 +302,13 @@ module Semantics = struct
~persistent:(Knowledge.Persistent.of_binable (module Value.Top))
~public:true
~desc:"the program semantics"
let code = Knowledge.Class.property ~package cls "insn-code" hexcode
~persistent:(Knowledge.Persistent.of_binable (module struct
type t = string option
[@@deriving bin_io]
end))
~public:true
~desc:"the program memory contents"

include Self
end
Expand Down
1 change: 1 addition & 0 deletions lib/bap_core_theory/bap_core_theory_program.mli
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module Semantics : sig
val cls : (cls, unit Effect.sort) Knowledge.cls
val slot : (program, t) Knowledge.slot
val value : (cls, unit Value.t) Knowledge.slot
val code : (cls, string option) Knowledge.slot
include Knowledge.Value.S with type t := t
end

Expand Down
8 changes: 8 additions & 0 deletions lib/bap_image/bap_memory.ml
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,14 @@ let () =
KB.collect slot label >>|? fun mem ->
Some (Addr.to_bitvec (min_addr mem))

let () =
let open KB.Syntax in
KB.promise Theory.Semantics.slot @@ fun label ->
let+ {data; off; size} = label-->?slot in
let empty = KB.Value.empty Theory.Semantics.cls in
KB.Value.put Theory.Semantics.code empty @@
Some (Bigstring.to_string ~pos:off ~len:size data)

let () =
let open KB.Rule in
declare ~package:"bap" "addr-of-mem" |>
Expand Down