# Install Rust (if not installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Install system dependencies (Ubuntu/Debian)
apt-get install libsqlite3-dev libssl-dev clang llvm pkg-config
# Install system dependencies (macOS)
brew install sqlite openssl llvmcd /Users/vasilipascal/work/stackdog
# Copy environment file
cp .env.sample .env
# Generate secret key
head -c16 /dev/urandom > src/secret.key# Build the project
cargo build
# Run all tests
cargo test --all
# Run specific test module
cargo test --test events::syscall_event_test
# Check code formatting
cargo fmt --all -- --check
# Run clippy linter
cargo clippy --all# Run with debug logging
RUST_LOG=debug cargo run
# Run in release mode
cargo run --release- Write a failing test in
tests/directory - Run the test to verify it fails:
cargo test --test <test_file>
- Implement minimal code to make the test pass
- Run test again to verify it passes
- Refactor while keeping tests green
- Repeat
// 1. Write test first (tests/events/my_event_test.rs)
#[test]
fn test_my_event_creation() {
let event = MyEvent::new("test");
assert_eq!(event.name, "test");
}
// 2. Run test (should fail)
cargo test --test events::my_event_test
// 3. Implement in src/events/my_event.rs
pub struct MyEvent {
pub name: String,
}
impl MyEvent {
pub fn new(name: &str) -> Self {
Self { name: name.to_string() }
}
}
// 4. Run test again (should pass)
cargo test --test events::my_event_test
// 5. Refactor and add documentation-
Create directory under
src/:mkdir src/my_module
-
Create mod.rs:
//! My module documentation pub mod my_submodule; pub struct MyModuleMarker;
-
Add to main.rs:
mod my_module;
-
Create tests:
mkdir tests/my_module
# All tests
cargo test --all
# Specific test file
cargo test --test events::syscall_event_test
# Specific test function
cargo test test_syscall_event_creation
# Tests with pattern
cargo test test_syscall
# Integration tests
cargo test --test integration
# With output
cargo test -- --nocapture
# With coverage (requires cargo-tarpaulin)
cargo tarpaulin --all --out Html# Format code
cargo fmt --all
# Check formatting
cargo fmt --all -- --check
# Run linter
cargo clippy --all
# Run linter with all features
cargo clippy --all-features
# Security audit
cargo audit
# Check dependencies
cargo deny checkRUST_LOG=debug cargo run
RUST_LOG=stackdog=debug cargo run
RUST_LOG=trace cargo run// In your code
dbg!(&variable);
println!("Debug: {:?}", variable);# Build with debug symbols
cargo build
# Run with debugger
lldb target/debug/stackdogcd ebpf
cargo build --release# Requires root
sudo cargo bpf build# List loaded eBPF programs
bpftool prog list
# View eBPF maps
bpftool map listuse candle_core::{Tensor, DType, Device};
let tensor = Tensor::new(&[1.0f32, 2.0, 3.0], &Device::Cpu)?;use candle_nn::{Module, Linear};
let output = model.forward(&input)?;Solution: Ensure you have LLVM installed:
# Ubuntu/Debian
apt-get install llvm clang
# macOS
brew install llvmSolution: Check kernel version (requires 4.19+):
uname -rSolution: Clean and rebuild:
cargo clean
cargo build
cargo test- Development Plan: DEVELOPMENT.md
- Task List: TODO.md
- Project Memory: .qwen/PROJECT_MEMORY.md
- Task Specification: docs/tasks/TASK-001.md
- Rust Book: https://doc.rust-lang.org/book/
- Candle Docs: https://docs.rs/candle-core
- aya-rs Docs: https://aya-rs.dev/
- GitHub Issues: https://github.com/vsilent/stackdog/issues
- Gitter: https://gitter.im/stackdog/community
- Email: info@try.direct
Last updated: 2026-03-13