does anyone have tips for reducing randomness in your programs while debugging? thinking of timing issues, random numbers, chaotic inputs, etc.

so far I have

- seed your RNG
- capture all input and run it a million times, and save the input once you find a version that fails
- use a record/replay debugger if you can (like rr)

Follow

@b0rk

If you are debugging something concurrent, consider using shims/libraries that model the concurrency model explicitly (then they have the concept of a trace *and* have support for searching the space of traces). For Rust, take a look at loom (docs.rs/loom/latest/loom/). For C++, take a look at relacy race detector (1024cores.net/home/relacy-race).

That said, using these requires some amount of adaptation of the code being tested, so it makes sense ~only if you have a well-separated concurrent data structure that you suspect misbehaves.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.