
Monday November 13, 2006
One ASSERT per line ...
One ASSERT per line...
I just came across the following assert() in cpu.c
666 ASSERT(t->t_weakbound_cpu == CPU ||
667 (t->t_nomigrate < 0 && t->t_preempt > 0) ||
668 CPU_ON_INTR(CPU) || t->t_flag & T_INTR_THREAD ||
669 getpil() >= DISP_LEVEL);
A system with debug kernel would panic, if any of the above conditions
were to fail. For me, I believe, on sparc system, it would take 2mins
to decipher which of the conditions failed.
And on amd64, definitely longer.
If only these asserts were one per line :
- the panic message would tell me what had gone
wrong - letting me focus on the core of the problem, rather than which
one failed.
- Definitely improves the readability of the code,
which is what solaris is known for.
If only somebody could find an RTI advocate, who will approve the
changes, I will definitely be indebted to him/them.
( Nov 13 2006, 03:37:39 AM PST )
Permalink
Posted by Marshall T. Vandegrift on November 13, 2006 at 05:54 AM PST #