diff options
Diffstat (limited to 'ripple')
-rw-r--r-- | ripple/minitrace/src/main.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/ripple/minitrace/src/main.rs b/ripple/minitrace/src/main.rs index 7ba6f96..eaabad0 100644 --- a/ripple/minitrace/src/main.rs +++ b/ripple/minitrace/src/main.rs @@ -97,7 +97,7 @@ macro_rules! define_syscalls { (enum $SyscallEntry:ident { $(fn $syscall:ident ( $($arg:ident : $Arg:ty),* ) -> $Ret:ty = $nr:literal ;)* }) => { - #[derive(Debug, Copy, Clone)] + #[derive(Debug, Clone)] #[allow(non_camel_case_types)] // TODO(edef): re-enable dead_code lint when we start fully interpreting syscall args #[allow(dead_code)] @@ -278,7 +278,7 @@ define_syscalls! { } } -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Clone)] enum EntryExit { /// Process is about to enter a syscall Entry(SyscallEntry), @@ -336,12 +336,12 @@ fn main() -> Result<()> { } }; - syscall_state = Some(EntryExit::Entry(entry)); - - if !check_syscall(&process, entry) { + if !check_syscall(&process, &entry) { ptrace::kill(event_tid.as_pid())?; panic!("invalid syscall {entry:?}"); } + + syscall_state = Some(EntryExit::Entry(entry)); } (Some(EntryExit::Entry(entry)), WaitStatus::PtraceSyscall(event_tid)) => { let event_tid = Tid(event_tid.as_raw()); @@ -358,7 +358,9 @@ fn main() -> Result<()> { // TODO(edef): this only works for main thread break; } - _ => panic!("unknown status {status:?} with syscall_state = {syscall_state:?}"), + (syscall_state, status) => { + panic!("unknown status {status:?} with syscall_state = {syscall_state:?}") + } } } @@ -367,8 +369,8 @@ fn main() -> Result<()> { const AT_FDCWD: i32 = -100; -fn check_syscall(process: &Process, entry: SyscallEntry) -> bool { - match entry { +fn check_syscall(process: &Process, entry: &SyscallEntry) -> bool { + match *entry { SyscallEntry::mmap { addr: _, len: _, |