use crate::arch::Arch;
use crate::target::Target;
use crate::target::TargetResult;
pub trait CatchSyscalls: Target {
fn enable_catch_syscalls(
&mut self,
filter: Option<SyscallNumbers<'_, <Self::Arch as Arch>::Usize>>,
) -> TargetResult<(), Self>;
fn disable_catch_syscalls(&mut self) -> TargetResult<(), Self>;
}
define_ext!(CatchSyscallsOps, CatchSyscalls);
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CatchSyscallPosition {
Entry,
Return,
}
pub struct SyscallNumbers<'a, U> {
pub(crate) inner: &'a mut dyn Iterator<Item = U>,
}
impl<U> Iterator for SyscallNumbers<'_, U> {
type Item = U;
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}