Messages in this thread | | | Date | Sun, 1 Aug 1999 13:46:11 +0200 | From | Dominik Kubla <> | Subject | Re: Useful KERNEL_ASSERT Macro |
| |
On Sat, Jul 31, 1999 at 03:36:38PM -0500, Tim Hockin wrote: > > /* a general purpose kernel assert macro */ > #ifdef KERNEL_ASSERT_ON > #define KERNEL_ASSERT(expr) if (!(expr)) \ > printk(KERN_DEBUG "KASSERT: %s:%d" \ > " - Assertion failed! (%s)\n", \ > __FILE__, __LINE__, #expr) > #else > #define KERNEL_ASSERT(expr) > #endif >
A failed assertion is SERIOUS (especially in drivers/filesystems) and should lead to a KERNEL PANIC, preferredly with a system dump (which we don't have, sic!) but at least with a call trace.
In general you should follow the C standard to depend on NDEBUG instead of KERNEL_ASSERT_ON. IMHO development kernels should have NDEBUG undefined resulting in assertions being evaluated, while production kernels should have NDEBUG automatically defined resulting in _ALL_ debugging code being disabled.
Yours, Dominik Kubla -- "Drug misuse is not a disease, it is a decision, like the decision to step out in front of a moving car. You would call that not a disease but an error of judgment." --Philip K. Dick. "Author's Note," A SCANNER DARKLY, 1977
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |