Skip to content

Commit

Permalink
fix: strace array parsing (fixes #3)
Browse files Browse the repository at this point in the history
  • Loading branch information
desbma committed Mar 29, 2024
1 parent a782302 commit be5dd32
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion src/strace/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ $
|
(
\[
(?<array>.+)
(?<array>[^\]]+)
\]
)
|
Expand Down Expand Up @@ -714,6 +714,48 @@ mod tests {
);
}

#[test]
fn test_rt_sigprocmask() {
let _ = simple_logger::SimpleLogger::new().init();

assert_eq!(
parse_line("440663 0.002174 rt_sigprocmask(SIG_SETMASK, [], ~[KILL STOP RTMIN RT_1], 8) = 0", &[]).unwrap(),
ParseResult::Syscall(Syscall {pid: 440663,
rel_ts: 0.002174,
name: "rt_sigprocmask".to_owned(),
args: vec![
SyscallArg::Integer {
value: IntegerExpression::NamedConst(
"SIG_SETMASK".to_owned(),
),
metadata: None,
},
SyscallArg::Integer {
value: IntegerExpression::NamedConst(
"[]".to_owned(),
),
metadata: None,
},
SyscallArg::Integer {
value: IntegerExpression::BinaryNot(
Box::new(IntegerExpression::NamedConst(
"RT_1".to_owned(),
)),
),
metadata: None,
},
SyscallArg::Integer {
value: IntegerExpression::Literal(
8,
),
metadata: None,
},
],
ret_val: 0,
})
);
}

#[test]
fn test_newfstatat() {
let _ = simple_logger::SimpleLogger::new().init();
Expand Down

0 comments on commit be5dd32

Please sign in to comment.