#![feature(test)]
#![feature(core_intrinsics)]
#![feature(arbitrary_enum_discriminant)]
#[macro_use]
extern crate num_derive;
#[macro_use]
extern crate bitflags;
#[macro_use]
extern crate lazy_static;
#[macro_use]
pub(crate) mod macros;
pub mod call;
pub mod prelude;
mod syscall;
mod enums;
mod from_c;
mod output;
pub mod ptrace;
mod trace;
mod trace_grouper;
mod traits;
pub mod value;
pub use output::*;
use crate::traits::hmz_format;
pub use call::SyscallKind;
pub(crate) use ptrace::Tracer;
pub use syscall::*;
pub use trace::*;
use serde::Serialize;
#[derive(Serialize, Debug)]
pub struct Syscall {
pub name: Ident,
pub kind: SyscallKind,
pub result: Result<(), SyscallError>,
}
impl Syscall {
pub(crate) fn new(name: Ident, kind: SyscallKind, result: Result<(), SyscallError>) -> Self {
Syscall { name, kind, result }
}
pub fn fmt_human(&self) -> String {
if let SyscallKind::None = self.kind {
hmz_format(&format!("{:?}", self.name), "N/A")
} else {
self.kind.fmt_human()
}
}
}
pub(crate) trait MapFromC {
type Item;
fn from_c<T>(c: T) -> Self::Item;
}