<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>Debugging </TITLE>
</HEAD>
<BODY BGCOLOR="#efefef" TEXT="black" LINK="blue" VLINK="#551A8B" ALINK="red">

<A HREF="VGADriver.html"><EM> How to add an (S)VGA driver to XFree86</EM></A>
 <b>:</b> <EM>Debugging </EM><BR>
<b>Previous:</b> <A HREF="VGADriver7.html"><EM>Building The New Server </EM></A><BR>
<b>Next:</b> <A HREF="VGADriver9.html"><EM>Advice </EM></A>


<HR NOSHADE>
  <H2><A NAME="22"></A>8. Debugging </H2>
<p>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.</p>
<p>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).</p>
<p>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:</p>
<p>
<ol>
<li>Go to the driver directory.</li>
<li>Edit the Makefile.  Look for the SECOND definition of 
`<code>CDEBUGFLAGS</code>'.  Change this definition to 
		
<pre>
		CDEBUGFLAGS = -g -DNO_INLINE
	
</pre>


(this will enable debugging symbols and disable inlining of
functions, which can make single-stepping a nightmare).</li>
<li>Remove the `sdc_driver.o' file.</li>
<li>Now follow the steps above for rebuilding the server.

(Alternatively, instead of editing the Makefile, you can simply
do `<code>make CDEBUGFLAGS="-g -DNO_INLINE"</code>' after removing the
old .o file, then rebuild the server as described above).</li>
</ol>
</p>
<p>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.</p>

 <HR NOSHADE>
<A HREF="VGADriver.html"><EM> How to add an (S)VGA driver to XFree86</EM></A>
 <b>:</b> <EM>Debugging </EM><BR>
<b>Previous:</b> <A HREF="VGADriver7.html"><EM>Building The New Server </EM></A><BR>
<b>Next:</b> <A HREF="VGADriver9.html"><EM>Advice </EM></A>



</BODY>
</HTML>
