sys_rs/lib.rs
1#![allow(clippy::multiple_crate_versions)]
2#![feature(trait_alias)]
3
4//! sys-rs — a small ptrace-based binary inspection and tracing toolkit.
5//!
6//! The crate provides a tracer framework and utilities to inspect running
7//! processes: disassembly helpers, breakpoint management, syscall
8//! formatting, REPL and progress helpers. The public modules are organized
9//! to allow small, targeted tools (for example the `addr2line` and `strace`
10//! binaries in `bin/`) to reuse the core tracing logic.
11//!
12//! See the `bin/` examples in the repository for small command-line front-ends.
13//!
14//! # Requirements
15//!
16//! Requires **nightly Rust** (`#![feature(trait_alias)]`) and targets
17//! **Linux x86\_64** only.
18//!
19//! # Library stability
20//!
21//! The public API of this library crate is an internal implementation detail
22//! of the bundled binaries and is **not subject to semver guarantees**.
23
24/// Disassembly helpers using capstone.
25pub mod asm;
26/// Software breakpoint installation and management.
27pub mod breakpoint;
28/// Command registry, dispatch, and REPL tab-completion.
29pub mod command;
30/// Coverage data collection and source annotation.
31pub mod coverage;
32/// DWARF debug-info parsing (addr-to-source-line resolution).
33pub mod debug;
34/// Error and Result types used throughout the crate.
35pub mod diag;
36/// ptrace-based command handler functions for the debugger REPL.
37pub mod handler;
38/// Hardware register access via ptrace.
39pub mod hwaccess;
40/// CLI argument and environment-variable helpers.
41pub mod input;
42/// Command parameter types and parsed value representation.
43pub mod param;
44/// Instruction printing callbacks and layout selection.
45pub mod print;
46/// ELF binary metadata and address-space inspection.
47pub mod process;
48/// Instruction-level profiling tracer.
49pub mod profile;
50/// Tracer loop state, execution/mode enums, and progress callback.
51pub mod progress;
52/// Readline-based REPL runner.
53pub mod repl;
54/// Syscall metadata, argument formatting, and pretty-printing.
55pub mod syscall;
56/// Core Tracer trait and fork/exec/ptrace entry-point.
57pub mod trace;
58
59#[cfg(test)]
60mod tests {
61 use super::*;
62 use nix::unistd::Pid;
63
64 #[test]
65 fn test_crate_smoke() {
66 let _ = asm::Parser::new().expect("parser");
67 let _ = command::Registry::default();
68 let _ = progress::State::new(Pid::from_raw(1), None);
69 let _ = breakpoint::Manager::new(Pid::from_raw(1));
70 }
71}