1 use crate::gdb::Emu;
2 use gdbstub::target;
3 use gdbstub::target::ext::catch_syscalls::SyscallNumbers;
4 
5 // This implementation is for illustrative purposes only. If the target doesn't
6 // support syscalls then there is no need to implement this extension
7 
8 impl target::ext::catch_syscalls::CatchSyscalls for Emu {
enable_catch_syscalls( &mut self, filter: Option<SyscallNumbers<'_, u32>>, ) -> target::TargetResult<(), Self>9     fn enable_catch_syscalls(
10         &mut self,
11         filter: Option<SyscallNumbers<'_, u32>>,
12     ) -> target::TargetResult<(), Self> {
13         match filter {
14             Some(numbers) => eprintln!(
15                 "Enabled catching syscalls: {:?}",
16                 numbers.collect::<Vec<u32>>()
17             ),
18             None => eprintln!("Enabled catching all syscalls"),
19         }
20         Ok(())
21     }
22 
disable_catch_syscalls(&mut self) -> target::TargetResult<(), Self>23     fn disable_catch_syscalls(&mut self) -> target::TargetResult<(), Self> {
24         eprintln!("Disabled catching syscalls");
25         Ok(())
26     }
27 }
28