@@ -144,6 +144,7 @@ type 'thread inner =
144
144
; trace : (module Trace with type thread = 'thread )
145
145
; annotate_inferred_start_times : bool
146
146
; mutable in_filtered_region : bool
147
+ ; suppressed_errors : Hash_set .M (Source_code_position ).t
147
148
}
148
149
149
150
type t = T : 'thread inner -> t
@@ -154,6 +155,13 @@ let sexp_of_inner inner =
154
155
155
156
let sexp_of_t (T inner ) = sexp_of_inner inner
156
157
158
+ let eprint_s_once t here sexp =
159
+ if not (Hash_set. mem t.suppressed_errors here)
160
+ then (
161
+ Hash_set. add t.suppressed_errors here;
162
+ eprint_s sexp)
163
+ ;;
164
+
157
165
let allocate_pid (type thread ) (t : thread inner ) ~name : int =
158
166
let module T = (val t.trace) in
159
167
T. allocate_pid ~name
@@ -312,6 +320,7 @@ let create_expert
312
320
; trace
313
321
; annotate_inferred_start_times
314
322
; in_filtered_region = true
323
+ ; suppressed_errors = Hash_set. create (module Source_code_position )
315
324
}
316
325
in
317
326
write_hits t hits;
@@ -831,12 +840,20 @@ end = struct
831
840
some data. *)
832
841
if Callstack. depth thread_info.callstack <> 1
833
842
then
834
- eprintf
835
- " Warning: expected callstack depth to be the same going into a [try] \
836
- block as when leaving it, but it wasn't (off by %d). Did Intel \
837
- Processor Trace drop some data? Will attempt to recover.\n \
838
- %!"
839
- (Callstack. depth thread_info.callstack - 1 )
843
+ (* Conditional on happening once, this is likely to happen again... don't
844
+ spam the user's terminal. *)
845
+ eprint_s_once
846
+ t
847
+ [% here]
848
+ [% message
849
+ " WARNING: expected callstack depth to be the same going into a \
850
+ [try] block as when leaving it, but it wasn't. Did Intel Processor \
851
+ Trace drop some data? Will attempt to recover. Further errors will \
852
+ be suppressed.\n "
853
+ ~depth: (Callstack. depth thread_info.callstack - 1 : int )
854
+ (src : Event.Location.t )
855
+ (dst : Event.Location.t )
856
+ (last_known_instruction_pointer : Int64.Hex.t )]
840
857
else (
841
858
(* Only pop the exception callstack if we're at the same callstack
842
859
depth as we were when we saw [Pushtrap]. This should let us recover
0 commit comments