summary refs log tree commit diff
path: root/ripple/minitrace/src
diff options
context:
space:
mode:
Diffstat (limited to 'ripple/minitrace/src')
-rw-r--r--ripple/minitrace/src/main.rs17
1 files changed, 10 insertions, 7 deletions
diff --git a/ripple/minitrace/src/main.rs b/ripple/minitrace/src/main.rs
index 4e2368a..3d94288 100644
--- a/ripple/minitrace/src/main.rs
+++ b/ripple/minitrace/src/main.rs
@@ -108,14 +108,17 @@ macro_rules! define_syscalls {
 		}
 
 		impl $enum {
-			fn from_regs(regs: libc::user_regs_struct) -> Option<$enum> {
-				Some(match (regs.orig_rax, [regs.rdi, regs.rsi, regs.rdx, regs.r10, regs.r8, regs.r9]) {
+			fn from_regs(regs: libc::user_regs_struct) -> Result<$enum> {
+				Ok(match (regs.orig_rax, [regs.rdi, regs.rsi, regs.rdx, regs.r10, regs.r8, regs.r9]) {
 					$(
 						($nr, [$($arg_id),*, ..]) => $enum::$id {
-							$($arg_id: SyscallArg::try_from_reg($arg_id)?),*
+							$($arg_id: match SyscallArg::try_from_reg($arg_id) {
+								Some(x) => x,
+								None => bail!("couldn't parse {}(2) {}: 0x{:08x}", stringify!($id), stringify!($arg_id), $arg_id)
+							}),*
 						},
 					)*
-					_ => return None
+					(n, _) => bail!("unknown syscall number {n}")
 				})
 			}
 		}
@@ -303,10 +306,10 @@ fn main() -> Result<()> {
 
 				let regs = ptrace::getregs(event_tid.as_pid())?;
 				let entry = match SyscallEntry::from_regs(regs) {
-					Some(entry) => entry,
-					None => {
+					Ok(entry) => entry,
+					Err(err) => {
 						ptrace::kill(event_tid.as_pid())?;
-						panic!("unsupported syscall {:?}", regs.orig_rax);
+						panic!("{err}");
 					}
 				};