6
6
*)
7
7
open Core_kernel.Std
8
8
9
- exception TraceException of string
9
+ exception Trace_exception of string
10
10
11
11
type frame = Frame_piqi .frame
12
12
@@ -125,7 +125,7 @@ class writer ?(arch=default_arch) ?(machine=default_machine) ?(frames_per_toc_en
125
125
let s = Frame_piqi_ext. gen_frame frame `pb in
126
126
let len = Int64. of_int (String. length s) in
127
127
if len < = 0L then
128
- raise (TraceException " Attempt to add zero-length frame to trace" );
128
+ raise (Trace_exception " Attempt to add zero-length frame to trace" );
129
129
130
130
(* Write the length in binary *)
131
131
let () = write_i64 oc len in
@@ -139,7 +139,7 @@ class writer ?(arch=default_arch) ?(machine=default_machine) ?(frames_per_toc_en
139
139
= Out_channel. pos oc);
140
140
141
141
method finish =
142
- if is_finished then raise (TraceException " finish called twice" );
142
+ if is_finished then raise (Trace_exception " finish called twice" );
143
143
144
144
let toc_offset = Out_channel. pos oc in
145
145
(* Make sure the toc is the right size. *)
@@ -181,16 +181,16 @@ class reader filename =
181
181
let ic = In_channel. create ~binary: true filename in
182
182
(* Verify magic number *)
183
183
let () = if read_i64 ic <> magic_number then
184
- raise (TraceException " Magic number is incorrect" ) in
184
+ raise (Trace_exception " Magic number is incorrect" ) in
185
185
(* Trace version *)
186
186
let trace_version = read_i64 ic in
187
187
let () = if trace_version < lowest_supported_version ||
188
188
trace_version > highest_supported_version then
189
- raise (TraceException " Unsupported trace version" ) in
189
+ raise (Trace_exception " Unsupported trace version" ) in
190
190
(* Read arch type, break type safety *)
191
191
let archnum = read_i64 ic in
192
192
let () = if not (archnum < (Int64. of_int (Obj. magic Arch_bfd. Bfd_arch_last ))) then
193
- raise (TraceException " Invalid architecture" ) in
193
+ raise (Trace_exception " Invalid architecture" ) in
194
194
let arch : Arch_bfd.bfd_architecture = Obj. magic (Int64. to_int archnum) in
195
195
let machine = read_i64 ic in
196
196
(* Read number of trace frames. *)
@@ -250,7 +250,7 @@ class reader filename =
250
250
let () = self#check_end_of_trace " get_frame on non-existant frame" in
251
251
let frame_len = read_i64 ic in
252
252
if (frame_len < = 0L ) then
253
- raise (TraceException (Printf. sprintf " Read zero-length frame at offset %#Lx" (LargeFile. pos_in ic)));
253
+ raise (Trace_exception (Printf. sprintf " Read zero-length frame at offset %#Lx" (LargeFile. pos_in ic)));
254
254
let buf = String. create (Int64. to_int_exn frame_len) in
255
255
(* Read the frame info buf. *)
256
256
match In_channel. really_input ic ~buf: buf ~pos: 0 ~len: (Int64. to_int_exn frame_len) with
@@ -277,11 +277,11 @@ class reader filename =
277
277
278
278
method private check_end_of_trace_num frame_num msg =
279
279
if self#end_of_trace_num frame_num then
280
- raise (TraceException msg)
280
+ raise (Trace_exception msg)
281
281
282
282
method private check_end_of_trace msg =
283
283
if self#end_of_trace then
284
- raise (TraceException msg)
284
+ raise (Trace_exception msg)
285
285
286
286
initializer self#seek 0L
287
287
end
0 commit comments