Weblog

All | General | Solaris
« libaio hang ?? | Main | Enuf error checking... »
20061113 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 Comments [1]

Comments:

Doesn't the ASSERT() only panic if all of those conditions are false at the same time? Still looks like it'd be a pain to debug, but that pain seems inherent to the condition asserted.

Posted by Marshall T. Vandegrift on November 13, 2006 at 05:54 AM PST #

Post a Comment:

Comments are closed for this entry.

Calendar

RSS Feeds

Search

Links

Navigation

Referers