naksheap/crates/naksheap-testkit/examples/gen_fixture.rs
lakshit verma a48b163683
naksheap: reconstruct heap object graphs from core dumps
Rust workspace that turns a core dump of a stripped, optimized C/C++
binary into a typed heap object graph: objects, sizes, allocator state,
references, and probable struct layouts, all without debug info.

- glibc ptmalloc carving (main + thread arenas, tcache/fastbin freed
  state, mmap allocations), ELF core + memory-list minidump parsing
- pointer scan, layout clustering, vtable/string/vector detection,
  confidence + evidence on every node
- ASCII/JSON/Graphviz/HTML output, synthetic fixtures with ground truth,
  and real-dump validation harness (aarch64 glibc 2.39) in scripts/
- web deployment reference stack in deploy/

MIT OR Apache-2.0
2026-08-15 04:21:59 +05:30

20 lines
708 B
Rust

//! Generates a fixture core dump + ground-truth manifest for manual testing.
//!
//! Usage: `cargo run -p naksheap-testkit --example gen_fixture -- <out-dir>`
use naksheap_testkit::CoreSpec;
fn main() {
let out = std::env::args()
.nth(1)
.unwrap_or_else(|| "/tmp/naksheap-fixtures".to_string());
let dir = std::path::Path::new(&out);
std::fs::create_dir_all(dir).expect("create out dir");
let spec = CoreSpec::default();
let fixture = spec.build().expect("build fixture");
let core = dir.join("toy-server.core");
fixture.write(&core).expect("write core");
fixture.write_manifest(&core).expect("write manifest");
println!("wrote {}", core.display());
}