\documentstyle[11pt,twoside,ifthen,fancyheadings]{report}
% Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993
% MIT Student Information Processing Board (SIPB)
%
% The use and redistribution of this Inessential Guide to Debugging
% is hereby granted with the following restrictions:
% * Non-local bugs should be reported back to the SIPB
%	(send email to bug-sipb@mit.edu)
% * The use of any portion of this guide must be accredited to the SIPB
% * The use of this document in its entirety (except for local changes
%	and additions) must maintain the credits, name, and logo of the
%	SIPB and the Inessential Guide to Debugging.


% The styles in the above line require the following lines in .environment:
%       attach sipb
%       setenv TEXINPUTS .:/mit/sipb/lib/tex/macros:/usr/athena/lib/tex/macros
% The ifthen macro is for ``page layout parameters'' figure.

% Revision notes
\def\$#1${{#1}}  % Kluge: collect RCS revision info without $...$
\xdef\revision{\$Revision: 1.2 $}  % For use in headers, footers too

% Project begun {22/07/94}

% Trademarks and copyright symbols
\def\trademark{$^{\scriptscriptstyle {\rm TM}}$}

% Standard settings for this document - guidemacros.sty is not used.
\setlength{\evensidemargin}{0pt}
\setlength{\oddsidemargin}{0pt}
\setlength{\topmargin}{-24pt}
\setlength{\headheight}{14pt}
\setlength{\headsep}{24pt}
\setlength{\textwidth}{6.5in}
\setlength{\textheight}{8.5in}
\setlength{\parskip}{.1in}	

% Set headers and footers
\pagestyle{fancy}
\lhead{}
\chead{\large Inessential \LaTeX{}}
\rhead{}
\setlength{\headrulewidth}{0in}
\lfoot{MIT SIPB}
\rfoot{\revision}

% Section modifications
\setcounter{secnumdepth}{3}	% subsubsections are numbered
\setcounter{tocdepth}{3}	% subsubsections are listed in toc
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\thesection.\arabic{subsection}}
\renewcommand{\thefigure}{\arabic{figure}}
\renewcommand{\theequation}{\arabic{equation}}

% Special text style commands
\newcommand{\blood}{{\framebox{\large BLOOD}}}
\newcommand{\prompt}{{\bf athena{\tt\%}} }      % Athena prompt
\newcommand{\user}[1]{``{\bf #1}''}             % Style for user input
\newcommand{\prog}[1]{``{\tt #1}''}             % Style for a program name

% Describe title page

% Allow symbol footnote for title
\def\thefootnote{\fnsymbol{footnote}}

% PSbox allows a PostScript figure to be inserted into the file.
% The special command contains the name of the file
% 	(which is considered by LaTeX to be of zero width and height).
% The hspace command specifies the width of the image.
% The rule command specifies the height of the image.
% The mbox command allocates a rectangular box of the appropriate size.
% PSbox is a fragile command.
\newcommand{\PSbox}[3]{\mbox{\special{psfile=#1}\hspace{#2}\rule{0pt}{#3}}}

\title {% Sipb Owl Logo
	\vspace{-1in}
	\PSbox{fancy-owl.ps}{200pt}{200pt}
	\vspace{1in}\\
	{\huge Inessential Debugging{}%
	\thanks{Copyright \copyright\ 1993 Student Information Processing Board
		of the Massachusetts Institute of Technology}}
	\\ {\small (\revision)}
	\\ {\Huge\bf BLEED ON ME}
}

\author{\large{\bf The Student Information Processing Board}\\\\
        {\small Gregory S. Stark}
}

% End of Preamble

\begin{document}

% Title page
\maketitle
\def\thefootnote{\arabic{footnote}} % Return to arabic footnotes
\newpage

% Table of Contents
\pagenumbering{roman}
\tableofcontents
\newpage

% List of Figures
\listoffigures
\newpage
\pagenumbering{arabic}

\section{Introduction}

This is not intended to be a guide of how to program. This is intended a guide to some
of the debugging tools available on Athena and to some of the basic techniques
good programmers use to avoid and eliminate bugs. \blood

\section{Debugging Tools}
\subsection{The Compiler}

That's right, the compiler is the first debugging tool. After all few other
programs will everknow as much about your program as it does, you may as well
get it on your side. 

Compilers print messages whenever there's a parse error, or other compile-time
error, but many errors, even typos, can still be legal code, especially with
C. Most compilers, can optionally detect many such situations and still print
messages called ``warnings''. Turning on such warnings is what I meant by
getting the compiler on your side. Enabling warnings is like asking for the
compiler to do a lot of the debugging work for you.

To turn on a generous set of warnings with \prog{gcc} \footnote{Gcc is the gnu
compiler and is strongly recommended. Gcc is better than most other C
compilers and means you'll only have to learn one set of cryptic error and
warning messages} use the \prog{-Wall} option. 

Also to use a debugger later you'll need to use the \prog{-g} option. Even if
you don't know how to use a debugger there's no reason not to use it. \blood

%\subsection{\prog{gdb}, \prog{dbx}, similar debuggers \blood is there a
%generic term for a dbx-like debugger?}

\blood
I don't know anything about dbx or any other debuggers. If the following is
completely wrong for them then they shold either be each separate subsections
or maybe subsubsections.

Debuggers let you watch your program run, stop them at specific points, look
at variables, etc. To run gdb or dbx on a program, say a.out, type:
$$
\mbox{\tt \prompt gdb a.out}
$$
or if you have a core dump file from a previous run:
$$
\mbox{\tt \prompt gdb a.out core}
$$
The following commands are a basic set of useful debugging commands:
$$
\mbox{\blood}
$$


\subsection{Multi}

\subsection{Codecentre}

\subsection{lint?}


\end{document}
