1 //! Support for reverse debugging targets.
2 
3 use crate::target::Target;
4 
5 /// Target Extension - Reverse continue for targets.
6 pub trait ReverseCont<Tid>: Target
7 where
8     Tid: crate::is_valid_tid::IsValidTid,
9 {
10     /// [Reverse continue] the target.
11     ///
12     /// Reverse continue allows the target to run backwards until it reaches the
13     /// end of the replay log.
14     ///
15     /// [Reverse continue]: https://sourceware.org/gdb/current/onlinedocs/gdb/Reverse-Execution.html
reverse_cont(&mut self) -> Result<(), Self::Error>16     fn reverse_cont(&mut self) -> Result<(), Self::Error>;
17 }
18 
19 /// See [`ReverseCont`]
20 pub type ReverseContOps<'a, Tid, T> =
21     &'a mut dyn ReverseCont<Tid, Arch = <T as Target>::Arch, Error = <T as Target>::Error>;
22 
23 /// Target Extension - Reverse stepping for targets.
24 pub trait ReverseStep<Tid>: Target
25 where
26     Tid: crate::is_valid_tid::IsValidTid,
27 {
28     /// [Reverse step] the specified `Tid`.
29     ///
30     /// On single threaded targets, `tid` is set to `()` and can be ignored.
31     ///
32     /// Reverse stepping allows the target to run backwards by one "step" -
33     /// typically a single instruction.
34     ///
35     /// [Reverse step]: https://sourceware.org/gdb/current/onlinedocs/gdb/Reverse-Execution.html
reverse_step(&mut self, tid: Tid) -> Result<(), Self::Error>36     fn reverse_step(&mut self, tid: Tid) -> Result<(), Self::Error>;
37 }
38 
39 /// See [`ReverseStep`]
40 pub type ReverseStepOps<'a, Tid, T> =
41     &'a mut dyn ReverseStep<Tid, Arch = <T as Target>::Arch, Error = <T as Target>::Error>;
42 
43 /// Describes the point reached in a replay log (used alongside
44 /// [`BaseStopReason::ReplayLog`](crate::stub::BaseStopReason::ReplayLog))
45 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
46 pub enum ReplayLogPosition {
47     /// Reached the beginning of the replay log.
48     Begin,
49     /// Reached the end of the replay log.
50     End,
51 }
52