aboutsummaryrefslogtreecommitdiff
path: root/examples/armv4t/gdb/catch_syscalls.rs
blob: 63686f1342a4523715aa734e49064f668fcbe8c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use gdbstub::target;
use gdbstub::target::ext::catch_syscalls::SyscallNumbers;

use crate::gdb::Emu;

// This implementation is for illustrative purposes only. If the target doesn't
// support syscalls then there is no need to implement this extension

impl target::ext::catch_syscalls::CatchSyscalls for Emu {
    fn enable_catch_syscalls(
        &mut self,
        filter: Option<SyscallNumbers<'_, u32>>,
    ) -> target::TargetResult<(), Self> {
        match filter {
            Some(numbers) => eprintln!(
                "Enabled catching syscalls: {:?}",
                numbers.collect::<Vec<u32>>()
            ),
            None => eprintln!("Enabled catching all syscalls"),
        }
        Ok(())
    }

    fn disable_catch_syscalls(&mut self) -> target::TargetResult<(), Self> {
        eprintln!("Disabled catching syscalls");
        Ok(())
    }
}