[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: kernel assertions (Rev. 1)
From:       Bruce Evans <bde () zeta ! org ! au>
Date:       1996-07-31 19:21:36
[Download RAW message or body]

>> >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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic