Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Aug 1996 05:21:36 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        michaelv@HeadCandy.com, terry@lambert.org
Cc:        Hackers@FreeBSD.ORG, michaelh@cet.co.jp
Subject:   Re: kernel assertions (Rev. 1)
Message-ID:  <199607311921.FAA25171@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>> >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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199607311921.FAA25171>