A powerful debugging REPL for Rust, built on LLDB. Debug Rust with the ease of an interactive Python session.
- 🎯 Interactive REPL: Full-featured Rust REPL powered by evcxr
- 📸 Snapshot Variables: Capture debugged process variables and use them in REPL
- 🎨 Pretty Printers: Human-readable display of Rust types (String, Vec, Option, Result, etc.)
- 🔍 Path Navigation: Access nested data with
a.b[0].csyntax - ⚡ Smart Type Restoration: Automatic type inference with manual
restore!macro for complex types
curl -sSL https://raw.githubusercontent.com/xiaoniaoyouhuajiang/Ferrumpy/main/scripts/install.sh | bashThis automatically:
- Downloads the correct wheel for your platform (macOS/Linux, arm64/x86_64)
- Installs to
~/.local/lib/ferrumpy - Configures
~/.lldbinitto load FerrumPy - Sets up the REPL worker environment variable
# Using pipx (isolated environment)
pipx install ferrumpy
# Or using pip
pip install ferrumpyAfter pip install, manually add to ~/.lldbinit:
echo 'command script import <path-to-ferrumpy-package>/ferrumpy' >> ~/.lldbinitgit clone https://github.com/xiaoniaoyouhuajiang/Ferrumpy.git
cd Ferrumpy
maturin develop --release
echo "command script import $(pwd)/python/ferrumpy" >> ~/.lldbinitRequirements: Python 3.9+, uses Stable ABI (abi3)
// your_program.rs
fn main() {
let numbers = vec![1, 2, 3, 4, 5];
let message = "Hello, FerrumPy!";
println!("Set breakpoint here"); // <-- breakpoint
}# In LLDB
(lldb) b main.rs:4
(lldb) run
(lldb) ferrumpy repl # Start interactive REPL
>> numbers().iter().sum::<i32>()
15
>> message().to_uppercase()
"HELLO, FERRUMPY!"
>> let doubled: Vec<i32> = numbers().iter().map(|x| x * 2).collect();
>> doubled
[2, 4, 6, 8, 10](lldb) ferrumpy locals # Pretty print all local variables
(lldb) ferrumpy pp user # Pretty print specific variable
(lldb) ferrumpy pp user.name[0] # Navigate nested structures
(lldb) ferrumpy type user # Show type information
(lldb) ferrumpy repl
# Variables accessed as functions
>> simple_string()
"Hello, FerrumPy!"
# Full Rust expressions supported
>> numbers().iter().filter(|x| x % 2 == 0).collect::<Vec<_>>()
[2, 4]
# Define new functions and types
>> fn double(x: i32) -> i32 { x * 2 }
>> double(21)
42
For complex types that can't be automatically restored, use the restore! macro:
>> tuple() // Returns JSON representation
{"__elements__": ["first", 2, 3.14], ...}
>> let t = restore!(tuple, (&str, i32, f64));
>> t.0
"first"| Type Category | Examples | Support |
|---|---|---|
| Primitives | i32, f64, bool, char |
✅ Full |
| Strings | String, &str |
✅ Full |
| Collections | Vec<T>, Arrays |
✅ Full |
| Smart Pointers | Box, Rc, Arc |
✅ Full |
| Options/Results | Option<T>, Result<T, E> |
✅ Full |
| Tuples | (T1, T2, ...) |
✅ Full |
| Enums | All variants | ✅ Full |
| Structs | User-defined | ✅ Full |
| HashMap | HashMap<K, V> |
* HashMap serialization is not supported in REPL snapshots. Create them manually in REPL if needed.
The REPL snapshot feature captures variables via serde serialization. This means:
-
User-defined types: Automatically work (FerrumPy adds
Serialize/Deserializederives) -
Third-party types: The crate must enable
serdefeature. For example:# ✅ Works - serde feature enabled compact_str = { version = "0.9", features = ["serde"] } # ❌ Won't work - no serde support compact_str = "0.9"
-
Types without serde support: If a third-party type doesn't offer a
serdefeature, the REPL cannot restore those variables
FerrumPy fully supports Cargo workspaces with:
{ workspace = true }dependency resolution- Path dependencies between workspace members
- Automatic type re-exports for path dependencies
Just ensure all third-party dependencies have serde features enabled when needed.
ferrumpy/
├── python/ferrumpy/ # LLDB Python integration
│ ├── commands.py # LLDB commands (pp, repl, etc.)
│ ├── serializer.py # Variable serialization with memory reading
│ └── providers/ # Pretty printer providers
├── ferrumpy-core/ # Rust core library
│ ├── src/repl/ # REPL session management
│ ├── src/expr/ # Expression parsing
│ └── src/libgen/ # Snapshot library generation
├── tests/ # Test suite
│ ├── run_tests.sh # Test runner
│ ├── test_repl.exp # REPL integration tests
│ └── rust_sample/ # Test Rust project
└── docs/ # Documentation
- macOS: 11.0+ (arm64 or x86_64)
- Linux: x86_64 (LLDB required)
- Python: 3.9+
- Rust: 1.70+ (for building from source)
- LLDB: System LLDB (ships with Xcode on macOS)
Contributions welcome! See CONTRIBUTING.md for guidelines.
- User Guide - Detailed usage examples
- Installation Guide - Platform-specific setup
- Architecture - Design decisions
MIT License - see LICENSE for details.
Built on top of: