| 1 | //! A friendly wrapper around the Linux `ptrace(2)` system call. |
| 2 | //! |
| 3 | //! The `ptrace(2)` interface entails interpreting a series of `wait(2)` statuses. The context used |
| 4 | //! to interpret a status includes the attach options set on each tracee, previously-seen stops, |
| 5 | //! recent `ptrace` requests, and in some cases, extra event data that must be queried using |
| 6 | //! additional `ptrace` calls. |
| 7 | //! |
| 8 | //! Pete is meant to instead permit reasoning directly about ptrace-stops, as described in the |
| 9 | //! manual. We hide the lowest-level contextual bookkeeping required to disambiguate |
| 10 | //! [ptrace-stops](ptracer::Stop). Whenever we can, we avoid extraneous ptrace calls, deferring to |
| 11 | //! downstream tracers implemented on top of the library. For example, Pete can distinguish a |
| 12 | //! syscall-enter-stop and syscall-exit-stop, but does not _automatically_ query register state to |
| 13 | //! identify the specific syscall. |
| 14 | |
| 15 | #[macro_use] |
| 16 | pub mod error; |
| 17 | |
| 18 | pub mod ptracer; |
| 19 | |
| 20 | #[cfg(target_arch = "aarch64")] |
| 21 | pub mod aarch64; |
| 22 | |
| 23 | #[cfg(target_arch = "x86_64")] |
| 24 | pub mod x86; |
| 25 | |
| 26 | #[doc(inline)] |
| 27 | pub use error::Error; |
| 28 | |
| 29 | #[doc(inline)] |
| 30 | pub use ptracer::{Pid, Ptracer, Restart, Siginfo, Signal, Stop, Tracee}; |
| 31 | |
| 32 | #[cfg(target_arch = "x86_64")] |
| 33 | #[doc(inline)] |
| 34 | pub use ptracer::Registers; |