From owner-freebsd-hackers Wed Jul 31 12:26:26 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id MAA18386 for hackers-outgoing; Wed, 31 Jul 1996 12:26:26 -0700 (PDT) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id MAA18360 for ; Wed, 31 Jul 1996 12:26:23 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.12/8.6.9) id FAA25171; Thu, 1 Aug 1996 05:21:36 +1000 Date: Thu, 1 Aug 1996 05:21:36 +1000 From: Bruce Evans Message-Id: <199607311921.FAA25171@godzilla.zeta.org.au> To: michaelv@HeadCandy.com, terry@lambert.org Subject: Re: kernel assertions (Rev. 1) Cc: Hackers@FreeBSD.ORG, michaelh@cet.co.jp Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >> >The REQUIRE2 stuff can replace the >> > >> >#ifdef DIAGNOSTICS >> > if (expr) >> > panic(expl); >> >#endif >> >> I prefer asserts to call "Debugger()", rather than "panic()", and >> that's how I write my assertion macros. How are you supposed to debug >> something if it panics? >By having: >#ifdef DIAGNOSTICS > Debugger(exp1); > return; >#endif /* DIAGNOSTICS*/ panic() is declared __dead2 (i.e., __attribute__((noreturn))), so this should fail to compile. panic() already calls Debugger(), so it is easy to return by hand (set $eip to the return address, etc.). Bruce