I have an application that should produce the same output given the same input but it produces different outputs across executions.
Is it possible to use GDB to detect divergence between executions? Is it at all possible to automate this?
Is it possible to use GDB to detect divergence between executions?
If the application is single-threaded, reverse debugging can help. See this article for an example using UndoDB.
You should also make sure there are no uninitialized memory reads, using either Valgrind or MemorySantizer.
If the application is multi-threaded, reverse debugging is unlikely to help, but data race detectors like ThreadSanitizer may.
Is it at all possible to automate this?
You can (and should) certainly run {Address,Memory,Thread}Sanitizer's regularly over your test suite (you do have a test suite, right?).
With reverse debugging, not much further automation should be necessary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With