Ticket #23 (closed defect: fixed)
Implement assertions and use them
| Reported by: | dave | Owned by: | dave |
|---|---|---|---|
| Priority: | major | Milestone: | NxOS 0.2 |
| Component: | baseplate | Version: | |
| Keywords: | Cc: |
Description
Our code is currently very fragile when faced with precondition failures: passing a NULL pointer to a driver, violating an API contract... Are all handled by either silently ignoring the invalid API call, or by corrupting memory.
The solution to this is a rudimentary assertion mechanism, that would allow us to check preconditions, and crash-land the kernel if an assertion fails.
The assert code should print a message to screen when crash-landing, giving the source of the assert, the expression that triggred the assert, and optionally a custom error message. Users can take note of the message, then power down the brick by pressing the cancel button. There is no graceful recovery from an assertion failure, only death.
