Make it FailΒΆ

Making a system fail reproducibly is an important step in debugging. It allows you to investigate the problem when it occurs so you can determine the cause. It also allows you to have confidence that a fix actually removes the failure.

Here are some approaches to making a system fail.

  • Use tools that analyse code or systematically add runtime checks to catch problems. Such tools include:

    • The Address Sanitizer ASan

    • The Valgrind framework for dynamic analysis (Valgrind)

    • The debugging compiler dcc that combines the two above.

  • Ensure you keep core dumps, as you go through the process of making your program fail. You can analyse this using GDB later on (GDB - Core Dumps)

  • Test as many scenarios as possible and record which ones trigger the bug and which do not.

  • Insert assertions that fail when impossible conditions occur (OS/161 - KASSERT)