Debugging

How to add an (S)VGA driver to XFree86 : Debugging
Previous: Building The New Server
Next: Advice

## 8. Debugging

Debugging a new driver can be a painful experience, unfortunately. It is likely that incorrect programming of the SVGA chipset can lock up your machine. More likely, however, is that the display will be lost, potentially requiring a reboot to correct. It is HIGHLY recommended that the server be run from an attached terminal or a network login. This is the only rational way in which a debugger can be used on the server. Attempting to use multiple VTs for debugging is basically a waste of time.

Because of the potential for locking up the machine, it is a VERY good idea to remember to do a `sync' or two before starting the server. In addition, any unnecessary filesystems should be unmounted while the debugging session is going on (to avoid having to run unnecessary fsck's).

By default the server is built without debugging symbols. The server can grow VERY large with debugging enabled. It is very simple to rebuild your driver for debugging, though. Do the following:

1. Go to the driver directory.
2. Edit the Makefile. Look for the SECOND definition of ``CDEBUGFLAGS`'. Change this definition to

       		CDEBUGFLAGS = -g -DNO_INLINE

   (this will enable debugging symbols and disable inlining of functions, which can make single-stepping a nightmare).
3. Remove the `sdc_driver.o' file.
4. Now follow the steps above for rebuilding the server. (Alternatively, instead of editing the Makefile, you can simply do ``make CDEBUGFLAGS="-g -DNO_INLINE"`' after removing the old .o file, then rebuild the server as described above).

This will give you a server with which you can set breakpoints in the driver functions and single-step them. If you are working in the source tree, and just learning about SVGA programming, it may be useful to rebuild vgaHW.c with debugging as well.

How to add an (S)VGA driver to XFree86 : Debugging
Previous: Building The New Server
Next: Advice