def replay_to_nth_event(self, n: int) -> None:
        """
        Replay to the Nth event, skipping over stop events and ending on the nearest execution event.
        """
        t = self._btrace
        assert 0 <= n < t.get_num_events()

        until = t.get_nth_event(n)
        if until is None:
            _l.error("Could not seek to event %d", n)
            return

        if self._trace_dbg.single_step_range is None:
            step_region_addr, step_region_size = None, 1
        else:
            self._trace_dbg.single_step_range: tuple[int, int]
            step_region_addr, step_region_size = self._trace_dbg.single_step_range

        until = t.get_prev_exec_event(until, addr=step_region_addr, size=step_region_size)
        if until is None:
            _l.error("No execution event prior to event %d", n)
            return

        self._trace_dbg.state = t.replay(self._trace_dbg.state, until)
        self._on_state_change()

        Replay to the Nth event, skipping over stop events and ending on the nearest execution event.
        
angrmanagement/logic/debugger/bintrace.py