Skip to content

Commit 7182e58

Browse files
authored
Update for current bap and core_kernel 0.14.1 (#12)
* Update for current bap and core_kernel 0.14.1 * Fix tracedump.ml
1 parent c9f9574 commit 7182e58

File tree

6 files changed

+715
-139
lines changed

6 files changed

+715
-139
lines changed

_oasis

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Library "bap-frames"
1212
Modules: Frame_arch, Frame_events, Frame_mach, Frame_piqi, Frame_reader, Frame_enum
1313
FindlibName: bap-frames
1414
BuildTools: piqi
15-
BuildDepends: bap, bap-traces, core_kernel, piqirun.pb, ppx_jane
15+
BuildDepends: bap, bap-traces, core_kernel, core_kernel.binary_packing, piqirun.pb, ppx_jane
1616
CompiledObject: best
1717
DataFiles: ../piqi/*.piqi
1818

_tags

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# OASIS_START
2-
# DO NOT EDIT (digest: c47fcdcf848520d4c6201f726377213a)
2+
# DO NOT EDIT (digest: 3601e9f0e79ce412a23bf65aba46dbe9)
33
# Ignore VCS directories, you can use the same kind of rule outside
44
# OASIS_START/STOP if you want to exclude directories that contains
55
# useless stuff for the build process
@@ -19,17 +19,38 @@ true: annot, bin_annot
1919
<lib/*.ml{,i,y}>: pkg_bap
2020
<lib/*.ml{,i,y}>: pkg_bap-traces
2121
<lib/*.ml{,i,y}>: pkg_core_kernel
22+
<lib/*.ml{,i,y}>: pkg_core_kernel.binary_packing
2223
<lib/*.ml{,i,y}>: pkg_piqirun.pb
23-
<lib/*.ml{,i,y}>: pkg_ppx_deriving.std
2424
<lib/*.ml{,i,y}>: pkg_ppx_jane
2525
# Library bap-plugin-frames
2626
"plugin/bap-plugin-frames.cmxs": use_bap-plugin-frames
2727
<plugin/*.ml{,i,y}>: pkg_bap
2828
<plugin/*.ml{,i,y}>: pkg_bap-traces
2929
<plugin/*.ml{,i,y}>: pkg_core_kernel
30+
<plugin/*.ml{,i,y}>: pkg_core_kernel.binary_packing
3031
<plugin/*.ml{,i,y}>: pkg_piqirun.pb
31-
<plugin/*.ml{,i,y}>: pkg_ppx_deriving.std
3232
<plugin/*.ml{,i,y}>: pkg_ppx_jane
3333
<plugin/*.ml{,i,y}>: use_bap-frames
34+
# Library frames-tests
35+
"test/frames-tests.cmxs": use_frames-tests
36+
# Executable run_frames_tests
37+
<test/run_frames_tests.{native,byte}>: pkg_bap
38+
<test/run_frames_tests.{native,byte}>: pkg_bap-traces
39+
<test/run_frames_tests.{native,byte}>: pkg_core_kernel
40+
<test/run_frames_tests.{native,byte}>: pkg_core_kernel.binary_packing
41+
<test/run_frames_tests.{native,byte}>: pkg_oUnit
42+
<test/run_frames_tests.{native,byte}>: pkg_piqirun.pb
43+
<test/run_frames_tests.{native,byte}>: pkg_ppx_jane
44+
<test/run_frames_tests.{native,byte}>: use_bap-frames
45+
<test/run_frames_tests.{native,byte}>: use_frames-tests
46+
<test/*.ml{,i,y}>: pkg_bap
47+
<test/*.ml{,i,y}>: pkg_bap-traces
48+
<test/*.ml{,i,y}>: pkg_core_kernel
49+
<test/*.ml{,i,y}>: pkg_core_kernel.binary_packing
50+
<test/*.ml{,i,y}>: pkg_oUnit
51+
<test/*.ml{,i,y}>: pkg_piqirun.pb
52+
<test/*.ml{,i,y}>: pkg_ppx_jane
53+
<test/*.ml{,i,y}>: use_bap-frames
54+
<test/*.ml{,i,y}>: use_frames-tests
3455
# OASIS_STOP
3556
<libtrace>: -traverse

myocamlbuild.ml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(* OASIS_START *)
2-
(* DO NOT EDIT (digest: 5b609f7614c506a9b5ee564a95aeb514) *)
2+
(* DO NOT EDIT (digest: 5654b884edf5267e4adea62d7ab38556) *)
33
module OASISGettext = struct
44
(* # 22 "src/oasis/OASISGettext.ml" *)
55

@@ -105,10 +105,7 @@ module OASISString = struct
105105
ok := false;
106106
incr str_idx
107107
done;
108-
if !what_idx = String.length what then
109-
true
110-
else
111-
false
108+
!what_idx = String.length what
112109

113110

114111
let strip_starts_with ~what str =
@@ -131,10 +128,7 @@ module OASISString = struct
131128
ok := false;
132129
decr str_idx
133130
done;
134-
if !what_idx = -1 then
135-
true
136-
else
137-
false
131+
!what_idx = -1
138132

139133

140134
let strip_ends_with ~what str =
@@ -177,6 +171,13 @@ module OASISString = struct
177171
else
178172
s
179173

174+
175+
let split str c =
176+
let idx = String.index str c in
177+
String.sub str 0 idx,
178+
String.sub str (idx + 1) (String.length str - idx - 1)
179+
180+
180181
end
181182

182183
module OASISUtils = struct
@@ -440,7 +441,7 @@ module OASISExpr = struct
440441
end
441442

442443

443-
# 443 "myocamlbuild.ml"
444+
# 444 "myocamlbuild.ml"
444445
module BaseEnvLight = struct
445446
(* # 22 "src/base/BaseEnvLight.ml" *)
446447

@@ -520,7 +521,7 @@ module BaseEnvLight = struct
520521
end
521522

522523

523-
# 523 "myocamlbuild.ml"
524+
# 524 "myocamlbuild.ml"
524525
module MyOCamlbuildFindlib = struct
525526
(* # 22 "src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" *)
526527

@@ -746,6 +747,9 @@ module MyOCamlbuildBase = struct
746747
(* # 110 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *)
747748

748749

750+
let env_filename = Pathname.basename BaseEnvLight.default_filename
751+
752+
749753
let dispatch_combine lst =
750754
fun e ->
751755
List.iter
@@ -878,23 +882,27 @@ module MyOCamlbuildBase = struct
878882
end
879883

880884

881-
# 881 "myocamlbuild.ml"
885+
# 885 "myocamlbuild.ml"
882886
open Ocamlbuild_plugin;;
883887
let package_default =
884888
{
885889
MyOCamlbuildBase.lib_ocaml =
886-
[("bap-frames", ["lib"], []); ("bap-plugin-frames", ["plugin"], [])];
890+
[
891+
("bap-frames", ["lib"], []);
892+
("bap-plugin-frames", ["plugin"], []);
893+
("frames-tests", ["test"], [])
894+
];
887895
lib_c = [];
888896
flags = [];
889-
includes = [("plugin", ["lib"])]
897+
includes = [("test", ["lib"]); ("plugin", ["lib"])]
890898
}
891899
;;
892900

893901
let conf = {MyOCamlbuildFindlib.no_automatic_syntax = false}
894902

895903
let dispatch_default = MyOCamlbuildBase.dispatch_default conf package_default;;
896904

897-
# 898 "myocamlbuild.ml"
905+
# 906 "myocamlbuild.ml"
898906
(* OASIS_STOP *)
899907
let oasis_env =
900908
BaseEnvLight.load

plugin/frame_trace_plugin.ml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ let create_frame_reader uri =
1313
val mutable tid = None
1414
method switch id' =
1515
match tid with
16-
| Some id when id = id' -> false
16+
| Some id when Int64.equal id id' -> false
1717
| _ -> tid <- Some id'; true
1818
end
1919

@@ -48,7 +48,9 @@ module Frame_proto : Trace.P = struct
4848
List.exists ~f:(fun same -> same tag) checkers
4949

5050
let probe uri =
51-
Uri.scheme uri = Some "file" &&
51+
(match Uri.scheme uri with
52+
| Some s -> String.equal s "file"
53+
| None -> false) &&
5254
Filename.check_suffix (Uri.path uri) ".frames"
5355
end
5456

@@ -57,7 +59,7 @@ let build_reader tool uri id =
5759
let reader = create_frame_reader uri in
5860
Trace.Reader.{ tool; meta = reader#meta; next = fun () -> reader#next } in
5961
try Ok (build ()) with
60-
| Unix.Unix_error (err, _, _) -> Result.fail (`System_error err)
62+
| Caml_unix.Unix_error (err, _, _) -> Result.fail (`System_error err)
6163
| exn -> Result.fail (`Protocol_error (Error.of_exn exn))
6264

6365
let () =

0 commit comments

Comments
 (0)