How do *you* debug device drivers?

Dave Buxbaum bux at dual.UUCP
Tue Jan 1 08:13:19 AEST 1985


I agree that printf's are a rather crude method for debugging dirvers.
One way to make them more useful is to add an "event trigger". The
idea is to include a global varible which controlls the printf. Initially
set to zero, this varible is bumped upon reaching the desired "event".
It is useful to have access to the trigger from ADB.

An example:

 - in the code looking at status:
		if (event happened)
		#ifdef DEBUG
			trigger++
		#endif DEBUG
			/* Normal action here */

- in the code where more info is needed:
		#ifdef DEBUG
		if (trigger)
			printf(" SOMETHING HERE");
		#endif DEBUG

This idea can be expanded to include different levels of debugging on a
"per bit" flavor. Also, you can flip the trigger using the debugger.  This
can be very useful.

Another thing to try is using ADB on the running kernal.  This is always
a source of fun and excitment, usually leading to some spectacular crashes.
The idea is, ofcourse, to look at queues and status bytes and other related
structures to try to get an idea of what is happening.

I think debugging drivers is really the most fun a programmer can hope to have
while at work ... What a comforting thought!!!



	David Buxbaum

	dual!bux at BERKELEY.ARPA
	{ihnp4,ucbvax,hplabs,decwrl,cbosgd,sun,nsc,apple,pyramid}!dual!bux
	Dual Systems Corporation, Berkeley, California



More information about the Comp.unix.wizards mailing list