Skip to content

Commit

Permalink
adds encoding switch events to traces (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
thestr4ng3r committed Mar 8, 2022
1 parent 167a5e1 commit 36ae29a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/bap_traces/bap_trace_event_types.ml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,15 @@ module Modload = struct
} [@@deriving bin_io, compare, fields, sexp]
end

module Encoding = struct
type t = string [@@deriving bin_io, compare, sexp]
end

type 'a move = 'a Move.t [@@deriving bin_io, compare, sexp]
type chunk = Chunk.t [@@deriving bin_io, compare, sexp]
type syscall = Syscall.t [@@deriving bin_io, compare, sexp]
type exn = Exn.t [@@deriving bin_io, compare, sexp]
type call = Call.t [@@deriving bin_io, compare, sexp]
type return = Return.t [@@deriving bin_io, compare, sexp]
type modload = Modload.t [@@deriving bin_io, compare, sexp]
type encoding = Encoding.t [@@deriving bin_io, compare, sexp]
10 changes: 10 additions & 0 deletions lib/bap_traces/bap_trace_events.ml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ module Pc_update = struct
let pp = ppv "pc-update" Word.pp
end

module Encoding = struct
include Encoding
let pp = ppv "encoding" String.pp
end

let memory_load =
Value.Tag.register (module Load)
~name:"memory-load"
Expand Down Expand Up @@ -168,3 +173,8 @@ let modload =
Value.Tag.register (module Modload)
~name:"modload"
~uuid:"7f842d03-6c9f-4745-af39-002f468f7fc8"

let encoding =
Value.Tag.register (module Encoding)
~name:"encoding"
~uuid:"f7ba0979-c3a9-4509-ba14-01faf577d478"
3 changes: 3 additions & 0 deletions lib/bap_traces/bap_trace_events.mli
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,6 @@ val return : return tag

(** represent an executable module being loaded *)
val modload : modload tag

(** the encoding used for future instructions has changed *)
val encoding : encoding tag
11 changes: 11 additions & 0 deletions lib/bap_traces/bap_traces.mli
Original file line number Diff line number Diff line change
Expand Up @@ -357,13 +357,21 @@ module Std : sig
} [@@deriving bin_io, compare, fields, sexp]
end


(** change of encoding of instructions (e.g. switch to thumb) *)
module Encoding : sig
type t = string [@@deriving bin_io, compare, sexp]
end


type 'a move = 'a Move.t [@@deriving bin_io, compare, sexp]
type chunk = Chunk.t [@@deriving bin_io, compare, sexp]
type syscall = Syscall.t [@@deriving bin_io, compare, sexp]
type exn = Exn.t [@@deriving bin_io, compare, sexp]
type call = Call.t [@@deriving bin_io, compare, sexp]
type return = Return.t [@@deriving bin_io, compare, sexp]
type modload = Modload.t [@@deriving bin_io, compare, sexp]
type encoding = Encoding.t [@@deriving bin_io, compare, sexp]

(** Types of events. *)
module Event : sig
Expand Down Expand Up @@ -409,6 +417,9 @@ module Std : sig

(** a module (shared library) is dynamically linked into a host program. *)
val modload : modload tag

(** the encoding used for future instructions has changed *)
val encoding : encoding tag
end


Expand Down

0 comments on commit 36ae29a

Please sign in to comment.