@@ -952,25 +952,36 @@ and compile infos pc state instrs =
952952 (* Ignore allocation events (not very interesting) *)
953953 if debug_parser () then Format. eprintf " Ignored allocation event@." ;
954954 instrs
955- | ( { ev_kind = Event_pseudo | Event_after _; _ }
955+ | ( { ev_kind = Event_pseudo | Event_after _; ev_info = Event_return _; _ }
956956 , ((Let (_, (Apply _ | Prim _ )), _ ) as i ) :: rem ) ->
957+ (* Event after a call. If it is followed by another event,
958+ it may have been weaken to a pseudo-event but was kept
959+ for stack traces *)
957960 if debug_parser () then Format. eprintf " Added event across call@." ;
958961 push_event After source event (i :: push_event Before source event rem)
959962 | { ev_kind = Event_pseudo ; ev_info = Event_function ; _ } , [] ->
960963 (* At beginning of function *)
961964 if debug_parser () then Format. eprintf " Added event at function start@." ;
962965 push_event Before source event instrs
963- | { ev_kind = Event_after _ | Event_pseudo ; _ } , _ ->
964- if debug_parser () then Format. eprintf " Ignored useless event@." ;
965- (* Not interesting:
966- - before a throw instruction, but we already have an event
967- for the exception
968- - omitted else clause
969- *)
966+ | { ev_kind = Event_after _ | Event_pseudo ; ev_info = Event_return _ ; _ } , _ ->
967+ if debug_parser ()
968+ then
969+ Format. eprintf " Ignored useless event (beginning of a block after a call)@." ;
970970 instrs
971- | _ , _ ->
971+ | { ev_kind = Event_after _ ; ev_info = Event_other ; _ } , _ ->
972+ if debug_parser ()
973+ then Format. eprintf " Ignored useless event (before a raise)@." ;
974+ (* We already have an event for the exception. The
975+ compiler add these events for stack traces. *)
976+ instrs
977+ | { ev_kind = Event_before ; ev_info = Event_other ; _ }, _
978+ | { ev_kind = Event_before | Event_pseudo ; ev_info = Event_function ; _ } , _ ->
972979 if debug_parser () then Format. eprintf " added event@." ;
973- push_event Before source event instrs)
980+ push_event Before source event instrs
981+ | { ev_kind = Event_after _; ev_info = Event_function ; _ }, _
982+ | { ev_kind = Event_before ; ev_info = Event_return _ ; _ } , _ ->
983+ (* Nonsensical events *)
984+ assert false )
974985 in
975986
976987 if pc = infos.limit
0 commit comments