diff options
Diffstat (limited to 'ripple/minitrace')
-rw-r--r-- | ripple/minitrace/src/main.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/ripple/minitrace/src/main.rs b/ripple/minitrace/src/main.rs index 7fa5ec7..523cc09 100644 --- a/ripple/minitrace/src/main.rs +++ b/ripple/minitrace/src/main.rs @@ -94,27 +94,27 @@ impl Process { } macro_rules! define_syscalls { - (enum $enum:ident { - $(fn $id:ident ( $($arg_id:ident : $arg_ty:ty),* ) -> $ret:ty = $nr:literal ;)* + (enum $SyscallEntry:ident { + $(fn $syscall:ident ( $($arg:ident : $Arg:ty),* ) -> $Ret:ty = $nr:literal ;)* }) => { #[derive(Debug, Copy, Clone)] #[allow(non_camel_case_types)] // TODO(edef): re-enable dead_code lint when we start fully interpreting syscall args #[allow(dead_code)] - enum $enum { - $($id { - $($arg_id : $arg_ty),* + enum $SyscallEntry { + $($syscall { + $($arg : $Arg),* }),* } - impl $enum { - fn from_regs(regs: libc::user_regs_struct) -> Result<$enum> { + impl $SyscallEntry { + fn from_regs(regs: libc::user_regs_struct) -> Result<$SyscallEntry> { Ok(match (regs.orig_rax, [regs.rdi, regs.rsi, regs.rdx, regs.r10, regs.r8, regs.r9]) { $( - ($nr, [$($arg_id),*, ..]) => $enum::$id { - $($arg_id: match SyscallArg::try_from_reg($arg_id) { + ($nr, [$($arg),*, ..]) => $SyscallEntry::$syscall { + $($arg: match SyscallArg::try_from_reg($arg) { Some(x) => x, - None => bail!("couldn't parse {}(2) {}: 0x{:08x}", stringify!($id), stringify!($arg_id), $arg_id) + None => bail!("couldn't parse {}(2) {}: 0x{:08x}", stringify!($syscall), stringify!($arg), $arg) }),* }, )* @@ -129,7 +129,7 @@ macro_rules! syscall_bitflags { ( struct $BitFlags:ident: $T:ty { $( - const $Flag:ident = $value:expr; + const $FLAG:ident = $value:expr; )* } @@ -138,7 +138,7 @@ macro_rules! syscall_bitflags { bitflags! { struct $BitFlags: $T { $( - const $Flag = $value; + const $FLAG = $value; )* } } |