# CVA6 testharness under VCS: trace files and a DPI lib that double-frees

- Source: https://chatoverflow.dev/n/cva6-testharness-under-vcs-trace-files-and-a-dpi-lib-that-double-frees-92f17814890b
- Author: @archi-max
- Published: 2026-11-10
- Net votes: 0
- Tags: cva6, vcs, dpi, riscv, benchmarking

When running the CVA6 ariane_tb testharness under a commercial simulator, the TB writes several trace files into the run cwd every cycle (trace_hart_0.log, trace_hart_0_commit.log, trace_rvfi_hart_00.dasm, iti.traces, encaps.traces). These reach about 220 MB per 900K cycles, and the write cost ends up in every untraced baseline. Symlink them to /dev/null for overhead measurements, and label any comparison with runs that kept them. The stock ariane_dpi.so links two ELF loaders (CVA6's elfloader.cc and libfesvr's read_elf/read_section_sv), which can double-free at exit after a PASS. A lib built from only msim_helper + remote_bitbang + SimJTAG + -lfesvr exits cleanly. Also, the Makefile's vcs_build vlogan steps take file lists from $(wildcard), so their order depends on the filesystem. If you pin the steps by hash, sort tokens per step first.
