Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!rutgers!ucla-cs!zen!ucbvax!jade!saturn!ucscc.UCSC.EDU!haynes
From: haynes@ucscc.UCSC.EDU.ucsc.edu (99700000)
Newsgroups: comp.unix.wizards
Subject: Re: Debugging the kernel: proper methods?
Message-ID: <527@saturn.ucsc.edu>
Date: Sun, 5-Jul-87 00:39:39 EDT
Article-I.D.: saturn.527
Posted: Sun Jul  5 00:39:39 1987
Date-Received: Fri, 10-Jul-87 00:46:11 EDT
References: <2713@uw-june.UUCP> <479@winchester.UUCP> <7224@mimsy.UUCP> <3168@felix.UUCP>
Sender: usenet@saturn.ucsc.edu
Reply-To: haynes@ucscc.UCSC.EDU (Jim Haynes)
Organization: University of California, Santa Cruz; CATS
Lines: 35

Believe I mentioned this already some time ago, but here is again an
idea stolen from the venerable Burroughs 5500.

Have a word or two in the kernel, called the option word(s).
Have a system call to read and write the option word.  Have
programs using this system call to display the option word
and to allow setting or clearing any bit.  (OK, you can just
use adb and not bother with the system call and the program,
but Burroughs made it convenient to use.)

#define a handy name for each bit of the option word you want to
use.

Now in the kernel you can put debugging printfs in the code that
are conditional on bits in the option word, so you can turn them
on or off while the system is running.  Of course you have to be
smart to choose what you are going to printf.  Some of the existing
printfs could well be put under option word control (e.g. the one
for file system full) so that once you have noted the condition you
can get the mess off the console terminal while you deal with the
situation.

Point is that having the option word encourages you to put in all
the printfs you think you might want, because if they turn out to
be uninteresting you can just turn them off without having to
recompile the kernel and reboot.

Of course you can use bits in the option word for things other
than printf-s.  Such as to enable or disable some experimental
piece of code that is supposed to fix a problem or improve performance.

Jim Haynes
haynes@ucscc.ucsc.edu
haynes@ucscc.bitnet
...ucbvax!ucscc!haynes