Subject: Re: kernel panic messages
To: None <tech-kern@netbsd.org>
From: Martin J. Laubach <mjl+usenet-2003-04@emsi.priv.at>
List: tech-kern
Date: 05/04/2003 06:35:09
| > how about changing the panic signature to include __FILE__ and __LINE__ just
| > before the const char * fmt?
|  
|  Doubles or tripples the number of strings. If all we need to do is add a
|  number to the existing string, let's just do that.

  For implementing, I see four possibilities

   (a) touch each panic() call to included __FILE__ and __LINE__, 
       change the panic() signature to take two more arguments.

   (b) wrap it in a macro that does add magically __FILE__ and __LINE__. 
       gcc can do varargs macros IIRC but I'm not sure we want to
       use them.

   (c) move the actual panic format strings out of the panic call,
       have a char *panic_format_table[] somewhere and reference just
       the index. This raises the bar for people to quickly add a
       panic somewhere, on the other hand it's a good thing to have
       all possible panics documented somewhere (perhaps even with --
       gasp! -- some short comment hinting what "foo blorpled magic
       cube" means). Add something to the makefile to check for
       duplicate panic strings and bail out.

   (d) make a pass over all strings to make them unique. Rather prone
       to bit-rot since later additions will need another pass in
       a year or so. And another. And...


  a is easy but a lot of rototilling. b is easier but depends on gccisms.
d is a temporary hack. c is my favorite but still a lot of work.

	mjl