Files
oldlinux-files/Ref-docs/manual gdb/gdb-3.1.html
2024-02-19 00:21:47 -05:00

5050 lines
234 KiB
HTML

<HTML>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Created on January, 23 2003 by texi2html 1.64 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>
Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
-->
<HEAD>
<TITLE>GDB Manual: </TITLE>
<META NAME="description" CONTENT="GDB Manual: ">
<META NAME="keywords" CONTENT="GDB Manual: ">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="texi2html 1.64">
</HEAD>
<BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<A NAME="SEC_Top"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1>GDB Manual</H1><H1> Summary of GDB </H1>
<!--docid::SEC1::-->
<P>
The purpose of a debugger such as GDB is to allow you to execute another
program while examining what is going on inside it. We call the other
program "your program" or "the program being debugged".
</P><P>
GDB can do four kinds of things (plus other things in support of these):
</P><P>
<OL>
<LI>
Start the program, specifying anything that might affect its behavior.
<P>
<LI>
Make the program stop on specified conditions.
<P>
<LI>
Examine what has happened, when the program has stopped, so that you
can see bugs happen.
<P>
<LI>
Change things in the program, so you can correct the effects of one bug
and go on to learn about another without having to recompile first.
</OL>
<P>
GDB can be used to debug programs written in C and C++. Pascal support
is being implemented, and Fortran support will be added when a GNU
Fortran compiler is written.
</P><P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC2">GDB General Public License</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">The GDB General Public License gives you permission
to redistribute GDB on certain terms; and also
explains that there is no warranty.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC5">1. GDB Input Conventions</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">GDB command syntax and input conventions.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC6">2. Specifying GDB's Files</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Specifying files for GDB to operate on.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC9">3. Options and Arguments for GDB</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">GDB arguments and options.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC13">4. Compiling Your Program for Debugging</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Compiling your program so you can debug it.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC14">5. Running Your Program Under GDB</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Running your program under GDB.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC20">6. Stopping and Continuing</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Making your program stop. Why it may stop. What to do then.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC31">7. Examining the Stack</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Examining your program's stack.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC36">8. Examining Source Files</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Examining your program's source files.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC40">9. Examining Data</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Examining data in your program.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC51">10. Examining the Symbol Table</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Examining the debugger's symbol table.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC52">11. Altering Execution</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Altering things in your program.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC57">12. Canned Sequences of Commands</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Canned command sequences for repeated use.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC61">13. Using GDB under GNU Emacs</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Using GDB through GNU Emacs.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC62">14. Remote Kernel Debugging</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Remote kernel debugging across a serial line.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC64">Command Index</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Index of GDB commands.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC65">Concept Index</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Index of GDB concepts.</TD></TR>
</TABLE></BLOCKQUOTE>
<P>
<HR SIZE=1>
<A NAME="SEC1"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC2"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[ &lt;&lt; ]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt;&gt; ]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<A NAME="License"></A>
<HR SIZE="6">
<A NAME="SEC2"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC1"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC3"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC5"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> GDB General Public License </H1>
<!--docid::SEC2::-->
<center>
(Clarified 11 Feb 1988)
</center>
<P>
The license agreements of most software companies keep you at the mercy
of those companies. By contrast, our general public license is intended to
give everyone the right to share GDB. To make sure that you get the rights
we want you to have, we need to make restrictions that forbid anyone to
deny you these rights or to ask you to surrender the rights. Hence this
license agreement.
</P><P>
Specifically, we want to make sure that you have the right to give away
copies of GDB, that you receive source code or else can get it if you want
it, that you can change GDB or use pieces of it in new free programs, and
that you know you can do these things.
</P><P>
To make sure that everyone has such rights, we have to forbid you to
deprive anyone else of these rights. For example, if you distribute copies
of GDB, you must give the recipients all the rights that you have. You
must make sure that they, too, receive or can get the source code. And you
must tell them their rights.
</P><P>
Also, for our own protection, we must make certain that everyone finds
out that there is no warranty for GDB. If GDB is modified by someone else
and passed on, we want its recipients to know that what they have is not
what we distributed, so that any problems introduced by others will not
reflect on our reputation.
</P><P>
Therefore we (Richard Stallman and the Free Software Foundation,
Inc.) make the following terms which say what you must do to be
allowed to distribute or change GDB.
</P><P>
<HR SIZE="6">
<A NAME="SEC3"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC2"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC4"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[ &lt;&lt; ]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt;&gt; ]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> Copying Policies </H2>
<!--docid::SEC3::-->
<P>
<OL>
<LI>
You may copy and distribute verbatim copies of GDB source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each file a valid copyright notice "Copyright
(C) 1988 Free Software Foundation, Inc." (or with whatever year
is appropriate); keep intact the notices on all files that
refer to this License Agreement and to the absence of any warranty; and
give any other recipients of the GDB program a copy of this License
Agreement along with the program. You may charge a distribution fee
for the physical act of transferring a copy.
<P>
<LI>
You may modify your copy or copies of GDB source code or any portion
of it, and copy and distribute such modifications under the terms of
Paragraph 1 above, provided that you also do the following:
<P>
<UL>
<LI>
cause the modified files to carry prominent notices stating
that you changed the files and the date of any change; and
<P>
<LI>
cause the whole of any work that you distribute or publish, that
in whole or in part contains or is a derivative of GDB or any
part thereof, to be licensed at no charge to all third parties on
terms identical to those contained in this License Agreement
(except that you may choose to grant more extensive warranty
protection to some or all third parties, at your option).
<P>
<LI>
if the modified program serves as a debugger, cause it, when
started running in the simplest and usual way, to print an
announcement including a valid copyright notice "Copyright
(C) 1988 Free Software Foundation, Inc." (or with the
year that is appropriate), saying that there is no warranty (or
else, saying that you provide a warranty) and that users may
redistribute the program under these conditions, and telling the
user how to view a copy of this License Agreement.
<P>
<LI>
You may charge a distribution fee for the physical act of
transferring a copy, and you may at your option offer warranty
protection in exchange for a fee.
</UL>
<P>
Mere aggregation of another unrelated program with this program (or its
derivative) on a volume of a storage or distribution medium does not bring
the other program under the scope of these terms.
</P><P>
<LI>
You may copy and distribute GDB (or a portion or derivative of it,
under Paragraph 2) in object code or executable form under the terms
of Paragraphs 1 and 2 above provided that you also do one of the
following:
<P>
<UL>
<LI>
accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of
Paragraphs 1 and 2 above; or,
<P>
<LI>
accompany it with a written offer, valid for at least three
years, to give any third party free (except for a nominal
shipping charge) a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of
Paragraphs 1 and 2 above; or,
<P>
<LI>
accompany it with the information you received as to where the
corresponding source code may be obtained. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form alone.)
</UL>
<P>
For an executable file, complete source code means all the source code
for all modules it contains; but, as a special exception, it need not
include source code for modules which are standard libraries that
accompany the operating system on which the executable file runs.
</P><P>
<LI>
You may not copy, sublicense, distribute or transfer GDB except as
expressly provided under this License Agreement. Any attempt
otherwise to copy, sublicense, distribute or transfer GDB is void and
your rights to use GDB under this License agreement shall be
automatically terminated. However, parties who have received computer
software programs from you with this License Agreement will not have
their licenses terminated so long as such parties remain in full
compliance.
<P>
<LI>
If you wish to incorporate parts of GDB into other free programs whose
distribution conditions are different, write to the Free Software
Foundation. We have not yet worked out a simple rule that can be
stated here, but we will often permit this. We will be guided by the
two goals of preserving the free status of all derivatives our free
software and of promoting the sharing and reuse of software.
</OL>
<P>
<HR SIZE="6">
<A NAME="SEC4"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC3"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC5"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[ &lt;&lt; ]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt;&gt; ]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> NO WARRANTY </H2>
<!--docid::SEC4::-->
<P>
BECAUSE GDB IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY
NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW. EXCEPT
WHEN OTHERWISE STATED IN WRITING, THE FREE SOFTWARE FOUNDATION, INC,
RICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE GDB "AS IS"
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY
AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE GDB
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
SERVICING, REPAIR OR CORRECTION.
</P><P>
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL FREE SOFTWARE
FOUNDATION, INC., RICHARD M. STALLMAN, AND/OR ANY OTHER PARTY WHO MAY
MODIFY AND REDISTRIBUTE GDB AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR OTHER
SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A
FAILURE OF THE PROGRAM TO OPERATE WITH PROGRAMS NOT DISTRIBUTED BY
FREE SOFTWARE FOUNDATION, INC.) THE PROGRAM, EVEN IF YOU HAVE BEEN
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY
OTHER PARTY.
</P><P>
<A NAME="Input"></A>
<HR SIZE="6">
<A NAME="SEC5"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC4"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC6"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC2"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC6"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 1. GDB Input Conventions </H1>
<!--docid::SEC5::-->
<P>
GDB is invoked with the shell command <SAMP>`gdb'</SAMP>. Once started, it reads
commands from the terminal until you tell it to exit.
</P><P>
A GDB command is a single line of input. There is no limit on how long
it can be. It starts with a command name, which is followed by arguments
whose meaning depends on the command name. Some command names do not
allow arguments.
</P><P>
GDB command names may always be abbreviated if the abbreviation is
unambiguous. Sometimes even ambiguous abbreviations are allowed; for
example, <SAMP>`s'</SAMP> is specially defined as equivalent to <SAMP>`step'</SAMP>
even though there are other commands whose names start with <SAMP>`s'</SAMP>.
Possible command abbreviations are often stated in the documentation
of the individual commands.
</P><P>
A blank line as input to GDB means to repeat the previous command verbatim.
Certain commands do not allow themselves to be repeated this way; these are
commands for which unintentional repetition might cause trouble and which
you are unlikely to want to repeat. Certain others (<SAMP>`list'</SAMP> and
<SAMP>`x'</SAMP>) act differently when repeated because that is more useful.
</P><P>
A line of input starting with <SAMP>`#'</SAMP> is a comment; it does nothing.
This is useful mainly in command files (See section <A HREF="gdb.html#SEC59">12.2 Command Files</A>).
</P><P>
Occasionally it is useful to execute a shell command from within gdb.
This can be done with the <SAMP>`shell'</SAMP> command, or the shell escape
character <SAMP>`!'</SAMP>.
</P><P>
<DL COMPACT>
<DT><CODE>shell <VAR>shell command string</VAR></CODE>
<DD><A NAME="IDX1"></A>
<DT><CODE>!<VAR>shell command string</VAR></CODE>
<DD><A NAME="IDX2"></A>
<A NAME="IDX3"></A>
Directs GDB to invoke an inferior shell to execute <SAMP>`shell command string'</SAMP>.
The environmental variable <SAMP>`SHELL'</SAMP> is used if it exists, otherwise gdb
uses <SAMP>`/bin/sh'</SAMP>.
</DL>
<P>
GDB <EM>prompts</EM> for commands with a string that is normally <SAMP>`(gdb)'</SAMP>.
When debugging GDB with GDB, it is useful to change the prompt in one of
the GDBs so that you can distinguish them. This can be done with the
<SAMP>`set prompt'</SAMP> command.
</P><P>
<DL COMPACT>
<DT><CODE>set prompt <VAR>newprompt</VAR></CODE>
<DD><A NAME="IDX4"></A>
Directs GDB to use <VAR>newprompt</VAR> as its prompt string henceforth.
</DL>
<P>
<A NAME="IDX5"></A>
<A NAME="IDX6"></A>
To exit GDB, use the <SAMP>`quit'</SAMP> command (abbreviated <SAMP>`q'</SAMP>).
<KBD>Ctrl-c</KBD> will not exit from GDB, but rather will terminate the action
of any GDB command that is in progress and return to GDB command level.
It is safe to type <KBD>Ctrl-c</KBD> at any time because GDB does not allow
it to take effect until a time when it is safe.
</P><P>
<A NAME="Files"></A>
<HR SIZE="6">
<A NAME="SEC6"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC5"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC7"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC5"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC9"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 2. Specifying GDB's Files </H1>
<!--docid::SEC6::-->
<P>
<A NAME="IDX7"></A>
<A NAME="IDX8"></A>
<A NAME="IDX9"></A>
GDB needs to know the filename of the program to be debugged. To debug a
core dump of a previous run, GDB must be told the filename of the core
dump.
</P><P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC7">2.1 Specifying Files with Arguments</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Specifying files with arguments</TD></TR>
</TABLE>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(when&nbsp;you&nbsp;start&nbsp;GDB).
<br>
<TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC8">2.2 Specifying Files with Commands</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Specifying files with GDB commands.</TD></TR>
</TABLE></BLOCKQUOTE>
<P>
<A NAME="File Arguments"></A>
<HR SIZE="6">
<A NAME="SEC7"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC6"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC8"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC6"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC6"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC9"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 2.1 Specifying Files with Arguments </H2>
<!--docid::SEC7::-->
<P>
The usual way to specify the executable and core dump file names is with
two command arguments given when you start GDB. The first argument is used
as the file for execution and symbols, and the second argument (if any) is
used as the core dump file name. Thus,
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>gdb progm core
</pre></td></tr></table></P><P>
specifies <TT>`progm'</TT> as the executable program and <TT>`core'</TT> as a core
dump file to examine. (You do not need to have a core dump file if what
you plan to do is debug the program interactively.)
</P><P>
See section <A HREF="gdb.html#SEC9">3. Options and Arguments for GDB</A>, for full information on command options and arguments for
GDB.
</P><P>
<A NAME="File Commands"></A>
<HR SIZE="6">
<A NAME="SEC8"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC7"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC9"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC6"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC6"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC9"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 2.2 Specifying Files with Commands </H2>
<!--docid::SEC8::-->
<P>
Usually you specify the files for GDB to work with by giving arguments when
you invoke GDB. But occasionally it is necessary to change to a different
file during a GDB session. Or you may run GDB and forget to specify the
files you want to use. In these situations the GDB commands to specify new
files are useful.
</P><P>
<DL COMPACT>
<DT><CODE>exec-file <VAR>filename</VAR></CODE>
<DD><A NAME="IDX10"></A>
Specify that the program to be run is found in <VAR>filename</VAR>. If you
do not specify a directory and the file is not found in GDB's working
directory, GDB will use the environment variable <SAMP>`PATH'</SAMP> as a list
of directories to search, just as the shell does when looking for a
program to run.
<P>
<DT><CODE>symbol-file <VAR>filename</VAR></CODE>
<DD><A NAME="IDX11"></A>
Read symbol table information from file <VAR>filename</VAR>. <SAMP>`PATH'</SAMP>
is searched when necessary. Most of the time you will use both the
<SAMP>`exec-file'</SAMP> and <SAMP>`symbol-file'</SAMP> commands on the same file.
<P>
<SAMP>`symbol-file'</SAMP> with no argument clears out GDB's symbol table.
</P><P>
<DT><CODE>core-file <VAR>filename</VAR></CODE>
<DD><A NAME="IDX12"></A>
Specify the whereabouts of a core dump file to be used as the
"contents of memory". Note that the core dump contains only the
writable parts of memory; the read-only parts must come from the
executable file.
<P>
<SAMP>`core-file'</SAMP> with no argument specifies that no core file is
to be used.
</P><P>
<DT><CODE>add-file <VAR>filename</VAR> <VAR>address</VAR></CODE>
<DD><A NAME="IDX13"></A>
The <SAMP>`add-file'</SAMP> command takes two arguments, a file name, and the
address at which that file has been (or should be) dynamically loaded.
GDB will then treat that file as though it had always been dynamically
linked, and provide the user with all the normal GDB features, including
symbolic debugging.
<P>
With the <SAMP>`add-file'</SAMP> command, it is possible to debug code which was
not present in the initial load image of the program under test.
Suppose you have a program which can, while running, dynamically link a
program fragment into its address space. One program which does this is
KCL, a free common lisp implementation. The fragment will be loaded
into the main program's address space at some address, and the main
program can then call functions within the fragment by calculating (or
otherwise obtaining) their addresses.
</P><P>
<DT><CODE>kill</CODE>
<DD><A NAME="IDX14"></A>
Cancel running the program under GDB. This could be used if you wish
to debug a core dump instead. GDB ignores any core dump file if it is
actually running the program, so the <SAMP>`kill'</SAMP> command is the only
sure way to go back to using the core dump file.
<P>
<DT><CODE>info files</CODE>
<DD><A NAME="IDX15"></A>
Print the names of the executable and core dump files currently in
use by GDB, and the file from which symbols were loaded.
</DL>
<P>
While all three file-specifying commands allow both absolute and relative
file names as arguments, GDB always converts the file name to an absolute
one and remembers it that way.
</P><P>
The <SAMP>`symbol-file'</SAMP> command causes GDB to forget the contents of its
convenience variables, the value history, and all breakpoints and
auto-display expressions. This is because they may contain pointers to the
internal data recording symbols and data types, which are part of the old
symbol table data being discarded inside GDB.
</P><P>
<A NAME="Options"></A>
<HR SIZE="6">
<A NAME="SEC9"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC8"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC10"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC6"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC13"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 3. Options and Arguments for GDB </H1>
<!--docid::SEC9::-->
<P>
When you invoke GDB, you can pass commands telling it what files to
operate on and what other things to do.
</P><P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC10">3.1 Mode Options</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Options controlling modes of operation.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC11">3.2 File-specifying Options</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Options to specify files (executable, coredump, commands)</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC12">3.3 Other Arguments</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Any other arguments without options
also specify files.</TD></TR>
</TABLE></BLOCKQUOTE>
<P>
<A NAME="Mode Options"></A>
<HR SIZE="6">
<A NAME="SEC10"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC9"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC11"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC9"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC9"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC13"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 3.1 Mode Options </H2>
<!--docid::SEC10::-->
<P>
<DL COMPACT>
<DT><SAMP>`-nx'</SAMP>
<DD>Do not execute commands from the init files <TT>`.gdbinit'</TT>.
Normally, the commands in these files are executed after all the
command options and arguments have been processed. See section <A HREF="gdb.html#SEC59">12.2 Command Files</A>.
<P>
<DT><SAMP>`-q'</SAMP>
<DD>"Quiet". Do not print the usual introductory messages.
<P>
<DT><SAMP>`-batch'</SAMP>
<DD>Run in batch mode. Exit with code 1 after processing all the command
files specified with <SAMP>`-x'</SAMP> (and <TT>`.gdbinit'</TT>, if not
inhibited). Exit also if, due to an error, GDB would otherwise
attempt to read a command from the terminal.
<P>
<DT><SAMP>`-fullname'</SAMP>
<DD>This option is used when Emacs runs GDB as a subprocess. It tells GDB
to output the full file name and line number in a standard,
recognizable fashion each time a stack frame is displayed (which
includes each time the program stops). This recognizable format looks
like two <SAMP>`\032'</SAMP> characters, followed by the filename, line number
and character position separated by colons, and a newline. The
Emacs-to-GDB interface program uses the two <SAMP>`\032'</SAMP> characters as
a signal to display the source code for the frame.
</DL>
<P>
<A NAME="File Options"></A>
<HR SIZE="6">
<A NAME="SEC11"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC10"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC12"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC9"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC9"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC13"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 3.2 File-specifying Options </H2>
<!--docid::SEC11::-->
<P>
All the options and command line arguments given are processed
in sequential order. The order makes a difference when the
<SAMP>`-x'</SAMP> command is used.
</P><P>
<DL COMPACT>
<DT><SAMP>`-s <VAR>file</VAR>'</SAMP>
<DD>Read symbol table from file <VAR>file</VAR>.
<P>
<DT><SAMP>`-e <VAR>file</VAR>'</SAMP>
<DD>Use file <VAR>file</VAR> as the executable file to execute when
appropriate, and for examining pure data in conjunction with a core
dump.
<P>
<DT><SAMP>`-se <VAR>file</VAR>'</SAMP>
<DD>Read symbol table from file <VAR>file</VAR> and use it as the executable
file.
<P>
<DT><SAMP>`-c <VAR>file</VAR>'</SAMP>
<DD>Use file <VAR>file</VAR> as a core dump to examine.
<P>
<DT><SAMP>`-x <VAR>file</VAR>'</SAMP>
<DD>Execute GDB commands from file <VAR>file</VAR>.
<P>
<DT><SAMP>`-d <VAR>directory</VAR>'</SAMP>
<DD>Add <VAR>directory</VAR> to the path to search for source files.
</DL>
<P>
<A NAME="Other Arguments"></A>
<HR SIZE="6">
<A NAME="SEC12"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC11"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC13"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC9"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC9"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC13"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 3.3 Other Arguments </H2>
<!--docid::SEC12::-->
<P>
If there are arguments to GDB that are not options or associated with
options, the first one specifies the symbol table and executable file name
(as if it were preceded by <SAMP>`-se'</SAMP>) and the second one specifies a core
dump file name (as if it were preceded by <SAMP>`-c'</SAMP>).
</P><P>
<A NAME="Compilation"></A>
<HR SIZE="6">
<A NAME="SEC13"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC12"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC14"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC9"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC14"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 4. Compiling Your Program for Debugging </H1>
<!--docid::SEC13::-->
<P>
In order to debug a program effectively, you need to ask for debugging
information when you compile it. This information in the object file
describes the data type of each variable or function and the correspondence
between source line numbers and addresses in the executable code.
</P><P>
To request debugging information, specify the <SAMP>`-g'</SAMP> option when you run
the compiler.
</P><P>
The Unix C compiler is unable to handle the <SAMP>`-g'</SAMP> and <SAMP>`-O'</SAMP> options
together. This means that you cannot ask for optimization if you ask for
debugger information.
</P><P>
The GNU C compiler supports <SAMP>`-g'</SAMP> with or without <SAMP>`-O'</SAMP>, making it
possible to debug optimized code. We recommend that you <EM>always</EM> use
<SAMP>`-g'</SAMP> whenever you compile a program. You may think the program is
correct, but there's no sense in pushing your luck.
</P><P>
If you are using the GNU C compiler, the GNU assembler and the GNU linker,
you can choose between two formats of debugging information: the standard
Unix format, which is what you get with <SAMP>`-g'</SAMP>, and GDB's own format,
which you request by using <SAMP>`-gg'</SAMP> instead of <SAMP>`-g'</SAMP>. This stores
debugging information in the executable file in a format much like that
which is used inside GDB. This has these advantages and disadvantages:
</P><P>
<UL>
<LI>
GDB can read <SAMP>`-gg'</SAMP> format more than twice as fast as Unix
<SAMP>`-g'</SAMP> format.
<P>
<LI>
The <SAMP>`-gg'</SAMP> format uses much more disk space than Unix format.
<P>
<LI>
The Unix debuggers can understand only Unix format, so you cannot use
Unix source-level debuggers if you compile with <SAMP>`-gg'</SAMP>. (The
<CODE>adb</CODE> debugger works with either format; it does not use this
information in any case.)
</UL>
<P>
<A NAME="Running"></A>
<HR SIZE="6">
<A NAME="SEC14"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC13"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC15"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC13"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC20"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 5. Running Your Program Under GDB </H1>
<!--docid::SEC14::-->
<P>
<A NAME="IDX16"></A>
<A NAME="IDX17"></A>
To start your program under GDB, use the <SAMP>`run'</SAMP> command. The program
must already have been specified using the <SAMP>`exec-file'</SAMP> command or with
an argument to GDB (see section <A HREF="gdb.html#SEC6">2. Specifying GDB's Files</A>); what <SAMP>`run'</SAMP> does is create an
inferior process, load the program into it, and set it in motion.
</P><P>
The execution of a program is affected by certain information it receives
from its superior. GDB provides ways to specify them, which you must do
<I>before</I> starting the program. (You can change them after starting the
program, but such changes do not affect the program unless you start it
over again.)
</P><P>
<DL COMPACT>
<DT>The <I>arguments.</I>
<DD>You specify the arguments to give the program as the arguments of the
<SAMP>`run'</SAMP> command.
<P>
<DT>The <I>environment.</I>
<DD>The program normally inherits its environment from GDB, but you can
use the GDB commands <SAMP>`set environment'</SAMP> and
<SAMP>`unset environment'</SAMP> to change parts of the environment that will
be given to the program.<P>
<DT>The <I>working directory.</I>
<DD>The program inherits its working directory from GDB. You can set GDB's
working directory with the <SAMP>`cd'</SAMP> command in GDB.
</DL>
<P>
After the <SAMP>`run'</SAMP> command, the debugger does nothing but wait for your
program to stop. See section <A HREF="gdb.html#SEC20">6. Stopping and Continuing</A>.
</P><P>
Note that once your program has been started by the <SAMP>`run'</SAMP> command,
you may evaluate expressions that involve calls to functions in the
inferior. See section <A HREF="gdb.html#SEC41">9.1 Expressions</A>. If you wish to evaluate a function
simply for it's side affects, you may use the <SAMP>`set'</SAMP> command.
See section <A HREF="gdb.html#SEC53">11.1 Assignment to Variables</A>.
</P><P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC15">5.1 Your Program's Arguments</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Specifying the arguments for your program.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC16">5.2 Your Program's Environment</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Specifying the environment for your program.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC17">5.3 Your Program's Working Directory</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Specifying the working directory for giving
to your program when it is run.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC18">5.4 Your Program's Input and Output</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Specifying the program's standard input and output.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC19">5.5 Debugging an Already-Running Process</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Debugging a process started outside GDB.</TD></TR>
</TABLE></BLOCKQUOTE>
<P>
<A NAME="Arguments"></A>
<HR SIZE="6">
<A NAME="SEC15"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC14"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC16"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC14"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC14"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC20"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 5.1 Your Program's Arguments </H2>
<!--docid::SEC15::-->
<P>
<A NAME="IDX18"></A>
You specify the arguments to give the program as the arguments of the
<SAMP>`run'</SAMP> command. They are passed to a shell, which expands wildcard
characters and performs redirection of I/O, and thence to the program.
</P><P>
<SAMP>`run'</SAMP> with no arguments uses the same arguments used by the previous
<SAMP>`run'</SAMP>.
</P><P>
<A NAME="IDX19"></A>
The command <SAMP>`set args'</SAMP> can be used to specify the arguments to be used
the next time the program is run. If <SAMP>`set args'</SAMP> has no arguments, it
means to use no arguments the next time the program is run. If you have
run your program with arguments and want to run it again with no arguments,
this is the only way to do so.
</P><P>
<A NAME="Environment"></A>
<HR SIZE="6">
<A NAME="SEC16"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC15"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC17"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC14"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC14"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC20"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 5.2 Your Program's Environment </H2>
<!--docid::SEC16::-->
<P>
<A NAME="IDX20"></A>
The <EM>environment</EM> consists of a set of <EM>environment variables</EM> and
their values. Environment variables conventionally record such things as
your user name, your home directory, your terminal type, and your search
path for programs to run. Usually you set up environment variables with
the shell and they are inherited by all the other programs you run. When
debugging, it can be useful to try running the program with different
environments without having to start the debugger over again.
</P><P>
<DL COMPACT>
<DT><CODE>info environment <VAR>varname</VAR></CODE>
<DD><A NAME="IDX21"></A>
Print the value of environment variable <VAR>varname</VAR> to be given to
your program when it is started. This command can be abbreviated
<SAMP>`i env <VAR>varname</VAR>'</SAMP>.
<P>
<DT><CODE>info environment</CODE>
<DD>Print the names and values of all environment variables to be given to
your program when it is started. This command can be abbreviated
<SAMP>`i env'</SAMP>.
<P>
<DT><CODE>set environment <VAR>varname</VAR> <VAR>value</VAR></CODE>
<DD><DT><CODE>set environment <VAR>varname</VAR> = <VAR>value</VAR></CODE>
<DD><A NAME="IDX22"></A>
Sets environment variable <VAR>varname</VAR> to <VAR>value</VAR>, for your program
only, not for GDB itself. <VAR>value</VAR> may be any string; the values of
environment variables are just strings, and any interpretation is
supplied by your program itself. The <VAR>value</VAR> parameter is optional;
if it is eliminated, the variable is set to a null value. This command
can be abbreviated as short as <SAMP>`set e'</SAMP>.
<P>
<DT><CODE>delete environment <VAR>varname</VAR></CODE>
<DD><A NAME="IDX23"></A>
<DT><CODE>unset environment <VAR>varname</VAR></CODE>
<DD><A NAME="IDX24"></A>
Remove variable <VAR>varname</VAR> from the environment to be passed to
your program. This is different from <SAMP>`set env <VAR>varname</VAR> ='</SAMP>
because <SAMP>`delete environment'</SAMP> makes a variable not be defined at
all, which is distinguishable from an empty value. This command can
be abbreviated <SAMP>`d e'</SAMP>.
</DL>
<P>
<A NAME="Working Directory"></A>
<HR SIZE="6">
<A NAME="SEC17"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC16"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC18"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC14"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC14"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC20"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 5.3 Your Program's Working Directory </H2>
<!--docid::SEC17::-->
<P>
<A NAME="IDX25"></A>
Each time you start your program with <SAMP>`run'</SAMP>, it inherits its working
directory from the current working directory of GDB. GDB's working
directory is initially whatever it inherited from its superior, but you can
specify the working directory for GDB with the <SAMP>`cd'</SAMP> command.
</P><P>
The GDB working directory also serves as a default for the commands
that specify files for GDB to operate on. See section <A HREF="gdb.html#SEC6">2. Specifying GDB's Files</A>.
</P><P>
<DL COMPACT>
<DT><CODE>cd <VAR>directory</VAR></CODE>
<DD><A NAME="IDX26"></A>
Set GDB's working directory to <VAR>directory</VAR>.
<P>
<DT><CODE>pwd</CODE>
<DD><A NAME="IDX27"></A>
Print GDB's working directory.
</DL>
<P>
<A NAME="Input/Output"></A>
<HR SIZE="6">
<A NAME="SEC18"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC17"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC19"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC14"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC14"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC20"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 5.4 Your Program's Input and Output </H2>
<!--docid::SEC18::-->
<P>
<A NAME="IDX28"></A>
<A NAME="IDX29"></A>
By default, the program you run under GDB does input and output to the same
terminal that GDB uses.
</P><P>
You can redirect the program's input and/or output using <SAMP>`sh'</SAMP>-style
redirection commands in the <SAMP>`run'</SAMP> command. For example,
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>run &#62; outfile
</pre></td></tr></table></P><P>
starts the program, diverting its output to the file <TT>`outfile'</TT>.
</P><P>
<A NAME="IDX30"></A>
Another way to specify where the program should do input and output is with
the <SAMP>`tty'</SAMP> command. This command accepts a file name as argument, and
causes this file to be the default for future <SAMP>`run'</SAMP> commands. It also
resets the controlling terminal for future <SAMP>`run'</SAMP> commands. For
example,
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>tty /dev/ttyb
</pre></td></tr></table></P><P>
directs that processes started with subsequent <SAMP>`run'</SAMP> commands default
to do input and output on the terminal <TT>`/dev/ttyb'</TT> and sets the
controlling terminal to <TT>`/dev/ttyb'</TT>. An explicit redirection in
<SAMP>`run'</SAMP> overrides the <SAMP>`tty'</SAMP> command's effect on input/output
redirection.
</P><P>
When you use the <SAMP>`tty'</SAMP> command or redirect input in the <SAMP>`run'</SAMP>
command, the <EM>input for your program</EM> comes from the specified file,
but the input for GDB still comes from your terminal.
</P><P>
<A NAME="Attach"></A>
<HR SIZE="6">
<A NAME="SEC19"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC18"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC20"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC14"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC14"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC20"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 5.5 Debugging an Already-Running Process </H2>
<!--docid::SEC19::-->
<P>
Some operating systems (in particular, Sun) allow GDB to begin debugging an
already-running process that was started outside of GDB. To do this you
must use the <SAMP>`attach'</SAMP> command instead of the <SAMP>`run'</SAMP> command.
</P><P>
The <SAMP>`attach'</SAMP> command requires one argument, which is the process-id of
the process you want to debug. (The usual way to find out the process-id
of the process is with the <SAMP>`ps'</SAMP> utility.)
</P><P>
The first thing GDB does after arranging to debug the process is to stop
it. You can examine and modify an attached process with all the GDB
commands that ordinarily available when you start processes with
<SAMP>`run'</SAMP>. You can insert breakpoints; you can step and continue; you
can modify storage. If you would rather the process continue running,
use the <SAMP>`continue'</SAMP> command after attaching.
</P><P>
When you are finished debugging the attached process, you can use the
<SAMP>`detach'</SAMP> command to release it from GDB's control. Detaching
the process continues its execution. After the <SAMP>`detach'</SAMP> command,
that process and GDB become completely independent once more, and you
are ready to <SAMP>`attach'</SAMP> another process or start one with <SAMP>`run'</SAMP>.
</P><P>
If you exit GDB or use the <SAMP>`run'</SAMP> command while you have an attached
process, you kill that process. You will be asked for confirmation if you
try to do either of these things.
</P><P>
<A NAME="Stopping"></A>
<HR SIZE="6">
<A NAME="SEC20"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC19"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC21"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC14"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC31"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 6. Stopping and Continuing </H1>
<!--docid::SEC20::-->
<P>
When you run a program normally, it runs until exiting. The purpose
of using a debugger is so that you can stop it before that point;
or so that if the program runs into trouble you can find out why.
</P><P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC21">6.1 Signals</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Fatal signals in your program just stop it;
then you can use GDB to see what is going on.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC22">6.2 Breakpoints</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Breakpoints let you stop your program when it
reaches a specified point in the code.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC29">6.3 Continuing</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Resuming execution until the next signal or breakpoint.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC30">6.4 Stepping</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Stepping runs the program a short distance and
then stops it wherever it has come to.</TD></TR>
</TABLE></BLOCKQUOTE>
<P>
<A NAME="Signals"></A>
<HR SIZE="6">
<A NAME="SEC21"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC20"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC22"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC20"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC20"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC31"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 6.1 Signals </H2>
<!--docid::SEC21::-->
<P>
A signal is an asynchronous event that can happen in a program. The
operating system defines the possible kinds of signals, and gives each kind
a name and a number. For example, <CODE>SIGINT</CODE> is the signal a program
gets when you type <KBD>Ctrl-c</KBD>; <CODE>SIGSEGV</CODE> is the signal a program
gets from referencing a place in memory far away from all the areas in use;
<CODE>SIGALRM</CODE> occurs when the alarm clock timer goes off (which happens
only if the program has requested an alarm).
</P><P>
Some signals, including <CODE>SIGALRM</CODE>, are a normal part of the
functioning of the program. Others, such as <CODE>SIGSEGV</CODE>, indicate
errors; these signals are <EM>fatal</EM> (kill the program immediately) if the
program has not specified in advance some other way to handle the signal.
<CODE>SIGINT</CODE> does not indicate an error in the program, but it is normally
fatal so it can carry out the purpose of <KBD>Ctrl-c</KBD>: to kill the program.
</P><P>
GDB has the ability to detect any occurrence of a signal in the program
running under GDB's control. You can tell GDB in advance what to do for
each kind of signal.
</P><P>
Normally, GDB is set up to ignore non-erroneous signals like <CODE>SIGALRM</CODE>
(so as not to interfere with their role in the functioning of the program)
but to stop the program immediately whenever an error signal happens.
You can change these settings with the <SAMP>`handle'</SAMP> command. You must
specify which signal you are talking about with its number.
</P><P>
<DL COMPACT>
<DT><CODE>info signal</CODE>
<DD><A NAME="IDX31"></A>
Print a table of all the kinds of signals and how GDB has been told to
handle each one. You can use this to see the signal numbers of all
the defined types of signals.
<P>
<DT><CODE>handle <VAR>signalnum</VAR> <VAR>keywords</VAR><small>...</small></CODE>
<DD><A NAME="IDX32"></A>
Change the way GDB handles signal <VAR>signalnum</VAR>. The <VAR>keywords</VAR>
say what change to make.
</DL>
<P>
To use the <SAMP>`handle'</SAMP> command you must know the code number of the
signal you are concerned with. To find the code number, type <SAMP>`info
signal'</SAMP> which prints a table of signal names and numbers.
</P><P>
The keywords allowed by the handle command can be abbreviated. Their full
names are
</P><P>
<DL COMPACT>
<DT><CODE>stop</CODE>
<DD>GDB should stop the program when this signal happens. This implies
the <SAMP>`print'</SAMP> keyword as well.
<P>
<DT><CODE>print</CODE>
<DD>GDB should print a message when this signal happens.
<P>
<DT><CODE>nostop</CODE>
<DD>GDB should not stop the program when this signal happens. It may
still print a message telling you that the signal has come in.
<P>
<DT><CODE>noprint</CODE>
<DD>GDB should not mention the occurrence of the signal at all. This
implies the <SAMP>`nostop'</SAMP> keyword as well.
<P>
<DT><CODE>pass</CODE>
<DD>GDB should allow the program to see this signal; the program will be
able to handle the signal, or may be terminated if the signal is fatal
and not handled.
<P>
<DT><CODE>nopass</CODE>
<DD>GDB should not allow the program to see this signal.
</DL>
<P>
When a signal has been set to stop the program, the program cannot see the
signal until you continue. It will see the signal then, if <SAMP>`pass'</SAMP> is
in effect for the signal in question <I>at that time</I>. In other words,
after GDB reports a signal, you can use the <SAMP>`handle'</SAMP> command with
<SAMP>`pass'</SAMP> or <SAMP>`nopass'</SAMP> to control whether that signal will be seen by
the program when you later continue it.
</P><P>
You can also use the <SAMP>`signal'</SAMP> command to prevent the program from
seeing a signal, or cause it to see a signal it normally would not see,
or to give it any signal at any time. See section <A HREF="gdb.html#SEC55">11.3 Giving the Program a Signal</A>.
</P><P>
<A NAME="Breakpoints"></A>
<HR SIZE="6">
<A NAME="SEC22"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC21"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC23"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC20"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC20"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC29"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 6.2 Breakpoints </H2>
<!--docid::SEC22::-->
<P>
<A NAME="IDX33"></A>
A <EM>breakpoint</EM> makes your program stop whenever a certain point in the
program is reached. You set breakpoints explicitly with GDB commands,
specifying the place where the program should stop by line number, function
name or exact address in the program. You can add various other conditions
to control whether the program will stop.
</P><P>
Each breakpoint is assigned a number when it is created; these numbers are
successive integers starting with 1. In many of the commands for controlling
various features of breakpoints you use the breakpoint number to say which
breakpoint you want to change. Each breakpoint may be <EM>enabled</EM> or
<EM>disabled</EM>; if disabled, it has no effect on the program until you
enable it again.
</P><P>
<A NAME="IDX34"></A>
<A NAME="IDX35"></A>
The command <SAMP>`info break'</SAMP> prints a list of all breakpoints set and not
cleared, showing their numbers, where in the program they are, and any
special features in use for them. Disabled breakpoints are included in the
list, but marked as disabled. <SAMP>`info break'</SAMP> with a breakpoint number
as argument lists only that breakpoint. The convenience variable <SAMP>`$_'</SAMP>
and the default examining-address for the <SAMP>`x'</SAMP> command are set to the
address of the last breakpoint listed (see section <A HREF="gdb.html#SEC45">9.4.1 Examining Memory</A>).
</P><P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC23">6.2.1 Setting Breakpoints</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">How to establish breakpoints.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC24">6.2.2 Clearing Breakpoints</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">How to remove breakpoints no longer needed.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC25">6.2.3 Disabling Breakpoints</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">How to disable breakpoints (turn them off temporarily).</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC26">6.2.4 Break Conditions</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Making extra conditions on whether to stop.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC27">6.2.5 Commands Executed on Breaking</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Commands to be executed at a breakpoint.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC28">6.2.6 "Cannot Insert Breakpoints" Error</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">"Cannot insert breakpoints" error--why, what to do.</TD></TR>
</TABLE></BLOCKQUOTE>
<P>
<A NAME="Set Breaks"></A>
<HR SIZE="6">
<A NAME="SEC23"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC22"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC24"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC21"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC22"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC29"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 6.2.1 Setting Breakpoints </H3>
<!--docid::SEC23::-->
<P>
<A NAME="IDX36"></A>
Breakpoints are set with the <SAMP>`break'</SAMP> command (abbreviated <SAMP>`b'</SAMP>).
You have several ways to say where the breakpoint should go.
</P><P>
<DL COMPACT>
<DT><CODE>break <VAR>function</VAR></CODE>
<DD>Set a breakpoint at entry to function <VAR>function</VAR>.
<P>
<DT><CODE>break <VAR>linenum</VAR></CODE>
<DD>Set a breakpoint at line <VAR>linenum</VAR> in the current source file.
That file is the last file whose source text was printed. This
breakpoint will stop the program just before it executes any of the
code on that line.
<P>
<DT><CODE>break <VAR>filename</VAR>:<VAR>linenum</VAR></CODE>
<DD>Set a breakpoint at line <VAR>linenum</VAR> in source file <VAR>filename</VAR>.
<P>
<DT><CODE>break <VAR>filename</VAR>:<VAR>function</VAR></CODE>
<DD>Set a breakpoint at entry to function <VAR>function</VAR> found in file
<VAR>filename</VAR>. Specifying a filename as well as a function name is
superfluous except when multiple files contain similarly named
functions.
<P>
<DT><CODE>break *<VAR>address</VAR></CODE>
<DD>Set a breakpoint at address <VAR>address</VAR>. You can use this to set
breakpoints in parts of the program which do not have debugging
information or source files.
<P>
<DT><CODE>break</CODE>
<DD>Set a breakpoint at the next instruction to be executed in the selected
stack frame (see section <A HREF="gdb.html#SEC31">7. Examining the Stack</A>). In any selected frame but the innermost,
this will cause the program to stop as soon as control returns to that
frame. This is equivalent to a <SAMP>`finish'</SAMP> command in the frame
inside the selected frame. If this is done in the innermost frame gdb
will stop the next time it reaches the current location; this may be
useful inside of loops. It does not stop at this breakpoint immediately
upon continuation of the program since no code would be executed if it
did.
<P>
<DT><CODE>break <small>...</small> if <VAR>cond</VAR></CODE>
<DD>Set a breakpoint with condition <VAR>cond</VAR>; evaluate the expression
<VAR>cond</VAR> each time the breakpoint is reached, and stop only if the
value is nonzero. <SAMP>`<small>...</small>'</SAMP> stands for one of the possible
arguments described above (or no argument) specifying where to break.
See section <A HREF="gdb.html#SEC26">6.2.4 Break Conditions</A>, for more information on breakpoint conditions.
<P>
<DT><CODE>tbreak <VAR>args</VAR></CODE>
<DD><A NAME="IDX37"></A>
Set a breakpoint enabled only for one stop. <VAR>args</VAR> are the
same as in the <SAMP>`break'</SAMP> command, and the breakpoint is set in the same
way, but the breakpoint is automatically <EM>disabled</EM> the first time it
is hit.
</DL>
<P>
GDB allows you to set any number of breakpoints at the same place in the
program. There is nothing silly or meaningless about this. When the
breakpoints are conditional, this is even useful (see section <A HREF="gdb.html#SEC26">6.2.4 Break Conditions</A>).
</P><P>
<A NAME="Clear Breaks"></A>
<HR SIZE="6">
<A NAME="SEC24"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC23"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC25"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC21"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC22"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC29"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 6.2.2 Clearing Breakpoints </H3>
<!--docid::SEC24::-->
<P>
<A NAME="IDX38"></A>
<A NAME="IDX39"></A>
It is often necessary to eliminate a breakpoint once it has done its job
and you no longer want the program to stop there. This is called
<EM>clearing</EM> or <SAMP>`deleting'</SAMP> the breakpoint. A breakpoint that
has been cleared no longer exists in any sense.
</P><P>
With the <SAMP>`clear'</SAMP> command you can clear breakpoints according to where
they are in the program. With the <SAMP>`delete'</SAMP> command you can clear
individual breakpoints by specifying their breakpoint numbers.
</P><P>
<B>It is not necessary to clear a breakpoint to proceed past it.</B> GDB
automatically ignores breakpoints in the first instruction to be executed
when you continue execution at the same address where the program stopped.
</P><P>
<DL COMPACT>
<DT><CODE>clear</CODE>
<DD><A NAME="IDX40"></A>
Clear any breakpoints at the next instruction to be executed in the
selected stack frame (see section <A HREF="gdb.html#SEC34">7.3 Selecting a Frame</A>). When the innermost frame
is selected, this is a good way to clear a breakpoint that the program
just stopped at.
<P>
<DT><CODE>clear <VAR>function</VAR></CODE>
<DD><DT><CODE>clear <VAR>filename</VAR>:<VAR>function</VAR></CODE>
<DD>Clear any breakpoints set at entry to the function <VAR>function</VAR>.
<P>
<DT><CODE>clear <VAR>linenum</VAR></CODE>
<DD><DT><CODE>clear <VAR>filename</VAR>:<VAR>linenum</VAR></CODE>
<DD>Clear any breakpoints set at or within the code of the specified line.
<P>
<DT><CODE>delete <VAR>bnums</VAR><small>...</small></CODE>
<DD><A NAME="IDX41"></A>
Delete the breakpoints of the numbers specified as arguments.
A breakpoint deleted is forgotten completely.
</DL>
<P>
<A NAME="Disabling"></A>
<HR SIZE="6">
<A NAME="SEC25"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC24"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC26"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC21"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC22"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC29"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 6.2.3 Disabling Breakpoints </H3>
<!--docid::SEC25::-->
<P>
<A NAME="IDX42"></A>
<A NAME="IDX43"></A>
Rather than clearing a breakpoint, you might prefer to <EM>disable</EM> it.
This makes the breakpoint inoperative as if it had been cleared, but
remembers the information on the breakpoint so that you can <EM>enable</EM>
it again later.
</P><P>
You disable and enable breakpoints with the <SAMP>`enable'</SAMP> and
<SAMP>`disable'</SAMP> commands, specifying one or more breakpoint numbers as
arguments. Use <SAMP>`info break'</SAMP> to print a list of breakpoints if you
don't know which breakpoint numbers to use.
</P><P>
A breakpoint can have any of four different states of enablement:
</P><P>
<UL>
<LI>
Enabled. The breakpoint will stop the program. A breakpoint made
with the <SAMP>`break'</SAMP> command starts out in this state.
<LI>
Disabled. The breakpoint has no effect on the program.
<LI>
Enabled once. The breakpoint will stop the program, but
when it does so it will become disabled. A breakpoint made
with the <SAMP>`tbreak'</SAMP> command starts out in this state.
<LI>
Enabled for deletion. The breakpoint will stop the program, but
immediately after it does so it will be deleted permanently.
</UL>
<P>
You change the state of enablement of a breakpoint with the following
commands:
</P><P>
<DL COMPACT>
<DT><CODE>disable breakpoints <VAR>bnums</VAR><small>...</small></CODE>
<DD><A NAME="IDX44"></A>
<DT><CODE>disable <VAR>bnums</VAR><small>...</small></CODE>
<DD><A NAME="IDX45"></A>
Disable the specified breakpoints. A disabled breakpoint has no
effect but is not forgotten. All options such as ignore-counts,
conditions and commands are remembered in case the breakpoint is
enabled again later.
<P>
<DT><CODE>enable breakpoints <VAR>bnums</VAR><small>...</small></CODE>
<DD><A NAME="IDX46"></A>
<DT><CODE>enable <VAR>bnums</VAR><small>...</small></CODE>
<DD><A NAME="IDX47"></A>
Enable the specified breakpoints. They become effective once again in
stopping the program, until you specify otherwise.
<P>
<DT><CODE>enable breakpoints once <VAR>bnums</VAR><small>...</small></CODE>
<DD><DT><CODE>enable once <VAR>bnums</VAR><small>...</small></CODE>
<DD>Enable the specified breakpoints temporarily. Each will be disabled
again the next time it stops the program (unless you have used one of
these commands to specify a different state before that time comes).
<P>
<DT><CODE>enable breakpoints delete <VAR>bnums</VAR><small>...</small></CODE>
<DD><DT><CODE>enable delete <VAR>bnums</VAR><small>...</small></CODE>
<DD>Enable the specified breakpoints to work once and then die. Each of
the breakpoints will be deleted the next time it stops the program
(unless you have used one of these commands to specify a different
state before that time comes).
</DL>
<P>
Aside from the automatic disablement or deletion of a breakpoint when it
stops the program, which happens only in certain states, the state of
enablement of a breakpoint changes only when one of the commands above
is used.
</P><P>
<A NAME="Conditions"></A>
<HR SIZE="6">
<A NAME="SEC26"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC25"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC27"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC21"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC22"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC29"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 6.2.4 Break Conditions </H3>
<!--docid::SEC26::-->
<P>
<A NAME="IDX48"></A>
The simplest sort of breakpoint breaks every time the program reaches a
specified place. You can also specify a <EM>condition</EM> for a breakpoint.
A condition is just a boolean expression in your programming language
(See section <A HREF="gdb.html#SEC41">9.1 Expressions</A>). A breakpoint with a condition evaluates the
expression each time the program reaches it, and the program stops
only if the condition is true.
</P><P>
Break conditions may have side effects, and may even call functions in your
program. These may sound like strange things to do, but their effects are
completely predictable unless there is another enabled breakpoint at the
same address. (In that case, GDB might see the other breakpoint first and
stop the program without checking the condition of this one.) Note that
breakpoint commands are usually more convenient and flexible for the
purpose of performing side effects when a breakpoint is reached
(see section <A HREF="gdb.html#SEC27">6.2.5 Commands Executed on Breaking</A>).
</P><P>
Break conditions can be specified when a breakpoint is set, by using
<SAMP>`if'</SAMP> in the arguments to the <SAMP>`break'</SAMP> command. See section <A HREF="gdb.html#SEC23">6.2.1 Setting Breakpoints</A>.
They can also be changed at any time with the <SAMP>`condition'</SAMP> command:
</P><P>
<DL COMPACT>
<DT><CODE>condition <VAR>bnum</VAR> <VAR>expression</VAR></CODE>
<DD><A NAME="IDX49"></A>
Specify <VAR>expression</VAR> as the break condition for breakpoint number
<VAR>bnum</VAR>. From now on, this breakpoint will stop the program only if
the value of <VAR>expression</VAR> is true (nonzero, in C). <VAR>expression</VAR>
is not evaluated at the time the <SAMP>`condition'</SAMP> command is given.
See section <A HREF="gdb.html#SEC41">9.1 Expressions</A>.
<P>
<DT><CODE>condition <VAR>bnum</VAR></CODE>
<DD>Remove the condition from breakpoint number <VAR>bnum</VAR>. It becomes
an ordinary unconditional breakpoint.
</DL>
<P>
<A NAME="IDX50"></A>
A special feature is provided for one kind of condition: to prevent the
breakpoint from doing anything until it has been reached a certain number
of times. This is done with the <EM>ignore count</EM> of the breakpoint.
When the program reaches a breakpoint whose ignore count is positive, then
instead of stopping, it just decrements the ignore count by one and
continues.
</P><P>
<DL COMPACT>
<DT><CODE>ignore <VAR>bnum</VAR> <VAR>count</VAR></CODE>
<DD><A NAME="IDX51"></A>
Set the ignore count of breakpoint number <VAR>bnum</VAR> to <VAR>count</VAR>.
The next <VAR>count</VAR> times the breakpoint is reached, it will not stop.
<P>
To make the breakpoint stop the next time it is reached, specify
a count of zero.
</P><P>
<DT><CODE>cont <VAR>count</VAR></CODE>
<DD>Continue execution of the program, setting the ignore count of the
breakpoint that the program stopped at to <VAR>count</VAR> minus one.
Continuing through the breakpoint does not itself count as one of
<VAR>count</VAR>. Thus, the program will not stop at this breakpoint until the
<VAR>count</VAR>'th time it is hit.
<P>
This command is allowed only when the program stopped due to a
breakpoint. At other times, the argument to <SAMP>`cont'</SAMP> is ignored.
</DL>
<P>
If a breakpoint has a positive ignore count and a condition, the condition
is not checked. Once the ignore count reaches zero, the condition will
start to be checked.
</P><P>
Note that you could achieve the effect of the ignore count with a condition
such as <SAMP>`$foo-- &#60;= 0'</SAMP> using a debugger convenience variable that is
decremented each time. That is why the ignore count is considered a
special case of a condition. See section <A HREF="gdb.html#SEC48">9.7 Convenience Variables</A>.
</P><P>
<A NAME="Break Commands"></A>
<HR SIZE="6">
<A NAME="SEC27"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC26"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC28"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC21"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC22"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC29"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 6.2.5 Commands Executed on Breaking </H3>
<!--docid::SEC27::-->
<P>
<A NAME="IDX52"></A>
You can give any breakpoint a series of commands to execute when the
program stops due to that breakpoint. For example, you might want to
print the values of certain expressions, or enable other breakpoints.
</P><P>
<DL COMPACT>
<DT><CODE>commands <VAR>bnum</VAR></CODE>
<DD>Specify commands for breakpoint number <VAR>bnum</VAR>. The commands
themselves appear on the following lines. Type a line containing just
<SAMP>`end'</SAMP> to terminate the commands.
<P>
To remove all commands from a breakpoint, use the command
<SAMP>`commands'</SAMP> and follow it immediately by <SAMP>`end'</SAMP>; that is, give
no commands.
</P><P>
With no arguments, <SAMP>`commands'</SAMP> refers to the last breakpoint set.
</DL>
<P>
It is possible for breakpoint commands to start the program up again.
Simply use the <SAMP>`cont'</SAMP> command, or <SAMP>`step'</SAMP>, or any other command
to resume execution. However, any remaining breakpoint commands are
ignored. When the program stops again, GDB will act according to why
that stop took place.
</P><P>
<A NAME="IDX53"></A>
If the first command specified is <SAMP>`silent'</SAMP>, the usual message about
stopping at a breakpoint is not printed. This may be desirable for
breakpoints that are to print a specific message and then continue.
If the remaining commands too print nothing, you will see no sign that
the breakpoint was reached at all. <SAMP>`silent'</SAMP> is not really a command;
it is meaningful only at the beginning of the commands for a breakpoint.
</P><P>
The commands <SAMP>`echo'</SAMP> and <SAMP>`output'</SAMP> that allow you to print precisely
controlled output are often useful in silent breakpoints. See section <A HREF="gdb.html#SEC60">12.3 Commands for Controlled Output</A>.
</P><P>
For example, here is how you could use breakpoint commands to print the
value of <CODE>x</CODE> at entry to <CODE>foo</CODE> whenever it is positive. We
assume that the newly created breakpoint is number 4; <SAMP>`break'</SAMP> will
print the number that is assigned.
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>break foo if x&#62;0
commands 4
silent
echo x is\040
output x
echo \n
cont
end
</pre></td></tr></table></P><P>
One application for breakpoint commands is to correct one bug so you can
test another. Put a breakpoint just after the erroneous line of code, give
it a condition to detect the case in which something erroneous has been
done, and give it commands to assign correct values to any variables that
need them. End with the <SAMP>`cont'</SAMP> command so that the program does not
stop, and start with the <SAMP>`silent'</SAMP> command so that no output is
produced. Here is an example:
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>break 403
commands 5
silent
set x = y + 4
cont
end
</pre></td></tr></table></P><P>
One deficiency in the operation of automatically continuing breakpoints
under Unix appears when your program uses raw mode for the terminal.
GDB switches back to its own terminal modes (not raw) before executing
commands, and then must switch back to raw mode when your program is
continued. This causes any pending terminal input to be lost.
</P><P>
In the GNU system, this will be fixed by changing the behavior of
terminal modes.
</P><P>
Under Unix, when you have this problem, you might be able to get around
it by putting your actions into the breakpoint condition instead of
commands. For example
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>condition 5 (x = y + 4), 0
</pre></td></tr></table></P><P>
is a condition expression (See section <A HREF="gdb.html#SEC41">9.1 Expressions</A>) that will change <CODE>x</CODE>
as needed, then always have the value 0 so the program will not stop.
Loss of input is avoided here because break conditions are evaluated
without changing the terminal modes. When you want to have nontrivial
conditions for performing the side effects, the operators <SAMP>`&#38;&#38;'</SAMP>,
<SAMP>`||'</SAMP> and <SAMP>`? <small>...</small> :'</SAMP> may be useful.
</P><P>
<A NAME="Error in Breakpoints"></A>
<HR SIZE="6">
<A NAME="SEC28"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC27"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC29"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC21"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC22"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC29"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 6.2.6 "Cannot Insert Breakpoints" Error </H3>
<!--docid::SEC28::-->
<P>
Under some Unix systems, breakpoints cannot be used in a program if any
other process is running that program. Attempting to run or continue
the program with a breakpoint in this case will cause GDB to stop it.
</P><P>
When this happens, you have three ways to proceed:
</P><P>
<OL>
<LI>
Remove or disable the breakpoints, then continue.
<P>
<LI>
Suspend GDB, and copy the file containing the program to a new name.
Resume GDB and use the <SAMP>`exec-file'</SAMP> command to specify that GDB
should run the program under that name. Then start the program again.
<P>
<LI>
Recompile the program so that the text is non-sharable (a.out format
OMAGIC).
</OL>
<P>
<A NAME="Continuing"></A>
<HR SIZE="6">
<A NAME="SEC29"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC28"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC30"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC22"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC20"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC31"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 6.3 Continuing </H2>
<!--docid::SEC29::-->
<P>
After your program stops, most likely you will want it to run some more if
the bug you are looking for has not happened yet.
</P><P>
<DL COMPACT>
<DT><CODE>cont</CODE>
<DD><A NAME="IDX54"></A>
Continue running the program at the place where it stopped.
</DL>
<P>
If the program stopped at a breakpoint, the place to continue running
is the address of the breakpoint. You might expect that continuing would
just stop at the same breakpoint immediately. In fact, <SAMP>`cont'</SAMP>
takes special care to prevent that from happening. You do not need
to clear the breakpoint to proceed through it after stopping at it.
</P><P>
You can, however, specify an ignore-count for the breakpoint that the
program stopped at, by means of an argument to the <SAMP>`cont'</SAMP> command.
See section <A HREF="gdb.html#SEC26">6.2.4 Break Conditions</A>.
</P><P>
If the program stopped because of a signal other than <CODE>SIGINT</CODE> or
<CODE>SIGTRAP</CODE>, continuing will cause the program to see that signal.
You may not want this to happen. For example, if the program stopped
due to some sort of memory reference error, you might store correct
values into the erroneous variables and continue, hoping to see more
execution; but the program would probably terminate immediately as
a result of the fatal signal once it sees the signal. To prevent this,
you can continue with <SAMP>`signal 0'</SAMP>. See section <A HREF="gdb.html#SEC55">11.3 Giving the Program a Signal</A>. You can
also act in advance to prevent the program from seeing certain kinds
of signals, using the <SAMP>`handle'</SAMP> command (see section <A HREF="gdb.html#SEC21">6.1 Signals</A>).
</P><P>
<A NAME="Stepping"></A>
<HR SIZE="6">
<A NAME="SEC30"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC29"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC31"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC20"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC20"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC31"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 6.4 Stepping </H2>
<!--docid::SEC30::-->
<P>
<A NAME="IDX55"></A>
<EM>Stepping</EM> means setting your program in motion for a limited time, so
that control will return automatically to the debugger after one line of
code or one machine instruction. Breakpoints are active during stepping
and the program will stop for them even if it has not gone as far as the
stepping command specifies.
</P><P>
<DL COMPACT>
<DT><CODE>step</CODE>
<DD><A NAME="IDX56"></A>
Proceed the program until control reaches a different line, then stop
it and return to the debugger. This command is abbreviated <SAMP>`s'</SAMP>.
<P>
<DT><CODE>step <VAR>count</VAR></CODE>
<DD>Proceed as in <SAMP>`step'</SAMP>, but do so <VAR>count</VAR> times. If a breakpoint
or a signal not related to stepping is reached before <VAR>count</VAR> steps,
stepping stops right away.
<P>
This command may be given when control is within a routine for which
there is no debugging information. In that case, execution will proceed
until control reaches a different routine, or is about to return from
this routine. An argument repeats this action.
</P><P>
<DT><CODE>next</CODE>
<DD><A NAME="IDX57"></A>
Similar to <SAMP>`step'</SAMP>, but any function calls appearing within the line of
code are executed without stopping. Execution stops when control reaches a
different line of code at the stack level which was executing when the
<SAMP>`next'</SAMP> command was given. This command is abbreviated <SAMP>`n'</SAMP>.
<P>
An argument is a repeat count, as in <SAMP>`step'</SAMP>.
</P><P>
<SAMP>`next'</SAMP> within a routine without debugging information acts as does
<SAMP>`step'</SAMP>, but any function calls appearing within the code of the
routine are executed without stopping.
</P><P>
<DT><CODE>finish</CODE>
<DD><A NAME="IDX58"></A>
Continue running until just after the selected stack frame returns
(or until there is some other reason to stop, such as a fatal signal
or a breakpoint). Print value returned by the selected stack frame (if
any).
<P>
Contrast this with the <SAMP>`return'</SAMP> command (see section <A HREF="gdb.html#SEC56">11.4 Returning from a Function</A>).
</P><P>
<DT><CODE>until</CODE>
<DD><A NAME="IDX59"></A>
Proceed the program until control reaches a line greater than the current
line, then stop is and return to the debugger. Control is also returned to
the debugger if the program exits the current stack frame. Note that this
form of the command uses single stepping, and hence is slower than
<SAMP>`until'</SAMP> with an argument. This command is abbreviated <SAMP>`u'</SAMP>.
<P>
<DT><CODE>until <VAR>location</VAR></CODE>
<DD>Proceed the program until either the specified location is reached, or the
current (innermost) stack frame returns. This form of the command uses
breakpoints, and hence is quicker than <SAMP>`until'</SAMP> without an argument.
<P>
<DT><CODE>stepi</CODE>
<DD><DT><CODE>si</CODE>
<DD><A NAME="IDX60"></A>
<A NAME="IDX61"></A>
Proceed one machine instruction, then stop and return to the debugger.
<P>
It is often useful to do <SAMP>`display/i $pc'</SAMP> when stepping by machine
instructions. This will cause the next instruction to be executed to
be displayed automatically at each stop. See section <A HREF="gdb.html#SEC46">9.5 Automatic Display</A>.
</P><P>
An argument is a repeat count, as in <SAMP>`step'</SAMP>.
</P><P>
<DT><CODE>nexti</CODE>
<DD><DT><CODE>ni</CODE>
<DD><A NAME="IDX62"></A>
<A NAME="IDX63"></A>
Proceed one machine instruction, but if it is a subroutine call,
proceed until the subroutine returns.
<P>
An argument is a repeat count, as in <SAMP>`next'</SAMP>.
</DL>
<P>
A typical technique for using stepping is to put a breakpoint
(see section <A HREF="gdb.html#SEC22">6.2 Breakpoints</A>) at the beginning of the function or the section of
the program in which a problem is believed to lie, and then step through
the suspect area, examining the variables that are interesting, until the
problem happens.
</P><P>
The <SAMP>`cont'</SAMP> command can be used after stepping to resume execution
until the next breakpoint or signal.
</P><P>
<A NAME="Stack"></A>
<HR SIZE="6">
<A NAME="SEC31"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC30"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC32"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC20"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC36"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 7. Examining the Stack </H1>
<!--docid::SEC31::-->
<P>
When your program has stopped, the first thing you need to know is where it
stopped and how it got there.
</P><P>
<A NAME="IDX64"></A>
Each time your program performs a function call, the information about
where in the program the call was made from is saved in a block of data
called a <EM>stack frame</EM>. The frame also contains the arguments of the
call and the local variables of the function that was called. All the
stack frames are allocated in a region of memory called the <EM>call
stack</EM>.
</P><P>
When your program stops, the GDB commands for examining the stack allow you
to see all of this information.
</P><P>
One of the stack frames is <EM>selected</EM> by GDB and many GDB commands
refer implicitly to the selected frame. In particular, whenever you ask
GDB for the value of a variable in the program, the value is found in the
selected frame. There are special GDB commands to select whichever frame
you are interested in.
</P><P>
When the program stops, GDB automatically selects the currently executing
frame and describes it briefly as the <SAMP>`frame'</SAMP> command does
(see section <A HREF="gdb.html#SEC35">Info</A>).
</P><P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC32">7.1 Stack Frames</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Explanation of stack frames and terminology.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC33">7.2 Backtraces</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Summarizing many frames at once.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC34">7.3 Selecting a Frame</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">How to select a stack frame.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC35">7.4 Information on a Frame</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Commands to print information on stack frames.</TD></TR>
</TABLE></BLOCKQUOTE>
<P>
<A NAME="Frames"></A>
<HR SIZE="6">
<A NAME="SEC32"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC31"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC33"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC31"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC31"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC36"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 7.1 Stack Frames </H2>
<!--docid::SEC32::-->
<P>
<A NAME="IDX65"></A>
The call stack is divided up into contiguous pieces called <EM>frames</EM>;
each frame is the data associated with one call to one function. The frame
contains the arguments given to the function, the function's local
variables, and the address at which the function is executing.
</P><P>
<A NAME="IDX66"></A>
<A NAME="IDX67"></A>
<A NAME="IDX68"></A>
When your program is started, the stack has only one frame, that of the
function <CODE>main</CODE>. This is called the <EM>initial</EM> frame or the
<EM>outermost</EM> frame. Each time a function is called, a new frame is
made. Each time a function returns, the frame for that function invocation
is eliminated. If a function is recursive, there can be many frames for
the same function. The frame for the function in which execution is
actually occurring is called the <EM>innermost</EM> frame. This is the most
recently created of all the stack frames that still exist.
</P><P>
<A NAME="IDX69"></A>
Inside your program, stack frames are identified by their addresses. A
stack frame consists of many bytes, each of which has its own address; each
kind of computer has a convention for choosing one of those bytes whose
address serves as the address of the frame. Usually this address is kept
in a register called the <EM>frame pointer register</EM> while execution is
going on in that frame.
</P><P>
<A NAME="IDX70"></A>
GDB assigns numbers to all existing stack frames, starting with zero for
the innermost frame, one for the frame that called it, and so on upward.
These numbers do not really exist in your program; they are to give you a
way of talking about stack frames in GDB commands.
</P><P>
<A NAME="IDX71"></A>
Many GDB commands refer implicitly to one stack frame. GDB records a stack
frame that is called the <EM>selected</EM> stack frame; you can select any
frame using one set of GDB commands, and then other commands will operate
on that frame. When your program stops, GDB automatically selects the
innermost frame.
</P><P>
<A NAME="Backtrace"></A>
<HR SIZE="6">
<A NAME="SEC33"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC32"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC34"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC31"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC31"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC36"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 7.2 Backtraces </H2>
<!--docid::SEC33::-->
<P>
A backtrace is a summary of how the program got where it is. It shows one
line per frame, for many frames, starting with the currently executing
frame (frame zero), followed by its caller (frame one), and on up the
stack.
</P><P>
<DL COMPACT>
<DT><CODE>backtrace</CODE>
<DD><DT><CODE>bt</CODE>
<DD>Print a backtrace of the entire stack: one line per frame for all
frames in the stack.
<P>
You can stop the backtrace at any time by typing the system interrupt
character, normally <KBD>Control-C</KBD>.
</P><P>
<DT><CODE>backtrace <VAR>n</VAR></CODE>
<DD><DT><CODE>bt <VAR>n</VAR></CODE>
<DD>Similar, but stop after <VAR>n</VAR> frames.
<P>
<DT><CODE>backtrace <VAR>-n</VAR></CODE>
<DD><DT><CODE>bt <VAR>-n</VAR></CODE>
<DD>Similar, but print the outermost <VAR>n</VAR> frames instead of the
innermost.
</DL>
<P>
Each line in a backtrace shows the frame number, the program counter, the
function and its arguments, and the source file name and line number (if
known). The program counter is omitted if is the beginning of the code for
the source line. This is the same as the first of the two lines printed
when you select a frame.
</P><P>
<A NAME="Selection"></A>
<HR SIZE="6">
<A NAME="SEC34"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC33"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC35"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC31"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC31"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC36"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 7.3 Selecting a Frame </H2>
<!--docid::SEC34::-->
<P>
Most commands for examining the stack and other data in the program work on
whichever stack frame is selected at the moment. Here are the commands for
selecting a stack frame; all of them finish by printing a brief description
of the stack frame just selected.
</P><P>
<DL COMPACT>
<DT><CODE>frame <VAR>n</VAR></CODE>
<DD><A NAME="IDX72"></A>
Select frame number <VAR>n</VAR>. Recall that frame zero is the innermost
(currently executing) frame, frame one is the frame that called the
innermost one, and so on. The highest-numbered frame is <CODE>main</CODE>'s
frame.
<P>
<DT><CODE>frame <VAR>addr</VAR></CODE>
<DD>Select the frame at address <VAR>addr</VAR>. This is useful mainly if the
chaining of stack frames has been damaged by a bug, making it
impossible for GDB to assign numbers properly to all frames. In
addition, this can be useful when the program has multiple stacks and
switches between them.
<P>
<DT><CODE>up <VAR>n</VAR></CODE>
<DD><A NAME="IDX73"></A>
Select the frame <VAR>n</VAR> frames up from the frame previously selected.
For positive numbers <VAR>n</VAR>, this advances toward the outermost
frame, to higher frame numbers, to frames that have existed longer.
<VAR>n</VAR> defaults to one.
<P>
<DT><CODE>down <VAR>n</VAR></CODE>
<DD><A NAME="IDX74"></A>
Select the frame <VAR>n</VAR> frames down from the frame previously
selected. For positive numbers <VAR>n</VAR>, this advances toward the
innermost frame, to lower frame numbers, to frames that were created
more recently. <VAR>n</VAR> defaults to one.
</DL>
<P>
All of these commands end by printing some information on the frame that
has been selected: the frame number, the function name, the arguments, the
source file and line number of execution in that frame, and the text of
that source line. For example:
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>#3 main (argc=3, argv=??, env=??) at main.c, line 67
67 read_input_file (argv[i]);
</pre></td></tr></table></P><P>
After such a printout, the <SAMP>`list'</SAMP> command with no arguments will print
ten lines centered on the point of execution in the frame. See section <A HREF="gdb.html#SEC37">8.1 Printing Source Lines</A>.
</P><P>
<A NAME="Frame Info"></A>
<HR SIZE="6">
<A NAME="SEC35"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC34"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC36"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC31"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC31"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC36"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 7.4 Information on a Frame </H2>
<!--docid::SEC35::-->
<P>
There are several other commands to print information about the selected
stack frame.
</P><P>
<DL COMPACT>
<DT><CODE>frame</CODE>
<DD>This command prints a brief description of the selected stack frame.
It can be abbreviated <SAMP>`f'</SAMP>. With an argument, this command is
used to select a stack frame; with no argument, it does not change
which frame is selected, but still prints the same information.
<P>
<DT><CODE>info frame</CODE>
<DD><A NAME="IDX75"></A>
This command prints a verbose description of the selected stack frame,
including the address of the frame, the addresses of the next frame in
(called by this frame) and the next frame out (caller of this frame),
the address of the frame's arguments, the program counter saved in it
(the address of execution in the caller frame), and which registers
were saved in the frame. The verbose description is useful when
something has gone wrong that has made the stack format fail to fit
the usual conventions.
<P>
<DT><CODE>info frame <VAR>addr</VAR></CODE>
<DD>Print a verbose description of the frame at address <VAR>addr</VAR>,
without selecting that frame. The selected frame remains unchanged by
this command.
<P>
<DT><CODE>info args</CODE>
<DD><A NAME="IDX76"></A>
Print the arguments of the selected frame, each on a separate line.
<P>
<DT><CODE>info locals</CODE>
<DD><A NAME="IDX77"></A>
Print the local variables of the selected frame, each on a separate
line. These are all variables declared static or automatic within all
program blocks that execution in this frame is currently inside of.
</DL>
<P>
<A NAME="Source"></A>
<HR SIZE="6">
<A NAME="SEC36"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC35"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC37"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC31"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 8. Examining Source Files </H1>
<!--docid::SEC36::-->
<P>
GDB knows which source files your program was compiled from, and
can print parts of their text. When your program stops, GDB
spontaneously prints the line it stopped in. Likewise, when you
select a stack frame (see section <A HREF="gdb.html#SEC34">7.3 Selecting a Frame</A>), GDB prints the line
which execution in that frame has stopped in. You can also
print parts of source files by explicit command.
</P><P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC37">8.1 Printing Source Lines</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Using the <SAMP>`list'</SAMP> command to print source files.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC38">8.2 Searching Source Files</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Commands for searching source files.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC39">8.3 Specifying Source Directories</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Specifying the directories to search for source files.</TD></TR>
</TABLE></BLOCKQUOTE>
<P>
<A NAME="List"></A>
<HR SIZE="6">
<A NAME="SEC37"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC36"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC38"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC36"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC36"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 8.1 Printing Source Lines </H2>
<!--docid::SEC37::-->
<P>
<A NAME="IDX78"></A>
To print lines from a source file, use the <SAMP>`list'</SAMP> command
(abbreviated <SAMP>`l'</SAMP>). There are several ways to specify what part
of the file you want to print.
</P><P>
Here are the forms of the <SAMP>`list'</SAMP> command most commonly used:
</P><P>
<DL COMPACT>
<DT><CODE>list <VAR>linenum</VAR></CODE>
<DD>Print ten lines centered around line number <VAR>linenum</VAR> in the
current source file.
<P>
<DT><CODE>list <VAR>function</VAR></CODE>
<DD>Print ten lines centered around the beginning of function
<VAR>function</VAR>.
<P>
<DT><CODE>list</CODE>
<DD>Print ten more lines. If the last lines printed were printed with a
<SAMP>`list'</SAMP> command, this prints ten lines following the last lines
printed; however, if the last line printed was a solitary line printed
as part of displaying a stack frame (see section <A HREF="gdb.html#SEC31">7. Examining the Stack</A>), this prints ten
lines centered around that line.
<P>
<DT><CODE>list -</CODE>
<DD>Print ten lines just before the lines last printed.
</DL>
<P>
Repeating a <SAMP>`list'</SAMP> command with <KBD>RET</KBD> discards the argument,
so it is equivalent to typing just <SAMP>`list'</SAMP>. This is more useful
than listing the same lines again. An exception is made for an
argument of <SAMP>`-'</SAMP>; that argument is preserved in repetition so that
each repetition moves up in the file.
</P><P>
In general, the <SAMP>`list'</SAMP> command expects you to supply zero, one or two
<EM>linespecs</EM>. Linespecs specify source lines; there are several ways
of writing them but the effect is always to specify some source line.
Here is a complete description of the possible arguments for <SAMP>`list'</SAMP>:
</P><P>
<DL COMPACT>
<DT><CODE>list <VAR>linespec</VAR></CODE>
<DD>Print ten lines centered around the line specified by <VAR>linespec</VAR>.
<P>
<DT><CODE>list <VAR>first</VAR>,<VAR>last</VAR></CODE>
<DD>Print lines from <VAR>first</VAR> to <VAR>last</VAR>. Both arguments are
linespecs.
<P>
<DT><CODE>list ,<VAR>last</VAR></CODE>
<DD>Print ten lines ending with <VAR>last</VAR>.
<P>
<DT><CODE>list <VAR>first</VAR>,</CODE>
<DD>Print ten lines starting with <VAR>first</VAR>.
<P>
<DT><CODE>list +</CODE>
<DD>Print ten lines just after the lines last printed.
<P>
<DT><CODE>list -</CODE>
<DD>Print ten lines just before the lines last printed.
<P>
<DT><CODE>list</CODE>
<DD>As described in the preceding table.
</DL>
<P>
Here are the ways of specifying a single source line--all the
kinds of linespec.
</P><P>
<DL COMPACT>
<DT><VAR>linenum</VAR>
<DD>Specifies line <VAR>linenum</VAR> of the current source file.
When a <SAMP>`list'</SAMP> command has two linespecs, this refers to
the same source file as the first linespec.
<P>
<DT>+<VAR>offset</VAR>
<DD>Specifies the line <VAR>offset</VAR> lines after the last line printed.
When used as the second linespec in a <SAMP>`list'</SAMP> command that has
two, this specifies the line <VAR>offset</VAR> lines down from the
first linespec.
<P>
<DT>-<VAR>offset</VAR>
<DD>Specifies the line <VAR>offset</VAR> lines before the last line printed.
<P>
<DT><VAR>filename</VAR>:<VAR>linenum</VAR>
<DD>Specifies line <VAR>linenum</VAR> in the source file <VAR>filename</VAR>.
<P>
<DT><VAR>function</VAR>
<DD>Specifies the line of the open-brace that begins the body of the
function <VAR>function</VAR>.
<P>
<DT><VAR>filename</VAR>:<VAR>function</VAR>
<DD>Specifies the line of the open-brace that begins the body of the
function <VAR>function</VAR> in the file <VAR>filename</VAR>. The file name is
needed with a function name only for disambiguation of identically
named functions in different source files.
<P>
<DT>*<VAR>address</VAR>
<DD>Specifies the line containing the program address <VAR>address</VAR>.
<VAR>address</VAR> may be any expression.
</DL>
<P>
One other command is used to map source lines to program addresses.
</P><P>
<DL COMPACT>
<DT><CODE>info line <VAR>linenum</VAR></CODE>
<DD><A NAME="IDX79"></A>
Print the starting and ending addresses of the compiled code for
source line <VAR>linenum</VAR>.
<P>
<A NAME="IDX80"></A>
The default examine address for the <SAMP>`x'</SAMP> command is changed to the
starting address of the line, so that <SAMP>`x/i'</SAMP> is sufficient to
begin examining the machine code (see section <A HREF="gdb.html#SEC45">9.4.1 Examining Memory</A>). Also, this address
is saved as the value of the convenience variable <SAMP>`$_'</SAMP>
(see section <A HREF="gdb.html#SEC48">9.7 Convenience Variables</A>).
</DL>
<P>
<A NAME="Search"></A>
<HR SIZE="6">
<A NAME="SEC38"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC37"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC39"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC36"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC36"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 8.2 Searching Source Files </H2>
<!--docid::SEC38::-->
<P>
There are two commands for searching through the current source file for a
regular expression.
</P><P>
The command <SAMP>`forward-search <VAR>regexp</VAR>'</SAMP> checks each line, starting
with the one following the last line listed, for a match for <VAR>regexp</VAR>.
It lists the line that is found. You can abbreviate the command name
as <SAMP>`fo'</SAMP>.
</P><P>
The command <SAMP>`reverse-search <VAR>regexp</VAR>'</SAMP> checks each line, starting
with the one before the last line listed and going backward, for a match
for <VAR>regexp</VAR>. It lists the line that is found. You can abbreviate
this command with as little as <SAMP>`rev'</SAMP>.
</P><P>
<A NAME="Source Path"></A>
<HR SIZE="6">
<A NAME="SEC39"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC38"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC36"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC36"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 8.3 Specifying Source Directories </H2>
<!--docid::SEC39::-->
<P>
<A NAME="IDX81"></A>
<A NAME="IDX82"></A>
Executable programs do not record the directories of the source files they
were compiled from, just the names. GDB remembers a list of directories to
search for source files; this is called the <EM>source path</EM>. Each time
GDB wants a source file, it tries all the directories in the list, in the
order they are present in the list, until it finds a file with the desired
name.
</P><P>
<A NAME="IDX83"></A>
When you start GDB, its source path contains just the current working
directory. To add other directories, use the <SAMP>`directory'</SAMP> command.
<B>Note that the search path for executable files and the working directory
are <I>not</I> used for finding source files.</B>
</P><P>
<DL COMPACT>
<DT><CODE>directory <VAR>dirname</VAR></CODE>
<DD>Add directory <VAR>dirname</VAR> to the end of the source path.
<P>
<DT><CODE>directory</CODE>
<DD>Reset the source path to just the current working directory of GDB.
This requires confirmation.
<P>
<SAMP>`directory'</SAMP> with no argument can cause source files previously
found by GDB to be found in a different directory. To make this work
correctly, this command also clears out the tables GDB maintains
about the source files it has already found.
</P><P>
<DT><CODE>info directories</CODE>
<DD><A NAME="IDX84"></A>
Print the source path: show which directories it contains.
</DL>
<P>
Because the <SAMP>`directory'</SAMP> command adds to the end of the source path,
it does not affect any file that GDB has already found. If the source
path contains directories that you do not want, and these directories
contain misleading files with names matching your source files, the
way to correct the situation is as follows:
</P><P>
<OL>
<LI>
Choose the directory you want at the beginning of the source path.
Use the <SAMP>`cd'</SAMP> command to make that the current working directory.
<P>
<LI>
Use <SAMP>`directory'</SAMP> with no argument to reset the source path to just
that directory.
<P>
<LI>
Use <SAMP>`directory'</SAMP> with suitable arguments to add any other
directories you want in the source path.
</OL>
<P>
<A NAME="Data"></A>
<HR SIZE="6">
<A NAME="SEC40"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC39"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC41"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC36"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC51"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 9. Examining Data </H1>
<!--docid::SEC40::-->
<P>
<A NAME="IDX85"></A>
<A NAME="IDX86"></A>
<A NAME="IDX87"></A>
The usual way of examining data in your program is with the <SAMP>`print'</SAMP>
command (abbreviated <SAMP>`p'</SAMP>). It evaluates and prints the value of any
valid expression of the language the program is written in (for now, C).
You type
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>print <VAR>exp</VAR>
</pre></td></tr></table></P><P>
where <VAR>exp</VAR> is any valid expression, and the value of <VAR>exp</VAR>
is printed in a format appropriate to its data type.
</P><P>
A more low-level way of examining data is with the <SAMP>`x'</SAMP> command.
It examines data in memory at a specified address and prints it in a
specified format.
</P><P>
GDB supports one command to modify the default format of displayed data:
</P><P>
<DL COMPACT>
<DT><SAMP>`set array-max'</SAMP>
<DD><A NAME="IDX88"></A>
<SAMP>`set array-max'</SAMP> sets the maximum number of elements of an array which
will be printed. This limit also applies to the display of strings.
</DL>
<P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC41">9.1 Expressions</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Expressions that can be computed and printed.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC42">9.2 Program Variables</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Using your program's variables in expressions.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC53">11.1 Assignment to Variables</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Setting your program's variables.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC43">9.3 Artificial Arrays</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Examining part of memory as an array.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC44">9.4 Formats</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Specifying formats for printing values.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC45">9.4.1 Examining Memory</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Examining memory explicitly.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC46">9.5 Automatic Display</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Printing certain expressions whenever program stops.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC47">9.6 Value History</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Referring to values previously printed.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC48">9.7 Convenience Variables</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Giving names to values for future reference.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC49">9.8 Registers</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Referring to and storing in machine registers.</TD></TR>
</TABLE></BLOCKQUOTE>
<P>
<A NAME="Expressions"></A>
<HR SIZE="6">
<A NAME="SEC41"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC42"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC51"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 9.1 Expressions </H2>
<!--docid::SEC41::-->
<P>
<A NAME="IDX89"></A>
Many different GDB commands accept an expression and compute its value.
Any kind of constant, variable or operator defined by the programming
language you are using is legal in an expression in GDB. This includes
conditional expressions, function calls, casts and string constants.
It unfortunately does not include symbols defined by preprocessor
#define commands.
</P><P>
Casts are supported in all languages, not just in C, because it is so
useful to cast a number into a pointer so as to examine a structure
at that address in memory.
</P><P>
GDB supports three kinds of operator in addition to those of programming
languages:
</P><P>
<DL COMPACT>
<DT><CODE>@</CODE>
<DD><SAMP>`@'</SAMP> is a binary operator for treating parts of memory as arrays.
See section <A HREF="gdb.html#SEC43">9.3 Artificial Arrays</A>, for more information.
<P>
<DT><CODE>::</CODE>
<DD><SAMP>`::'</SAMP> allows you to specify a variable in terms of the file or
function it is defined in. See section <A HREF="gdb.html#SEC42">9.2 Program Variables</A>.
<P>
<DT><CODE>{<VAR>type</VAR>} <VAR>addr</VAR></CODE>
<DD>Refers to an object of type <VAR>type</VAR> stored at address <VAR>addr</VAR> in
memory. <VAR>addr</VAR> may be any expression whose value is an integer or
pointer (but parentheses are required around nonunary operators, just as in
a cast). This construct is allowed regardless of what kind of data is
officially supposed to reside at <VAR>addr</VAR>.</DL>
<P>
<A NAME="Variables"></A>
<HR SIZE="6">
<A NAME="SEC42"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC41"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC43"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC51"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 9.2 Program Variables </H2>
<!--docid::SEC42::-->
<P>
The most common kind of expression to use is the name of a variable
in your program.
</P><P>
Variables in expressions are understood in the selected stack frame
(see section <A HREF="gdb.html#SEC34">7.3 Selecting a Frame</A>); they must either be global (or static) or be visible
according to the scope rules of the programming language from the point of
execution in that frame. This means that in the function
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>foo (a)
int a;
{
bar (a);
{
int b = test ();
bar (b);
}
}
</pre></td></tr></table></P><P>
the variable <CODE>a</CODE> is usable whenever the program is executing
within the function <CODE>foo</CODE>, but the variable <CODE>b</CODE> is visible
only while the program is executing inside the block in which <CODE>b</CODE>
is declared.
</P><P>
As a special exception, you can refer to a variable or function whose
scope is a single source file even if the current execution point is not
in this file. But it is possible to have more than one such variable
or function with the same name (if they are in different source files).
In such a case, it is not defined which one you will get. If you wish,
you can specify any one of them using the colon-colon construct:
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre><VAR>block</VAR>::<VAR>variable</VAR>
</pre></td></tr></table></P><P>
Here <VAR>block</VAR> is the name of the source file whose variable you want.
</P><P>
<A NAME="Arrays"></A>
<HR SIZE="6">
<A NAME="SEC43"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC42"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC44"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC51"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 9.3 Artificial Arrays </H2>
<!--docid::SEC43::-->
<P>
<A NAME="IDX90"></A>
It is often useful to print out several successive objects of the
same type in memory; a section of an array, or an array of
dynamically determined size for which only a pointer exists in the
program.
</P><P>
This can be done by constructing an <EM>artificial array</EM> with the
binary operator <SAMP>`@'</SAMP>. The left operand of <SAMP>`@'</SAMP> should be
the first element of the desired array, as an individual object.
The right operand should be the length of the array. The result is
an array value whose elements are all of the type of the left argument.
The first element is actually the left argument; the second element
comes from bytes of memory immediately following those that hold the
first element, and so on. Here is an example. If a program says
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>int *array = (int *) malloc (len * sizeof (int));
</pre></td></tr></table></P><P>
you can print the contents of <CODE>array</CODE> with
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>p *array@len
</pre></td></tr></table></P><P>
The left operand of <SAMP>`@'</SAMP> must reside in memory. Array values made
with <SAMP>`@'</SAMP> in this way behave just like other arrays in terms of
subscripting, and are coerced to pointers when used in expressions.
(It would probably appear in an expression via the value history,
after you had printed it out.)
</P><P>
<A NAME="Formats"></A>
<HR SIZE="6">
<A NAME="SEC44"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC43"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC45"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC51"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 9.4 Formats </H2>
<!--docid::SEC44::-->
<P>
<A NAME="IDX91"></A>
<A NAME="IDX92"></A>
GDB normally prints all values according to their data types. Sometimes
this is not what you want. For example, you might want to print a number
in hex, or a pointer in decimal. Or you might want to view data in memory
at a certain address as a character string or an instruction. These things
can be done with <EM>output formats</EM>.
</P><P>
The simplest use of output formats is to say how to print a value
already computed. This is done by starting the arguments of the
<SAMP>`print'</SAMP> command with a slash and a format letter. The format
letters supported are:
</P><P>
<DL COMPACT>
<DT><SAMP>`x'</SAMP>
<DD>Regard the bits of the value as an integer, and print the integer in
hexadecimal.
<P>
<DT><SAMP>`d'</SAMP>
<DD>Print as integer in signed decimal.
<P>
<DT><SAMP>`u'</SAMP>
<DD>Print as integer in unsigned decimal.
<P>
<DT><SAMP>`o'</SAMP>
<DD>Print as integer in octal.
<P>
<DT><SAMP>`a'</SAMP>
<DD>Print as an address, both absolute in hex and then relative
to a symbol defined as an address below it.
<P>
<DT><SAMP>`c'</SAMP>
<DD>Regard as an integer and print it as a character constant.
<P>
<DT><SAMP>`f'</SAMP>
<DD>Regard the bits of the value as a floating point number and print
using typical floating point syntax.
</DL>
<P>
For example, to print the program counter in hex (see section <A HREF="gdb.html#SEC49">9.8 Registers</A>), type
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>p/x $pc
</pre></td></tr></table></P><P>
Note that no space is required before the slash; this is because command
names in GDB cannot contain a slash.
</P><P>
To reprint the last value in the value history with a different format,
you can use the <SAMP>`print'</SAMP> command with just a format and no
expression. For example, <SAMP>`p/x'</SAMP> reprints the last value in hex.
</P><P>
<A NAME="Memory"></A>
<HR SIZE="6">
<A NAME="SEC45"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC44"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC46"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC51"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 9.4.1 Examining Memory </H3>
<!--docid::SEC45::-->
<P>
<A NAME="IDX93"></A>
<A NAME="IDX94"></A>
The command <SAMP>`x'</SAMP> (for `examine') can be used to examine memory under
explicit control of formats, without reference to the program's data types.
</P><P>
<SAMP>`x'</SAMP> is followed by a slash and an output format specification,
followed by an expression for an address. The expression need not have
a pointer value (though it may); it is used as an integer, as the
address of a byte of memory. See section <A HREF="gdb.html#SEC41">9.1 Expressions</A> for more information
on expressions.
</P><P>
The output format in this case specifies both how big a unit of memory
to examine and how to print the contents of that unit. It is done
with one or two of the following letters:
</P><P>
These letters specify just the size of unit to examine:
</P><P>
<DL COMPACT>
<DT><SAMP>`b'</SAMP>
<DD>Examine individual bytes.
<P>
<DT><SAMP>`h'</SAMP>
<DD>Examine halfwords (two bytes each).
<P>
<DT><SAMP>`w'</SAMP>
<DD>Examine words (four bytes each).
<P>
<A NAME="IDX95"></A>
Many assemblers and cpu designers still use `word' for a 16-bit quantity,
as a holdover from specific predecessor machines of the 1970's that really
did use two-byte words. But more generally the term `word' has always
referred to the size of quantity that a machine normally operates on and
stores in its registers. This is 32 bits for all the machines that GNU
runs on.
</P><P>
<DT><SAMP>`g'</SAMP>
<DD>Examine giant words (8 bytes).
</DL>
<P>
These letters specify just the way to print the contents:
</P><P>
<DL COMPACT>
<DT><SAMP>`x'</SAMP>
<DD>Print as integers in unsigned hexadecimal.
<P>
<DT><SAMP>`d'</SAMP>
<DD>Print as integers in signed decimal.
<P>
<DT><SAMP>`u'</SAMP>
<DD>Print as integers in unsigned decimal.
<P>
<DT><SAMP>`o'</SAMP>
<DD>Print as integers in unsigned octal.
<P>
<DT><SAMP>`a'</SAMP>
<DD>Print as an address, both absolute in hex and then relative
to a symbol defined as an address below it.
<P>
<DT><SAMP>`c'</SAMP>
<DD>Print as character constants.
<P>
<DT><SAMP>`f'</SAMP>
<DD>Print as floating point. This works only with sizes <SAMP>`w'</SAMP> and
<SAMP>`g'</SAMP>.
<P>
<DT><SAMP>`s'</SAMP>
<DD>Print a null-terminated string of characters. The specified unit size
is ignored; instead, the unit is however many bytes it takes to reach
a null character (including the null character).
<P>
<DT><SAMP>`i'</SAMP>
<DD>Print a machine instruction in assembler syntax (or nearly). The
specified unit size is ignored; the number of bytes in an instruction
varies depending on the type of machine, the opcode and the addressing
modes used.
</DL>
<P>
If either the manner of printing or the size of unit fails to be specified,
the default is to use the same one that was used last. If you don't want
to use any letters after the slash, you can omit the slash as well.
</P><P>
You can also omit the address to examine. Then the address used is
just after the last unit examined. This is why string and instruction
formats actually compute a unit-size based on the data: so that the
next string or instruction examined will start in the right place.
The <SAMP>`print'</SAMP> command sometimes sets the default address for
the <SAMP>`x'</SAMP> command; when the value printed resides in memory, the
default is set to examine the same location. <SAMP>`info line'</SAMP> also
sets the default for <SAMP>`x'</SAMP>, to the address of the start of the
machine code for the specified line and <SAMP>`info breakpoints'</SAMP> sets
it to the address of the last breakpoint listed.
</P><P>
When you use <KBD>RET</KBD> to repeat an <SAMP>`x'</SAMP> command, it does not repeat
exactly the same: the address specified previously (if any) is ignored, so
that the repeated command examines the successive locations in memory
rather than the same ones.
</P><P>
You can examine several consecutive units of memory with one command by
writing a repeat-count after the slash (before the format letters, if any).
The repeat count must be a decimal integer. It has the same effect as
repeating the <SAMP>`x'</SAMP> command that many times except that the output may
be more compact with several units per line.
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>x/10i $pc
</pre></td></tr></table></P><P>
Prints ten instructions starting with the one to be executed next in the
selected frame. After doing this, you could print another ten following
instructions with
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>x/10
</pre></td></tr></table></P><P>
in which the format and address are allowed to default.
</P><P>
<A NAME="IDX96"></A>
<A NAME="IDX97"></A>
The addresses and contents printed by the <SAMP>`x'</SAMP> command are not put in
the value history because there is often too much of them and they would
get in the way. Instead, GDB makes these values available for subsequent
use in expressions as values of the convenience variables <SAMP>`$_'</SAMP> and
<SAMP>`$__'</SAMP>.
</P><P>
After an <SAMP>`x'</SAMP> command, the last address examined is available for use
in expressions in the convenience variable <SAMP>`$_'</SAMP>. The contents of that
address, as examined, are available in the convenience variable <SAMP>`$__'</SAMP>.
</P><P>
If the <SAMP>`x'</SAMP> command has a repeat count, the address and contents saved
are from the last memory unit printed; this is not the same as the last
address printed if several units were printed on the last line of output.
</P><P>
<A NAME="Auto Display"></A>
<HR SIZE="6">
<A NAME="SEC46"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC45"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC47"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC51"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 9.5 Automatic Display </H2>
<!--docid::SEC46::-->
<P>
If you find that you want to print the value of an expression frequently
(to see how it changes), you might want to add it to the <EM>automatic
display list</EM> so that GDB will print its value each time the program stops.
Each expression added to the list is given a number to identify it;
to remove an expression from the list, you specify that number.
The automatic display looks like this:
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>2: foo = 38
3: bar[5] = (struct hack *) 0x3804
</pre></td></tr></table></P><P>
showing item numbers, expressions and their current values.
</P><P>
<DL COMPACT>
<DT><CODE>display <VAR>exp</VAR></CODE>
<DD><A NAME="IDX98"></A>
Add the expression <VAR>exp</VAR> to the list of expressions to display
each time the program stops. See section <A HREF="gdb.html#SEC41">9.1 Expressions</A>.
<P>
<DT><CODE>display/<VAR>fmt</VAR> <VAR>exp</VAR></CODE>
<DD>For <VAR>fmt</VAR> specifying only a display format and not a size or
count, add the expression <VAR>exp</VAR> to the auto-display list but
arranges to display it each time in the specified format <VAR>fmt</VAR>.
<P>
<DT><CODE>display/<VAR>fmt</VAR> <VAR>addr</VAR></CODE>
<DD>For <VAR>fmt</VAR> <SAMP>`i'</SAMP> or <SAMP>`s'</SAMP>, or including a unit-size or a
number of units, add the expression <VAR>addr</VAR> as a memory address to
be examined each time the program stops. Examining means in effect
doing <SAMP>`x/<VAR>fmt</VAR> <VAR>addr</VAR>'</SAMP>. See section <A HREF="gdb.html#SEC45">9.4.1 Examining Memory</A>.
<P>
<DT><CODE>undisplay <VAR>dnums</VAR><small>...</small></CODE>
<DD><A NAME="IDX99"></A>
<DT><CODE>delete display <VAR>dnums</VAR><small>...</small></CODE>
<DD><A NAME="IDX100"></A>
Remove item numbers <VAR>dnums</VAR> from the list of expressions to display.
<P>
<DT><CODE>disable display <VAR>dnums</VAR><small>...</small></CODE>
<DD><A NAME="IDX101"></A>
Disable the display of item numbers <VAR>dnums</VAR>. A disabled display item
has no effect but is not forgotten. It may be later enabled.
<P>
<DT><CODE>enable display <VAR>dnums</VAR><small>...</small></CODE>
<DD><A NAME="IDX102"></A>
Enable display of item numbers <VAR>dnums</VAR>. It becomes effective once
again in auto display of its expression, until you specify otherwise.
<P>
<DT><CODE>display</CODE>
<DD>Display the current values of the expressions on the list, just as is
done when the program stops.
<P>
<DT><CODE>info display</CODE>
<DD><A NAME="IDX103"></A>
Print the list of expressions to display automatically, each one
with its item number, but without showing the values.
</DL>
<P>
<A NAME="Value History"></A>
<HR SIZE="6">
<A NAME="SEC47"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC46"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC48"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC51"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 9.6 Value History </H2>
<!--docid::SEC47::-->
<P>
<A NAME="IDX104"></A>
Every value printed by the <SAMP>`print'</SAMP> command is saved for the entire
session in GDB's <EM>value history</EM> so that you can refer to it in
other expressions.
</P><P>
<A NAME="IDX105"></A>
<A NAME="IDX106"></A>
The values printed are given <EM>history numbers</EM> for you to refer to them
by. These are successive integers starting with 1. <SAMP>`print'</SAMP> shows you
the history number assigned to a value by printing <SAMP>`$<VAR>n</VAR> = '</SAMP>
before the value; here <VAR>n</VAR> is the history number.
</P><P>
To refer to any previous value, use <SAMP>`$'</SAMP> followed by the value's
history number. The output printed by <SAMP>`print'</SAMP> is designed to remind
you of this. Just <SAMP>`$'</SAMP> refers to the most recent value in the history,
and <SAMP>`$$'</SAMP> refers to the value before that.
</P><P>
For example, suppose you have just printed a pointer to a structure and
want to see the contents of the structure. It suffices to type
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>p *$
</pre></td></tr></table></P><P>
If you have a chain of structures where the component <SAMP>`next'</SAMP> points
to the next one, you can print the contents of the next one with
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>p *$.next
</pre></td></tr></table></P><P>
It might be useful to repeat this command many times by typing <KBD>RET</KBD>.
</P><P>
Note that the history records values, not expressions. If the value of
<CODE>x</CODE> is 4 and you type
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>print x
set x=5
</pre></td></tr></table></P><P>
then the value recorded in the value history by the <SAMP>`print'</SAMP> command
remains 4 even though <CODE>x</CODE>'s value has changed.
</P><P>
<DL COMPACT>
<DT><CODE>info history</CODE>
<DD><A NAME="IDX107"></A>
Print the last ten values in the value history, with their item
numbers. This is like <SAMP>`p $$9'</SAMP> repeated ten times, except that
<SAMP>`info history'</SAMP> does not change the history.
<P>
<DT><CODE>info history <VAR>n</VAR></CODE>
<DD>Print ten history values centered on history item number <VAR>n</VAR>.
</DL>
<P>
<A NAME="Convenience Vars"></A>
<HR SIZE="6">
<A NAME="SEC48"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC47"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC49"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC51"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 9.7 Convenience Variables </H2>
<!--docid::SEC48::-->
<P>
<A NAME="IDX108"></A>
GDB provides <EM>convenience variables</EM> that you can use within GDB to
hold on to a value and refer to it later. These variables exist entirely
within GDB; they are not part of your program, and setting a convenience
variable has no effect on further execution of your program. That's why
you can use them freely.
</P><P>
Convenience variables have names starting with <SAMP>`$'</SAMP>. Any name starting
with <SAMP>`$'</SAMP> can be used for a convenience variable, unless it is one of
the predefined set of register names (see section <A HREF="gdb.html#SEC49">9.8 Registers</A>).
</P><P>
You can save a value in a convenience variable with an assignment
expression, just as you would set a variable in your program. Example:
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>set $foo = *object_ptr
</pre></td></tr></table></P><P>
would save in <SAMP>`$foo'</SAMP> the value contained in the object pointed to by
<CODE>object_ptr</CODE>.
</P><P>
Using a convenience variable for the first time creates it; but its value
is <CODE>void</CODE> until you assign a new value. You can alter the value with
another assignment at any time.
</P><P>
Convenience variables have no fixed types. You can assign a convenience
variable any type of value, even if it already has a value of a different
type. The convenience variable as an expression has whatever type its
current value has.
</P><P>
<DL COMPACT>
<DT><CODE>info convenience</CODE>
<DD><A NAME="IDX109"></A>
Print a list of convenience variables used so far, and their values.
Abbreviated <SAMP>`i con'</SAMP>.
</DL>
<P>
One of the ways to use a convenience variable is as a counter to be
incremented or a pointer to be advanced. For example:
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>set $i = 0
print bar[$i++]-&#62;contents
<I><small>...</small>repeat that command by typing <KBD>RET</KBD>.</I>
</pre></td></tr></table></P><P>
Some convenience variables are created automatically by GDB and given
values likely to be useful.
</P><P>
<DL COMPACT>
<DT><SAMP>`$_'</SAMP>
<DD>The variable <SAMP>`$_'</SAMP> is automatically set by the <SAMP>`x'</SAMP> command to
the last address examined (see section <A HREF="gdb.html#SEC45">9.4.1 Examining Memory</A>). Other commands which
provide a default address for <SAMP>`x'</SAMP> to examine also set <SAMP>`$_'</SAMP>
to that address; these commands include <SAMP>`info line'</SAMP> and <SAMP>`info
breakpoint'</SAMP>.
<P>
<DT><SAMP>`$__'</SAMP>
<DD>The variable <SAMP>`$__'</SAMP> is automatically set by the <SAMP>`x'</SAMP> command
to the value found in the last address examined.
</DL>
<P>
<A NAME="Registers"></A>
<HR SIZE="6">
<A NAME="SEC49"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC48"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC50"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC51"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 9.8 Registers </H2>
<!--docid::SEC49::-->
<P>
<A NAME="IDX110"></A>
Machine register contents can be referred to in expressions as variables
with names starting with <SAMP>`$'</SAMP>. The names of registers are different
for each machine; use <SAMP>`info registers'</SAMP> to see the names used on your
machine. The names <SAMP>`$pc'</SAMP> and <SAMP>`$sp'</SAMP> are used on all machines for
the program counter register and the stack pointer. Often <SAMP>`$fp'</SAMP> is
used for a register that contains a pointer to the current stack frame.
</P><P>
GDB always considers the contents of an ordinary register as an integer
when the register is examined in this way. Some machines have special
registers which can hold nothing but floating point; these registers are
considered floating point. There is no way to refer to the contents of an
ordinary register as floating point value (although you can <EM>print</EM>
it as a floating point value with <SAMP>`print/f $<VAR>regname</VAR>'</SAMP>).
</P><P>
Some registers have distinct "raw" and "virtual" data formats. This
means that the data format in which the register contents are saved by the
operating system is not the same one that your program normally sees. For
example, the registers of the 68881 floating point coprocessor are always
saved in "extended" format, but virtually all C programs expect to work with
"double" format. In such cases, GDB normally works with the virtual
format only (the format that makes sense for your program), but the
<SAMP>`info registers'</SAMP> command prints the data in both formats.
</P><P>
Register values are relative to the selected stack frame
(see section <A HREF="gdb.html#SEC34">7.3 Selecting a Frame</A>). This means that you get the value that the register
would contain if all stack frames farther in were exited and their saved
registers restored. In order to see the real contents of all registers,
you must select the innermost frame (with <SAMP>`frame 0'</SAMP>).
</P><P>
Some registers are never saved (typically those numbered zero or one)
because they are used for returning function values; for these registers,
relativization makes no difference.
</P><P>
<DL COMPACT>
<DT><CODE>info registers</CODE>
<DD><A NAME="IDX111"></A>
Print the names and relativized values of all registers.
<P>
<DT><CODE>info registers <VAR>regname</VAR></CODE>
<DD>Print the relativized value of register <VAR>regname</VAR>. <VAR>regname</VAR>
may be any register name valid on the machine you are using, with
or without the initial <SAMP>`$'</SAMP>.
</DL>
<P>
<HR SIZE="6">
<A NAME="SEC50"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC49"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC51"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC51"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H3> 9.8.1 Examples </H3>
<!--docid::SEC50::-->
<P>
You could print the program counter in hex with
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>p/x $pc
</pre></td></tr></table></P><P>
or print the instruction to be executed next with
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>x/i $pc
</pre></td></tr></table></P><P>
or add four to the stack pointer with
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>set $sp += 4
</pre></td></tr></table></P><P>
The last is a way of removing one word from the stack, on machines where
stacks grow downward in memory (most machines, nowadays). This assumes
that the innermost stack frame is selected. Setting <SAMP>`$sp'</SAMP> is
not allowed when other stack frames are selected.
</P><P>
<A NAME="Symbols"></A>
<HR SIZE="6">
<A NAME="SEC51"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC50"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC52"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC40"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC52"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 10. Examining the Symbol Table </H1>
<!--docid::SEC51::-->
<P>
The commands described in this section allow you to make inquiries for
information about the symbols (names of variables, functions and types)
defined in your program. This information is found by GDB in the symbol
table loaded by the <SAMP>`symbol-file'</SAMP> command; it is inherent in the text
of your program and does not change as the program executes.
</P><P>
<DL COMPACT>
<DT><CODE>whatis <VAR>exp</VAR></CODE>
<DD><A NAME="IDX112"></A>
Print the data type of expression <VAR>exp</VAR>. <VAR>exp</VAR> is not
actually evaluated, and any side-effecting operations (such as
assignments or function calls) inside it do not take place.
See section <A HREF="gdb.html#SEC41">9.1 Expressions</A>.
<P>
<DT><CODE>whatis</CODE>
<DD>Print the data type of <SAMP>`$'</SAMP>, the last value in the value history.
<P>
<DT><CODE>info address <VAR>symbol</VAR></CODE>
<DD><A NAME="IDX113"></A>
Describe where the data for <VAR>symbol</VAR> is stored. For register
variables, this says which register. For other automatic variables,
this prints the stack-frame offset at which the variable is always
stored. Note the contrast with <SAMP>`print &#38;<VAR>symbol</VAR>'</SAMP>, which does
not work at all for register variables and for automatic variables
prints the exact address of the current instantiation of the variable.
<P>
<DT><CODE>ptype <VAR>typename</VAR></CODE>
<DD><A NAME="IDX114"></A>
Print a description of data type <VAR>typename</VAR>. <VAR>typename</VAR> may be
the name of a type, or for C code it may have the form
<SAMP>`struct <VAR>struct-tag</VAR>'</SAMP>, <SAMP>`union <VAR>union-tag</VAR>'</SAMP> or
<SAMP>`enum <VAR>enum-tag</VAR>'</SAMP>.<P>
<DT><CODE>info sources</CODE>
<DD><A NAME="IDX115"></A>
Print the names of all source files in the program for which there
is debugging information.
<P>
<DT><CODE>info functions</CODE>
<DD><A NAME="IDX116"></A>
Print the names and data types of all defined functions.
<P>
<DT><CODE>info functions <VAR>regexp</VAR></CODE>
<DD>Print the names and data types of all defined functions
whose names contain a match for regular expression <VAR>regexp</VAR>.
Thus, <SAMP>`info fun step'</SAMP> finds all functions whose names
include <SAMP>`step'</SAMP>; <SAMP>`info fun ^step'</SAMP> finds those whose names
start with <SAMP>`step'</SAMP>.
<P>
<DT><CODE>info variables</CODE>
<DD><A NAME="IDX117"></A>
Print the names and data types of all variables that are declared
outside of functions.
<P>
<DT><CODE>info variables <VAR>regexp</VAR></CODE>
<DD>Print the names and data types of all variables, declared outside of
functions, whose names contain a match for regular expression
<VAR>regexp</VAR>.
<P>
<DT><CODE>info types</CODE>
<DD><A NAME="IDX118"></A>
Print all data types that are defined in the program.
<P>
<DT><CODE>info types <VAR>regexp</VAR></CODE>
<DD>Print all data types that are defined in the program whose names
contain a match for regular expression <VAR>regexp</VAR>.
<P>
<DT><CODE>info methods</CODE>
<DD><DT><CODE>info methods <VAR>regexp</VAR></CODE>
<DD><A NAME="IDX119"></A>
The <SAMP>`info-methods'</SAMP> command permits the user to examine all defined
methods within C<CODE>++</CODE> program, or (with the <VAR>regexp</VAR> argument) a
specific set of methods found in the various C<CODE>++</CODE> classes. Many
C<CODE>++</CODE> classes which implement a large number of differently typed
methods implement a large number of methods as well. Thus, the
<SAMP>`ptype'</SAMP> command can give the user a tremendous overdose of
information about what methods are associated with a given class. The
<SAMP>`info-methods'</SAMP> command filters these methods do to only those
methods which match the regular-expression search key.
<P>
<DT><CODE>printsyms <VAR>filename</VAR></CODE>
<DD><A NAME="IDX120"></A>
Write a complete dump of the debugger's symbol data into the
file <VAR>filename</VAR>.
</DL>
<P>
<A NAME="Altering"></A>
<HR SIZE="6">
<A NAME="SEC52"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC51"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC53"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC51"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC57"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 11. Altering Execution </H1>
<!--docid::SEC52::-->
<P>
There are several ways to alter the execution of your program with GDB
commands.
</P><P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC53">11.1 Assignment to Variables</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Altering variable values or memory contents.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC54">11.2 Continuing at a Different Address</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Altering control flow.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC55">11.3 Giving the Program a Signal</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Making signals happen in the program.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC56">11.4 Returning from a Function</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Making a function return prematurely.</TD></TR>
</TABLE></BLOCKQUOTE>
<P>
<A NAME="Assignment"></A>
<HR SIZE="6">
<A NAME="SEC53"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC52"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC54"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC52"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC52"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC57"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 11.1 Assignment to Variables </H2>
<!--docid::SEC53::-->
<P>
<A NAME="IDX121"></A>
<A NAME="IDX122"></A>
To alter the value of a variable, evaluate an assignment expression.
See section <A HREF="gdb.html#SEC41">9.1 Expressions</A>. For example,
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>print x=4
</pre></td></tr></table></P><P>
would store the value 4 into the variable <CODE>x</CODE>, and then print
the value of the assignment expression (which is 4).
</P><P>
<A NAME="IDX123"></A>
<A NAME="IDX124"></A>
If you are not interested in seeing the value of the assignment, use the
<SAMP>`set'</SAMP> command instead of the <SAMP>`print'</SAMP> command. <SAMP>`set'</SAMP> is
really the same as <SAMP>`print'</SAMP> except that the expression's value is not
printed and is not put in the value history (see section <A HREF="gdb.html#SEC47">9.6 Value History</A>). The
expression is evaluated only for side effects.
</P><P>
Note that if the beginning of the argument string of the <SAMP>`set'</SAMP> command
appears identical to a <SAMP>`set'</SAMP> subcommand, it may be necessary to use
the <SAMP>`set variable'</SAMP> command. This command is identical to <SAMP>`set'</SAMP>
except for its lack of subcommands.
</P><P>
GDB allows more implicit conversions in assignments than C does; you can
freely store an integer value into a pointer variable or vice versa, and
any structure can be converted to any other structure that is the same
length or shorter.
</P><P>
In C, all the other assignment operators such as <SAMP>`+='</SAMP> and <SAMP>`++'</SAMP>
are supported as well.
</P><P>
To store into arbitrary places in memory, use the <SAMP>`{<small>...</small>}'</SAMP>
construct to generate a value of specified type at a specified address
(see section <A HREF="gdb.html#SEC41">9.1 Expressions</A>). For example,
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>set {int}0x83040 = 4
</pre></td></tr></table></P><P>
<A NAME="Jumping"></A>
<HR SIZE="6">
<A NAME="SEC54"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC53"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC55"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC52"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC52"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC57"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 11.2 Continuing at a Different Address </H2>
<!--docid::SEC54::-->
<P>
<DL COMPACT>
<DT><CODE>jump <VAR>linenum</VAR></CODE>
<DD><A NAME="IDX125"></A>
Resume execution at line number <VAR>linenum</VAR>. Execution may stop
immediately if there is a breakpoint there.
<P>
The <SAMP>`jump'</SAMP> command does not change the current stack frame, or
the stack pointer, or the contents of any memory location or any
register other than the program counter. If line <VAR>linenum</VAR> is in
a different function from the one currently executing, the results may
be wild if the two functions expect different patterns of arguments or
of local variables. For this reason, the <SAMP>`jump'</SAMP> command requests
confirmation if the specified line is not in the function currently
executing. However, even wild results are predictable based on
changing the program counter.
</P><P>
<DT><CODE>jump *<VAR>address</VAR></CODE>
<DD>Resume execution at the instruction at address <VAR>address</VAR>.
</DL>
<P>
A similar effect can be obtained by storing a new value into the register
<SAMP>`$pc'</SAMP>, but not exactly the same.
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>set $pc = 0x485
</pre></td></tr></table></P><P>
specifies the address at which execution will resume, but does not resume
execution. That does not happen until you use the <SAMP>`cont'</SAMP> command or a
stepping command (see section <A HREF="gdb.html#SEC30">6.4 Stepping</A>).
</P><P>
<A NAME="Signaling"></A>
<HR SIZE="6">
<A NAME="SEC55"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC54"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC56"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC52"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC52"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC57"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 11.3 Giving the Program a Signal </H2>
<!--docid::SEC55::-->
<P>
<DL COMPACT>
<DT><CODE>signal <VAR>signalnum</VAR></CODE>
<DD><A NAME="IDX126"></A>
Resume execution where the program stopped, but give it immediately
the signal number <VAR>signalnum</VAR>.
<P>
Alternatively, if <VAR>signalnum</VAR> is zero, continue execution and give
no signal. This is useful when the program has received a signal
but you don't want the program to see that signal; the <SAMP>`cont'</SAMP> command
would signal the program.
</DL>
<P>
<A NAME="Returning"></A>
<HR SIZE="6">
<A NAME="SEC56"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC55"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC57"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC52"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC52"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC57"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 11.4 Returning from a Function </H2>
<!--docid::SEC56::-->
<P>
<A NAME="IDX127"></A>
<A NAME="IDX128"></A>
You can make any function call return immediately, using the <SAMP>`return'</SAMP>
command.
</P><P>
First select the stack frame that you wish to return from
(see section <A HREF="gdb.html#SEC34">7.3 Selecting a Frame</A>). Then type the <SAMP>`return'</SAMP> command. If you wish to
specify the value to be returned, give that as an argument.
</P><P>
This pops the selected stack frame (and any other frames inside of it),
leaving its caller as the innermost remaining frame. That frame becomes
selected. The specified value is stored in the registers used for
returning values of functions.
</P><P>
The <SAMP>`return'</SAMP> command does not resume execution; it leaves the program
stopped in the state that would exist if the function had just returned.
Contrast this with the <SAMP>`finish'</SAMP> command (see section <A HREF="gdb.html#SEC30">6.4 Stepping</A>), which
resumes execution <I>until</I> the selected stack frame returns naturally.
</P><P>
<A NAME="Sequences"></A>
<HR SIZE="6">
<A NAME="SEC57"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC56"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC58"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC52"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC61"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 12. Canned Sequences of Commands </H1>
<!--docid::SEC57::-->
<P>
GDB provides two ways to store sequences of commands for execution as a
unit: user-defined commands and command files.
</P><P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC58">12.1 User-Defined Commands</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">User-defined commands.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC59">12.2 Command Files</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Command files.</TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC60">12.3 Commands for Controlled Output</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Controlled output commands useful in
user-defined commands and command files.</TD></TR>
</TABLE></BLOCKQUOTE>
<P>
<A NAME="Define"></A>
<HR SIZE="6">
<A NAME="SEC58"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC57"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC59"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC57"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC57"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC61"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 12.1 User-Defined Commands </H2>
<!--docid::SEC58::-->
<P>
<A NAME="IDX129"></A>
A <EM>user-defined command</EM> is a sequence of GDB commands to which you
assign a new name as a command. This is done with the <SAMP>`define'</SAMP>
command.
</P><P>
<DL COMPACT>
<DT><CODE>define <VAR>commandname</VAR></CODE>
<DD><A NAME="IDX130"></A>
Define a command named <VAR>commandname</VAR>. If there is already a command
by that name, you are asked to confirm that you want to redefine it.
<P>
The definition of the command is made up of other GDB command lines,
which are given following the <SAMP>`define'</SAMP> command. The end of these
commands is marked by a line containing <SAMP>`end'</SAMP>.
</P><P>
<DT><CODE>document <VAR>commandname</VAR></CODE>
<DD><A NAME="IDX131"></A>
Give documentation to the user-defined command <VAR>commandname</VAR>. The
command <VAR>commandname</VAR> must already be defined. This command reads
lines of documentation just as <SAMP>`define'</SAMP> reads the lines of the
command definition, ending with <SAMP>`end'</SAMP>. After the <SAMP>`document'</SAMP> command is finished,
<SAMP>`help'</SAMP> on command <VAR>commandname</VAR> will print the documentation
you have specified.
<P>
You may use the <SAMP>`document'</SAMP> command again to change the
documentation of a command. Redefining the command with <SAMP>`define'</SAMP>
does not change the documentation.
</DL>
<P>
User-defined commands do not take arguments. When they are executed, the
commands of the definition are not printed. An error in any command
stops execution of the user-defined command.
</P><P>
Commands that would ask for confirmation if used interactively proceed
without asking when used inside a user-defined command. Many GDB commands
that normally print messages to say what they are doing omit the messages
when used in user-defined command.
</P><P>
<A NAME="Command Files"></A>
<HR SIZE="6">
<A NAME="SEC59"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC58"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC60"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC57"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC57"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC61"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 12.2 Command Files </H2>
<!--docid::SEC59::-->
<P>
<A NAME="IDX132"></A>
A command file for GDB is a file of lines that are GDB commands. Comments
(lines starting with <SAMP>`#'</SAMP>) may also be included. An empty line in a
command file does nothing; it does not mean to repeat the last command, as
it would from the terminal.
</P><P>
<A NAME="IDX133"></A>
<A NAME="IDX134"></A>
When GDB starts, it automatically executes its <EM>init files</EM>, command
files named <TT>`.gdbinit'</TT>. GDB reads the init file (if any) in your home
directory and then the init file (if any) in the current working
directory. (The init files are not executed if the <SAMP>`-nx'</SAMP> option
is given.) You can also request the execution of a command file with the
<SAMP>`source'</SAMP> command:
</P><P>
<DL COMPACT>
<DT><CODE>source <VAR>filename</VAR></CODE>
<DD><A NAME="IDX135"></A>
Execute the command file <VAR>filename</VAR>.
</DL>
<P>
The lines in a command file are executed sequentially. They are not
printed as they are executed. An error in any command terminates execution
of the command file.
</P><P>
Commands that would ask for confirmation if used interactively proceed
without asking when used in a command file. Many GDB commands that
normally print messages to say what they are doing omit the messages
when used in a command file.
</P><P>
<A NAME="Output"></A>
<HR SIZE="6">
<A NAME="SEC60"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC59"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC61"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC57"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC57"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC61"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 12.3 Commands for Controlled Output </H2>
<!--docid::SEC60::-->
<P>
During the execution of a command file or a user-defined command, the only
output that appears is what is explicitly printed by the commands of the
definition. This section describes three commands useful for generating
exactly the output you want.
</P><P>
<DL COMPACT>
<DT><CODE>echo <VAR>text</VAR></CODE>
<DD><A NAME="IDX136"></A>
Print <VAR>text</VAR>. Nonprinting characters can be included in
<VAR>text</VAR> using C escape sequences, such as <SAMP>`\n'</SAMP> to print a
newline. <B>No newline will be printed unless you specify one.</B>
<P>
A backslash at the end of <VAR>text</VAR> is ignored. It is useful for
outputting a string ending in spaces, since trailing spaces are
trimmed from all arguments. A backslash at the beginning preserves
leading spaces in the same way, because <SAMP>`\ '</SAMP> as an escape
sequence stands for a space. Thus, to print <SAMP>` and foo = '</SAMP>, do
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>echo \ and foo = \
</pre></td></tr></table></P><P>
<DT><CODE>output <VAR>expression</VAR></CODE>
<DD><A NAME="IDX137"></A>
Print the value of <VAR>expression</VAR> and nothing but that value: no
newlines, no <SAMP>`$<VAR>nn</VAR> = '</SAMP>. The value is not entered in the
value history either. See section <A HREF="gdb.html#SEC41">9.1 Expressions</A> for more information
on expressions.
<P>
<DT><CODE>output/<VAR>fmt</VAR> <VAR>expression</VAR></CODE>
<DD>Print the value of <VAR>expression</VAR> in format <VAR>fmt</VAR>.
See section <A HREF="gdb.html#SEC44">9.4 Formats</A>, for more information.
<P>
<DT><CODE>printf <VAR>string</VAR>, <VAR>expressions</VAR><small>...</small></CODE>
<DD><A NAME="IDX138"></A>
Print the values of the <VAR>expressions</VAR> under the control of
<VAR>string</VAR>. The <VAR>expressions</VAR> are separated by commas and may
be either numbers or pointers. Their values are printed as specified
by <VAR>string</VAR>, exactly as if the program were to execute
<P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>printf (<VAR>string</VAR>, <VAR>expressions</VAR><small>...</small>);
</pre></td></tr></table></P><P>
For example, you can print two values in hex like this:
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo
</pre></td></tr></table></P><P>
The only backslash-escape sequences that you can use in the string are
the simple ones that consist of backslash followed by a letter.
</DL>
<P>
<A NAME="Emacs"></A>
<HR SIZE="6">
<A NAME="SEC61"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC60"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC62"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC57"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC62"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 13. Using GDB under GNU Emacs </H1>
<!--docid::SEC61::-->
<P>
A special interface allows you to use GNU Emacs to view (and
edit) the source files for the program you are debugging with
GDB.
</P><P>
To use this interface, use the command <KBD>M-x gdb</KBD> in Emacs.
Give the executable file you want to debug as an argument. This
command starts a GDB process as a subprocess of Emacs, with input
and output through a newly created Emacs buffer.
</P><P>
Using this GDB process is just like using GDB normally except for two things:
</P><P>
<UL>
<LI>
All "terminal" input and output goes through the Emacs buffer. This
applies both to GDB commands and their output, and to the input and
output done by the program you are debugging.
<P>
This is useful because it means that you can copy the text of previous
commands and input them again; you can even use parts of the output
in this way.
</P><P>
All the facilities of Emacs's Shell mode are available for this purpose.
</P><P>
<LI>
GDB displays source code through Emacs. Each time GDB displays a
stack frame, Emacs automatically finds the source file for that frame
and puts an arrow (<SAMP>`=&#62;'</SAMP>) at the left margin of the current line.
<P>
Explicit GDB <SAMP>`list'</SAMP> or search commands still produce output as
usual, but you probably will have no reason to use them.
</UL>
<P>
In the GDB I/O buffer, you can use these special Emacs commands:
</P><P>
<DL COMPACT>
<DT><KBD>M-s</KBD>
<DD>Execute to another source line, like the GDB <SAMP>`step'</SAMP> command.
<P>
<DT><KBD>M-n</KBD>
<DD>Execute to next source line in this function, skipping all function
calls, like the GDB <SAMP>`next'</SAMP> command.
<P>
<DT><KBD>M-i</KBD>
<DD>Execute one instruction, like the GDB <SAMP>`stepi'</SAMP> command.
<P>
<DT><KBD>M-u</KBD>
<DD>Move up one stack frame (and display that frame's source file in
Emacs), like the GDB <SAMP>`up'</SAMP> command.
<P>
<DT><KBD>M-d</KBD>
<DD>Move down one stack frame (and display that frame's source file in
Emacs), like the GDB <SAMP>`down'</SAMP> command. (This means that you cannot
delete words in the usual fashion in the GDB buffer; I am guessing you
won't often want to do that.)
<P>
<DT><KBD>C-c C-f</KBD>
<DD>Execute until exit from the selected stack frame, like the GDB
<SAMP>`finish'</SAMP> command.
</DL>
<P>
In any source file, the Emacs command <KBD>C-x SPC</KBD> (<CODE>gdb-break</CODE>)
tells GDB to set a breakpoint on the source line point is on.
</P><P>
The source files displayed in Emacs are in ordinary Emacs buffers
which are visiting the source files in the usual way. You can edit
the files with these buffers if you wish; but keep in mind that GDB
communicates with Emacs in terms of line numbers. If you add or
delete lines from the text, the line numbers that GDB knows will cease
to correspond properly to the code.
</P><P>
<A NAME="Remote"></A>
<HR SIZE="6">
<A NAME="SEC62"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC61"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC63"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC61"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC64"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 14. Remote Kernel Debugging </H1>
<!--docid::SEC62::-->
<P>
GDB has a special facility for debugging a remote machine via a serial
connection. This can be used for kernel debugging.
</P><P>
The program to be debugged on the remote machine needs to contain a
debugging device driver which talks to GDB over the serial line using the
protocol described below. The same version of GDB that is used ordinarily
can be used for this.
</P><P>
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb.html#SEC63">14.1 Commands for Remote Debugging</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">Commands used to start and finish remote debugging.</TD></TR>
</TABLE></BLOCKQUOTE>
<P>
For details of the communication protocol, see the comments in the GDB
source file <TT>`remote.c'</TT>.
</P><P>
<A NAME="Remote Commands"></A>
<HR SIZE="6">
<A NAME="SEC63"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC62"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC64"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC62"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC62"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC64"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 14.1 Commands for Remote Debugging </H2>
<!--docid::SEC63::-->
<P>
To start remote debugging, first run GDB and specify as an executable file
the program that is running in the remote machine. This tells GDB how
to find the program's symbols and the contents of its pure text. Then
establish communication using the <SAMP>`attach'</SAMP> command with a device
name rather than a pid as an argument. For example:
</P><P>
<TABLE><tr><td>&nbsp;</td><td class=example><pre>attach /dev/ttyd
</pre></td></tr></table></P><P>
if the serial line is connected to the device named <TT>`/dev/ttyd'</TT>. This
will stop the remote machine if it is not already stopped.
</P><P>
Now you can use all the usual commands to examine and change data and to
step and continue the remote program.
</P><P>
To resume the remote program and stop debugging it, use the <SAMP>`detach'</SAMP>
command.
</P><P>
<A NAME="Commands"></A>
<HR SIZE="6">
<A NAME="SEC64"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC63"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC65"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC62"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC65"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> Command Index </H1>
<!--docid::SEC64::-->
<P>
<table><tr><th valign=top>Jump to: &nbsp; </th><td><A HREF="gdb.html#ky_!" style="text-decoration:none"><b>!</b></A>
&nbsp;
<A HREF="gdb.html#ky_$" style="text-decoration:none"><b>$</b></A>
&nbsp;
<BR>
<A HREF="gdb.html#ky_A" style="text-decoration:none"><b>A</b></A>
&nbsp;
<A HREF="gdb.html#ky_B" style="text-decoration:none"><b>B</b></A>
&nbsp;
<A HREF="gdb.html#ky_C" style="text-decoration:none"><b>C</b></A>
&nbsp;
<A HREF="gdb.html#ky_D" style="text-decoration:none"><b>D</b></A>
&nbsp;
<A HREF="gdb.html#ky_E" style="text-decoration:none"><b>E</b></A>
&nbsp;
<A HREF="gdb.html#ky_F" style="text-decoration:none"><b>F</b></A>
&nbsp;
<A HREF="gdb.html#ky_H" style="text-decoration:none"><b>H</b></A>
&nbsp;
<A HREF="gdb.html#ky_I" style="text-decoration:none"><b>I</b></A>
&nbsp;
<A HREF="gdb.html#ky_J" style="text-decoration:none"><b>J</b></A>
&nbsp;
<A HREF="gdb.html#ky_K" style="text-decoration:none"><b>K</b></A>
&nbsp;
<A HREF="gdb.html#ky_L" style="text-decoration:none"><b>L</b></A>
&nbsp;
<A HREF="gdb.html#ky_N" style="text-decoration:none"><b>N</b></A>
&nbsp;
<A HREF="gdb.html#ky_O" style="text-decoration:none"><b>O</b></A>
&nbsp;
<A HREF="gdb.html#ky_P" style="text-decoration:none"><b>P</b></A>
&nbsp;
<A HREF="gdb.html#ky_Q" style="text-decoration:none"><b>Q</b></A>
&nbsp;
<A HREF="gdb.html#ky_R" style="text-decoration:none"><b>R</b></A>
&nbsp;
<A HREF="gdb.html#ky_S" style="text-decoration:none"><b>S</b></A>
&nbsp;
<A HREF="gdb.html#ky_T" style="text-decoration:none"><b>T</b></A>
&nbsp;
<A HREF="gdb.html#ky_U" style="text-decoration:none"><b>U</b></A>
&nbsp;
<A HREF="gdb.html#ky_W" style="text-decoration:none"><b>W</b></A>
&nbsp;
<A HREF="gdb.html#ky_X" style="text-decoration:none"><b>X</b></A>
&nbsp;
</td></tr></table><br><P></P>
<TABLE border=0>
<TR><TD></TD><TH ALIGN=LEFT>Index Entry</TH><TH ALIGN=LEFT> Section</TH></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_!"></A>!</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX2"><CODE>!</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC5">1. GDB Input Conventions</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_$"></A>$</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX35"><CODE>$_</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC22">6.2 Breakpoints</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX80"><CODE>$_</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC37">8.1 Printing Source Lines</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX96"><CODE>$_</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC45">9.4.1 Examining Memory</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX97"><CODE>$__</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC45">9.4.1 Examining Memory</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_A"></A>A</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX13"><CODE>add-file</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC8">2.2 Specifying Files with Commands</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#SEC19"><CODE>attach</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC19">5.5 Debugging an Already-Running Process</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_B"></A>B</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX36"><CODE>break</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC23">6.2.1 Setting Breakpoints</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_C"></A>C</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX26"><CODE>cd</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC17">5.3 Your Program's Working Directory</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX40"><CODE>clear</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC24">6.2.2 Clearing Breakpoints</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX49"><CODE>condition</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC26">6.2.4 Break Conditions</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX54"><CODE>cont</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC29">6.3 Continuing</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX12"><CODE>core-file</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC8">2.2 Specifying Files with Commands</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_D"></A>D</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX130"><CODE>define</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC58">12.1 User-Defined Commands</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX41"><CODE>delete</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC24">6.2.2 Clearing Breakpoints</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX100"><CODE>delete display</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC46">9.5 Automatic Display</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX23"><CODE>delete environment</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC16">5.2 Your Program's Environment</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#SEC19"><CODE>detach</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC19">5.5 Debugging an Already-Running Process</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX83"><CODE>directory</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC39">8.3 Specifying Source Directories</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX45"><CODE>disable</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC25">6.2.3 Disabling Breakpoints</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX44"><CODE>disable breakpoints</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC25">6.2.3 Disabling Breakpoints</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX101"><CODE>disable display</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC46">9.5 Automatic Display</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX98"><CODE>display</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC46">9.5 Automatic Display</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX131"><CODE>document</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC58">12.1 User-Defined Commands</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX74"><CODE>down</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC34">7.3 Selecting a Frame</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_E"></A>E</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX136"><CODE>echo</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC60">12.3 Commands for Controlled Output</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX47"><CODE>enable</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC25">6.2.3 Disabling Breakpoints</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX46"><CODE>enable breakpoints</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC25">6.2.3 Disabling Breakpoints</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX102"><CODE>enable display</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC46">9.5 Automatic Display</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX10"><CODE>exec-file</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC8">2.2 Specifying Files with Commands</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_F"></A>F</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX58"><CODE>finish</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC30">6.4 Stepping</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#SEC38"><CODE>forward-search</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC38">8.2 Searching Source Files</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX72"><CODE>frame</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC34">7.3 Selecting a Frame</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_H"></A>H</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX32"><CODE>handle</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC21">6.1 Signals</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_I"></A>I</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX51"><CODE>ignore</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC26">6.2.4 Break Conditions</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX113"><CODE>info address</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC51">10. Examining the Symbol Table</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX76"><CODE>info args</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC35">7.4 Information on a Frame</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX34"><CODE>info break</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC22">6.2 Breakpoints</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX109"><CODE>info convenience</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC48">9.7 Convenience Variables</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX84"><CODE>info directories</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC39">8.3 Specifying Source Directories</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX103"><CODE>info display</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC46">9.5 Automatic Display</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX21"><CODE>info environment</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC16">5.2 Your Program's Environment</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX15"><CODE>info files</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC8">2.2 Specifying Files with Commands</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX75"><CODE>info frame</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC35">7.4 Information on a Frame</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX116"><CODE>info functions</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC51">10. Examining the Symbol Table</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX107"><CODE>info history</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC47">9.6 Value History</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX79"><CODE>info line</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC37">8.1 Printing Source Lines</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX77"><CODE>info locals</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC35">7.4 Information on a Frame</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX119"><CODE>info methods</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC51">10. Examining the Symbol Table</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX111"><CODE>info registers</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC49">9.8 Registers</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX31"><CODE>info signal</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC21">6.1 Signals</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX115"><CODE>info sources</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC51">10. Examining the Symbol Table</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX118"><CODE>info types</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC51">10. Examining the Symbol Table</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX117"><CODE>info variables</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC51">10. Examining the Symbol Table</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_J"></A>J</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX125"><CODE>jump</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC54">11.2 Continuing at a Different Address</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_K"></A>K</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX14"><CODE>kill</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC8">2.2 Specifying Files with Commands</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_L"></A>L</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX78"><CODE>list</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC37">8.1 Printing Source Lines</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_N"></A>N</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX57"><CODE>next</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC30">6.4 Stepping</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX62"><CODE>nexti</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC30">6.4 Stepping</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX63"><CODE>ni</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC30">6.4 Stepping</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_O"></A>O</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX137"><CODE>output</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC60">12.3 Commands for Controlled Output</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_P"></A>P</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX87"><CODE>print</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC40">9. Examining Data</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX138"><CODE>printf</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC60">12.3 Commands for Controlled Output</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX120"><CODE>printsyms</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC51">10. Examining the Symbol Table</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX114"><CODE>ptype</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC51">10. Examining the Symbol Table</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX27"><CODE>pwd</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC17">5.3 Your Program's Working Directory</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_Q"></A>Q</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX6"><CODE>quit</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC5">1. GDB Input Conventions</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_R"></A>R</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX128"><CODE>return</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC56">11.4 Returning from a Function</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#SEC38"><CODE>reverse-search</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC38">8.2 Searching Source Files</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX17"><CODE>run</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC14">5. Running Your Program Under GDB</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_S"></A>S</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX123"><CODE>set</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC53">11.1 Assignment to Variables</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX19"><CODE>set args</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC15">5.1 Your Program's Arguments</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX88"><CODE>set array-max</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC40">9. Examining Data</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX22"><CODE>set environment</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC16">5.2 Your Program's Environment</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX4"><CODE>set prompt</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC5">1. GDB Input Conventions</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX124"><CODE>set variable</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC53">11.1 Assignment to Variables</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX1"><CODE>shell</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC5">1. GDB Input Conventions</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX61"><CODE>si</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC30">6.4 Stepping</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX126"><CODE>signal</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC55">11.3 Giving the Program a Signal</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX53"><CODE>silent</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC27">6.2.5 Commands Executed on Breaking</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX135"><CODE>source</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC59">12.2 Command Files</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX56"><CODE>step</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC30">6.4 Stepping</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX60"><CODE>stepi</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC30">6.4 Stepping</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX11"><CODE>symbol-file</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC8">2.2 Specifying Files with Commands</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_T"></A>T</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX37"><CODE>tbreak</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC23">6.2.1 Setting Breakpoints</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX30"><CODE>tty</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC18">5.4 Your Program's Input and Output</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_U"></A>U</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX99"><CODE>undisplay</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC46">9.5 Automatic Display</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX24"><CODE>unset environment</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC16">5.2 Your Program's Environment</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX59"><CODE>until</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC30">6.4 Stepping</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX73"><CODE>up</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC34">7.3 Selecting a Frame</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_W"></A>W</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX112"><CODE>whatis</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC51">10. Examining the Symbol Table</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="ky_X"></A>X</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX94"><CODE>x</CODE></A></TD><TD valign=top><A HREF="gdb.html#SEC45">9.4.1 Examining Memory</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
</TABLE><P></P><table><tr><th valign=top>Jump to: &nbsp; </th><td><A HREF="gdb.html#ky_!" style="text-decoration:none"><b>!</b></A>
&nbsp;
<A HREF="gdb.html#ky_$" style="text-decoration:none"><b>$</b></A>
&nbsp;
<BR>
<A HREF="gdb.html#ky_A" style="text-decoration:none"><b>A</b></A>
&nbsp;
<A HREF="gdb.html#ky_B" style="text-decoration:none"><b>B</b></A>
&nbsp;
<A HREF="gdb.html#ky_C" style="text-decoration:none"><b>C</b></A>
&nbsp;
<A HREF="gdb.html#ky_D" style="text-decoration:none"><b>D</b></A>
&nbsp;
<A HREF="gdb.html#ky_E" style="text-decoration:none"><b>E</b></A>
&nbsp;
<A HREF="gdb.html#ky_F" style="text-decoration:none"><b>F</b></A>
&nbsp;
<A HREF="gdb.html#ky_H" style="text-decoration:none"><b>H</b></A>
&nbsp;
<A HREF="gdb.html#ky_I" style="text-decoration:none"><b>I</b></A>
&nbsp;
<A HREF="gdb.html#ky_J" style="text-decoration:none"><b>J</b></A>
&nbsp;
<A HREF="gdb.html#ky_K" style="text-decoration:none"><b>K</b></A>
&nbsp;
<A HREF="gdb.html#ky_L" style="text-decoration:none"><b>L</b></A>
&nbsp;
<A HREF="gdb.html#ky_N" style="text-decoration:none"><b>N</b></A>
&nbsp;
<A HREF="gdb.html#ky_O" style="text-decoration:none"><b>O</b></A>
&nbsp;
<A HREF="gdb.html#ky_P" style="text-decoration:none"><b>P</b></A>
&nbsp;
<A HREF="gdb.html#ky_Q" style="text-decoration:none"><b>Q</b></A>
&nbsp;
<A HREF="gdb.html#ky_R" style="text-decoration:none"><b>R</b></A>
&nbsp;
<A HREF="gdb.html#ky_S" style="text-decoration:none"><b>S</b></A>
&nbsp;
<A HREF="gdb.html#ky_T" style="text-decoration:none"><b>T</b></A>
&nbsp;
<A HREF="gdb.html#ky_U" style="text-decoration:none"><b>U</b></A>
&nbsp;
<A HREF="gdb.html#ky_W" style="text-decoration:none"><b>W</b></A>
&nbsp;
<A HREF="gdb.html#ky_X" style="text-decoration:none"><b>X</b></A>
&nbsp;
</td></tr></table><br></P><P>
<A NAME="Concepts"></A>
<HR SIZE="6">
<A NAME="SEC65"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC64"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt; ]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC64"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[ &gt;&gt; ]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> Concept Index </H1>
<!--docid::SEC65::-->
<P>
<table><tr><th valign=top>Jump to: &nbsp; </th><td><A HREF="gdb.html#cp_$" style="text-decoration:none"><b>$</b></A>
&nbsp;
<A HREF="gdb.html#cp_." style="text-decoration:none"><b>.</b></A>
&nbsp;
<BR>
<A HREF="gdb.html#cp_A" style="text-decoration:none"><b>A</b></A>
&nbsp;
<A HREF="gdb.html#cp_B" style="text-decoration:none"><b>B</b></A>
&nbsp;
<A HREF="gdb.html#cp_C" style="text-decoration:none"><b>C</b></A>
&nbsp;
<A HREF="gdb.html#cp_D" style="text-decoration:none"><b>D</b></A>
&nbsp;
<A HREF="gdb.html#cp_E" style="text-decoration:none"><b>E</b></A>
&nbsp;
<A HREF="gdb.html#cp_F" style="text-decoration:none"><b>F</b></A>
&nbsp;
<A HREF="gdb.html#cp_I" style="text-decoration:none"><b>I</b></A>
&nbsp;
<A HREF="gdb.html#cp_O" style="text-decoration:none"><b>O</b></A>
&nbsp;
<A HREF="gdb.html#cp_P" style="text-decoration:none"><b>P</b></A>
&nbsp;
<A HREF="gdb.html#cp_R" style="text-decoration:none"><b>R</b></A>
&nbsp;
<A HREF="gdb.html#cp_S" style="text-decoration:none"><b>S</b></A>
&nbsp;
<A HREF="gdb.html#cp_U" style="text-decoration:none"><b>U</b></A>
&nbsp;
<A HREF="gdb.html#cp_V" style="text-decoration:none"><b>V</b></A>
&nbsp;
<A HREF="gdb.html#cp_W" style="text-decoration:none"><b>W</b></A>
&nbsp;
</td></tr></table><br><P></P>
<TABLE border=0>
<TR><TD></TD><TH ALIGN=LEFT>Index Entry</TH><TH ALIGN=LEFT> Section</TH></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="cp_$"></A>$</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX105">$</A></TD><TD valign=top><A HREF="gdb.html#SEC47">9.6 Value History</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX106">$$</A></TD><TD valign=top><A HREF="gdb.html#SEC47">9.6 Value History</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="cp_."></A>.</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX134">.gdbinit</A></TD><TD valign=top><A HREF="gdb.html#SEC59">12.2 Command Files</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="cp_A"></A>A</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX18">arguments (to your program)</A></TD><TD valign=top><A HREF="gdb.html#SEC15">5.1 Your Program's Arguments</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX90">artificial array</A></TD><TD valign=top><A HREF="gdb.html#SEC43">9.3 Artificial Arrays</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX121">assignment</A></TD><TD valign=top><A HREF="gdb.html#SEC53">11.1 Assignment to Variables</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#SEC19">attach</A></TD><TD valign=top><A HREF="gdb.html#SEC19">5.5 Debugging an Already-Running Process</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="cp_B"></A>B</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX52">breakpoint commands</A></TD><TD valign=top><A HREF="gdb.html#SEC27">6.2.5 Commands Executed on Breaking</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX33">breakpoints</A></TD><TD valign=top><A HREF="gdb.html#SEC22">6.2 Breakpoints</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="cp_C"></A>C</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX64">call stack</A></TD><TD valign=top><A HREF="gdb.html#SEC31">7. Examining the Stack</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX38">clear breakpoint</A></TD><TD valign=top><A HREF="gdb.html#SEC24">6.2.2 Clearing Breakpoints</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX132">command files</A></TD><TD valign=top><A HREF="gdb.html#SEC59">12.2 Command Files</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX48">conditions</A></TD><TD valign=top><A HREF="gdb.html#SEC26">6.2.4 Break Conditions</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX29">controlling terminal</A></TD><TD valign=top><A HREF="gdb.html#SEC18">5.4 Your Program's Input and Output</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX108">convenience variables</A></TD><TD valign=top><A HREF="gdb.html#SEC48">9.7 Convenience Variables</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX7">core dump file</A></TD><TD valign=top><A HREF="gdb.html#SEC6">2. Specifying GDB's Files</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="cp_D"></A>D</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX39">delete breakpoints</A></TD><TD valign=top><A HREF="gdb.html#SEC24">6.2.2 Clearing Breakpoints</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX82">directories for source files</A></TD><TD valign=top><A HREF="gdb.html#SEC39">8.3 Specifying Source Directories</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX42">disabled breakpoints</A></TD><TD valign=top><A HREF="gdb.html#SEC25">6.2.3 Disabling Breakpoints</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="cp_E"></A>E</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX43">enabled breakpoints</A></TD><TD valign=top><A HREF="gdb.html#SEC25">6.2.3 Disabling Breakpoints</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX20">environment (of your program)</A></TD><TD valign=top><A HREF="gdb.html#SEC16">5.2 Your Program's Environment</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX86">examining data</A></TD><TD valign=top><A HREF="gdb.html#SEC40">9. Examining Data</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX93">examining memory</A></TD><TD valign=top><A HREF="gdb.html#SEC45">9.4.1 Examining Memory</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX8">executable file</A></TD><TD valign=top><A HREF="gdb.html#SEC6">2. Specifying GDB's Files</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX5">exiting GDB</A></TD><TD valign=top><A HREF="gdb.html#SEC5">1. GDB Input Conventions</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX89">expressions</A></TD><TD valign=top><A HREF="gdb.html#SEC41">9.1 Expressions</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="cp_F"></A>F</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX91">formatted output</A></TD><TD valign=top><A HREF="gdb.html#SEC44">9.4 Formats</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX65">frame</A></TD><TD valign=top><A HREF="gdb.html#SEC32">7.1 Stack Frames</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX70">frame number</A></TD><TD valign=top><A HREF="gdb.html#SEC32">7.1 Stack Frames</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX69">frame pointer</A></TD><TD valign=top><A HREF="gdb.html#SEC32">7.1 Stack Frames</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="cp_I"></A>I</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX50">ignore count (of breakpoint)</A></TD><TD valign=top><A HREF="gdb.html#SEC26">6.2.4 Break Conditions</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX133">init file</A></TD><TD valign=top><A HREF="gdb.html#SEC59">12.2 Command Files</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX66">initial frame</A></TD><TD valign=top><A HREF="gdb.html#SEC32">7.1 Stack Frames</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX68">innermost frame</A></TD><TD valign=top><A HREF="gdb.html#SEC32">7.1 Stack Frames</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="cp_O"></A>O</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX67">outermost frame</A></TD><TD valign=top><A HREF="gdb.html#SEC32">7.1 Stack Frames</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX92">output formats</A></TD><TD valign=top><A HREF="gdb.html#SEC44">9.4 Formats</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="cp_P"></A>P</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX85">printing data</A></TD><TD valign=top><A HREF="gdb.html#SEC40">9. Examining Data</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="cp_R"></A>R</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX28">redirection</A></TD><TD valign=top><A HREF="gdb.html#SEC18">5.4 Your Program's Input and Output</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX110">registers</A></TD><TD valign=top><A HREF="gdb.html#SEC49">9.8 Registers</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX127">returning from a function</A></TD><TD valign=top><A HREF="gdb.html#SEC56">11.4 Returning from a Function</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX16">running</A></TD><TD valign=top><A HREF="gdb.html#SEC14">5. Running Your Program Under GDB</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="cp_S"></A>S</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#SEC38">searching</A></TD><TD valign=top><A HREF="gdb.html#SEC38">8.2 Searching Source Files</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX71">selected frame</A></TD><TD valign=top><A HREF="gdb.html#SEC32">7.1 Stack Frames</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX122">setting variables</A></TD><TD valign=top><A HREF="gdb.html#SEC53">11.1 Assignment to Variables</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX3">shell escape</A></TD><TD valign=top><A HREF="gdb.html#SEC5">1. GDB Input Conventions</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX81">source path</A></TD><TD valign=top><A HREF="gdb.html#SEC39">8.3 Specifying Source Directories</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX55">stepping</A></TD><TD valign=top><A HREF="gdb.html#SEC30">6.4 Stepping</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX9">symbol table</A></TD><TD valign=top><A HREF="gdb.html#SEC6">2. Specifying GDB's Files</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="cp_U"></A>U</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX129">user-defined commands</A></TD><TD valign=top><A HREF="gdb.html#SEC58">12.1 User-Defined Commands</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="cp_V"></A>V</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX104">value history</A></TD><TD valign=top><A HREF="gdb.html#SEC47">9.6 Value History</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
<TR><TH><A NAME="cp_W"></A>W</TH><TD></TD><TD></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX95">word</A></TD><TD valign=top><A HREF="gdb.html#SEC45">9.4.1 Examining Memory</A></TD></TR>
<TR><TD></TD><TD valign=top><A HREF="gdb.html#IDX25">working directory (of your program)</A></TD><TD valign=top><A HREF="gdb.html#SEC17">5.3 Your Program's Working Directory</A></TD></TR>
<TR><TD COLSPAN=3> <HR></TD></TR>
</TABLE><P></P><table><tr><th valign=top>Jump to: &nbsp; </th><td><A HREF="gdb.html#cp_$" style="text-decoration:none"><b>$</b></A>
&nbsp;
<A HREF="gdb.html#cp_." style="text-decoration:none"><b>.</b></A>
&nbsp;
<BR>
<A HREF="gdb.html#cp_A" style="text-decoration:none"><b>A</b></A>
&nbsp;
<A HREF="gdb.html#cp_B" style="text-decoration:none"><b>B</b></A>
&nbsp;
<A HREF="gdb.html#cp_C" style="text-decoration:none"><b>C</b></A>
&nbsp;
<A HREF="gdb.html#cp_D" style="text-decoration:none"><b>D</b></A>
&nbsp;
<A HREF="gdb.html#cp_E" style="text-decoration:none"><b>E</b></A>
&nbsp;
<A HREF="gdb.html#cp_F" style="text-decoration:none"><b>F</b></A>
&nbsp;
<A HREF="gdb.html#cp_I" style="text-decoration:none"><b>I</b></A>
&nbsp;
<A HREF="gdb.html#cp_O" style="text-decoration:none"><b>O</b></A>
&nbsp;
<A HREF="gdb.html#cp_P" style="text-decoration:none"><b>P</b></A>
&nbsp;
<A HREF="gdb.html#cp_R" style="text-decoration:none"><b>R</b></A>
&nbsp;
<A HREF="gdb.html#cp_S" style="text-decoration:none"><b>S</b></A>
&nbsp;
<A HREF="gdb.html#cp_U" style="text-decoration:none"><b>U</b></A>
&nbsp;
<A HREF="gdb.html#cp_V" style="text-decoration:none"><b>V</b></A>
&nbsp;
<A HREF="gdb.html#cp_W" style="text-decoration:none"><b>W</b></A>
&nbsp;
</td></tr></table><br></P><P>
<HR SIZE="6">
<A NAME="SEC_Contents"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1>Table of Contents</H1>
<UL>
<A NAME="TOC1" HREF="gdb.html#SEC1">Summary of GDB</A>
<BR>
<A NAME="TOC2" HREF="gdb.html#SEC2">GDB General Public License</A>
<BR>
<UL>
<A NAME="TOC3" HREF="gdb.html#SEC3">Copying Policies</A>
<BR>
<A NAME="TOC4" HREF="gdb.html#SEC4">NO WARRANTY</A>
<BR>
</UL>
<A NAME="TOC5" HREF="gdb.html#SEC5">1. GDB Input Conventions</A>
<BR>
<A NAME="TOC6" HREF="gdb.html#SEC6">2. Specifying GDB's Files</A>
<BR>
<UL>
<A NAME="TOC7" HREF="gdb.html#SEC7">2.1 Specifying Files with Arguments</A>
<BR>
<A NAME="TOC8" HREF="gdb.html#SEC8">2.2 Specifying Files with Commands</A>
<BR>
</UL>
<A NAME="TOC9" HREF="gdb.html#SEC9">3. Options and Arguments for GDB</A>
<BR>
<UL>
<A NAME="TOC10" HREF="gdb.html#SEC10">3.1 Mode Options</A>
<BR>
<A NAME="TOC11" HREF="gdb.html#SEC11">3.2 File-specifying Options</A>
<BR>
<A NAME="TOC12" HREF="gdb.html#SEC12">3.3 Other Arguments</A>
<BR>
</UL>
<A NAME="TOC13" HREF="gdb.html#SEC13">4. Compiling Your Program for Debugging</A>
<BR>
<A NAME="TOC14" HREF="gdb.html#SEC14">5. Running Your Program Under GDB</A>
<BR>
<UL>
<A NAME="TOC15" HREF="gdb.html#SEC15">5.1 Your Program's Arguments</A>
<BR>
<A NAME="TOC16" HREF="gdb.html#SEC16">5.2 Your Program's Environment</A>
<BR>
<A NAME="TOC17" HREF="gdb.html#SEC17">5.3 Your Program's Working Directory</A>
<BR>
<A NAME="TOC18" HREF="gdb.html#SEC18">5.4 Your Program's Input and Output</A>
<BR>
<A NAME="TOC19" HREF="gdb.html#SEC19">5.5 Debugging an Already-Running Process</A>
<BR>
</UL>
<A NAME="TOC20" HREF="gdb.html#SEC20">6. Stopping and Continuing</A>
<BR>
<UL>
<A NAME="TOC21" HREF="gdb.html#SEC21">6.1 Signals</A>
<BR>
<A NAME="TOC22" HREF="gdb.html#SEC22">6.2 Breakpoints</A>
<BR>
<UL>
<A NAME="TOC23" HREF="gdb.html#SEC23">6.2.1 Setting Breakpoints</A>
<BR>
<A NAME="TOC24" HREF="gdb.html#SEC24">6.2.2 Clearing Breakpoints</A>
<BR>
<A NAME="TOC25" HREF="gdb.html#SEC25">6.2.3 Disabling Breakpoints</A>
<BR>
<A NAME="TOC26" HREF="gdb.html#SEC26">6.2.4 Break Conditions</A>
<BR>
<A NAME="TOC27" HREF="gdb.html#SEC27">6.2.5 Commands Executed on Breaking</A>
<BR>
<A NAME="TOC28" HREF="gdb.html#SEC28">6.2.6 "Cannot Insert Breakpoints" Error</A>
<BR>
</UL>
<A NAME="TOC29" HREF="gdb.html#SEC29">6.3 Continuing</A>
<BR>
<A NAME="TOC30" HREF="gdb.html#SEC30">6.4 Stepping</A>
<BR>
</UL>
<A NAME="TOC31" HREF="gdb.html#SEC31">7. Examining the Stack</A>
<BR>
<UL>
<A NAME="TOC32" HREF="gdb.html#SEC32">7.1 Stack Frames</A>
<BR>
<A NAME="TOC33" HREF="gdb.html#SEC33">7.2 Backtraces</A>
<BR>
<A NAME="TOC34" HREF="gdb.html#SEC34">7.3 Selecting a Frame</A>
<BR>
<A NAME="TOC35" HREF="gdb.html#SEC35">7.4 Information on a Frame</A>
<BR>
</UL>
<A NAME="TOC36" HREF="gdb.html#SEC36">8. Examining Source Files</A>
<BR>
<UL>
<A NAME="TOC37" HREF="gdb.html#SEC37">8.1 Printing Source Lines</A>
<BR>
<A NAME="TOC38" HREF="gdb.html#SEC38">8.2 Searching Source Files</A>
<BR>
<A NAME="TOC39" HREF="gdb.html#SEC39">8.3 Specifying Source Directories</A>
<BR>
</UL>
<A NAME="TOC40" HREF="gdb.html#SEC40">9. Examining Data</A>
<BR>
<UL>
<A NAME="TOC41" HREF="gdb.html#SEC41">9.1 Expressions</A>
<BR>
<A NAME="TOC42" HREF="gdb.html#SEC42">9.2 Program Variables</A>
<BR>
<A NAME="TOC43" HREF="gdb.html#SEC43">9.3 Artificial Arrays</A>
<BR>
<A NAME="TOC44" HREF="gdb.html#SEC44">9.4 Formats</A>
<BR>
<UL>
<A NAME="TOC45" HREF="gdb.html#SEC45">9.4.1 Examining Memory</A>
<BR>
</UL>
<A NAME="TOC46" HREF="gdb.html#SEC46">9.5 Automatic Display</A>
<BR>
<A NAME="TOC47" HREF="gdb.html#SEC47">9.6 Value History</A>
<BR>
<A NAME="TOC48" HREF="gdb.html#SEC48">9.7 Convenience Variables</A>
<BR>
<A NAME="TOC49" HREF="gdb.html#SEC49">9.8 Registers</A>
<BR>
<UL>
<A NAME="TOC50" HREF="gdb.html#SEC50">9.8.1 Examples</A>
<BR>
</UL>
</UL>
<A NAME="TOC51" HREF="gdb.html#SEC51">10. Examining the Symbol Table</A>
<BR>
<A NAME="TOC52" HREF="gdb.html#SEC52">11. Altering Execution</A>
<BR>
<UL>
<A NAME="TOC53" HREF="gdb.html#SEC53">11.1 Assignment to Variables</A>
<BR>
<A NAME="TOC54" HREF="gdb.html#SEC54">11.2 Continuing at a Different Address</A>
<BR>
<A NAME="TOC55" HREF="gdb.html#SEC55">11.3 Giving the Program a Signal</A>
<BR>
<A NAME="TOC56" HREF="gdb.html#SEC56">11.4 Returning from a Function</A>
<BR>
</UL>
<A NAME="TOC57" HREF="gdb.html#SEC57">12. Canned Sequences of Commands</A>
<BR>
<UL>
<A NAME="TOC58" HREF="gdb.html#SEC58">12.1 User-Defined Commands</A>
<BR>
<A NAME="TOC59" HREF="gdb.html#SEC59">12.2 Command Files</A>
<BR>
<A NAME="TOC60" HREF="gdb.html#SEC60">12.3 Commands for Controlled Output</A>
<BR>
</UL>
<A NAME="TOC61" HREF="gdb.html#SEC61">13. Using GDB under GNU Emacs</A>
<BR>
<A NAME="TOC62" HREF="gdb.html#SEC62">14. Remote Kernel Debugging</A>
<BR>
<UL>
<A NAME="TOC63" HREF="gdb.html#SEC63">14.1 Commands for Remote Debugging</A>
<BR>
</UL>
<A NAME="TOC64" HREF="gdb.html#SEC64">Command Index</A>
<BR>
<A NAME="TOC65" HREF="gdb.html#SEC65">Concept Index</A>
<BR>
</UL>
<HR SIZE=1>
<A NAME="SEC_OVERVIEW"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1>Short Table of Contents</H1>
<BLOCKQUOTE>
<A NAME="TOC1" HREF="gdb.html#SEC1">Summary of GDB</A>
<BR>
<A NAME="TOC2" HREF="gdb.html#SEC2">GDB General Public License</A>
<BR>
<A NAME="TOC5" HREF="gdb.html#SEC5">1. GDB Input Conventions</A>
<BR>
<A NAME="TOC6" HREF="gdb.html#SEC6">2. Specifying GDB's Files</A>
<BR>
<A NAME="TOC9" HREF="gdb.html#SEC9">3. Options and Arguments for GDB</A>
<BR>
<A NAME="TOC13" HREF="gdb.html#SEC13">4. Compiling Your Program for Debugging</A>
<BR>
<A NAME="TOC14" HREF="gdb.html#SEC14">5. Running Your Program Under GDB</A>
<BR>
<A NAME="TOC20" HREF="gdb.html#SEC20">6. Stopping and Continuing</A>
<BR>
<A NAME="TOC31" HREF="gdb.html#SEC31">7. Examining the Stack</A>
<BR>
<A NAME="TOC36" HREF="gdb.html#SEC36">8. Examining Source Files</A>
<BR>
<A NAME="TOC40" HREF="gdb.html#SEC40">9. Examining Data</A>
<BR>
<A NAME="TOC51" HREF="gdb.html#SEC51">10. Examining the Symbol Table</A>
<BR>
<A NAME="TOC52" HREF="gdb.html#SEC52">11. Altering Execution</A>
<BR>
<A NAME="TOC57" HREF="gdb.html#SEC57">12. Canned Sequences of Commands</A>
<BR>
<A NAME="TOC61" HREF="gdb.html#SEC61">13. Using GDB under GNU Emacs</A>
<BR>
<A NAME="TOC62" HREF="gdb.html#SEC62">14. Remote Kernel Debugging</A>
<BR>
<A NAME="TOC64" HREF="gdb.html#SEC64">Command Index</A>
<BR>
<A NAME="TOC65" HREF="gdb.html#SEC65">Concept Index</A>
<BR>
</BLOCKQUOTE>
<HR SIZE=1>
<A NAME="SEC_About"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1>About this document</H1>
This document was generated by <I>root</I> on <I>January, 23 2003</I>
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>
<P></P>
The buttons in the navigation panels have the following meaning:
<P></P>
<table border = "1">
<TR>
<TH> Button </TH>
<TH> Name </TH>
<TH> Go to </TH>
<TH> From 1.2.3 go to</TH>
</TR>
<TR>
<TD ALIGN="CENTER">
[ &lt; ] </TD>
<TD ALIGN="CENTER">
Back
</TD>
<TD>
previous section in reading order
</TD>
<TD>
1.2.2
</TD>
</TR>
<TR>
<TD ALIGN="CENTER">
[ &gt; ] </TD>
<TD ALIGN="CENTER">
Forward
</TD>
<TD>
next section in reading order
</TD>
<TD>
1.2.4
</TD>
</TR>
<TR>
<TD ALIGN="CENTER">
[ &lt;&lt; ] </TD>
<TD ALIGN="CENTER">
FastBack
</TD>
<TD>
previous or up-and-previous section
</TD>
<TD>
1.1
</TD>
</TR>
<TR>
<TD ALIGN="CENTER">
[ Up ] </TD>
<TD ALIGN="CENTER">
Up
</TD>
<TD>
up section
</TD>
<TD>
1.2
</TD>
</TR>
<TR>
<TD ALIGN="CENTER">
[ &gt;&gt; ] </TD>
<TD ALIGN="CENTER">
FastForward
</TD>
<TD>
next or up-and-next section
</TD>
<TD>
1.3
</TD>
</TR>
<TR>
<TD ALIGN="CENTER">
[Top] </TD>
<TD ALIGN="CENTER">
Top
</TD>
<TD>
cover (top) of document
</TD>
<TD>
&nbsp;
</TD>
</TR>
<TR>
<TD ALIGN="CENTER">
[Contents] </TD>
<TD ALIGN="CENTER">
Contents
</TD>
<TD>
table of contents
</TD>
<TD>
&nbsp;
</TD>
</TR>
<TR>
<TD ALIGN="CENTER">
[Index] </TD>
<TD ALIGN="CENTER">
Index
</TD>
<TD>
concept index
</TD>
<TD>
&nbsp;
</TD>
</TR>
<TR>
<TD ALIGN="CENTER">
[ ? ] </TD>
<TD ALIGN="CENTER">
About
</TD>
<TD>
this page
</TD>
<TD>
&nbsp;
</TD>
</TR>
</TABLE>
<P></P>
where the <STRONG> Example </STRONG> assumes that the current position
is at <STRONG> Subsubsection One-Two-Three </STRONG> of a document of
the following structure:
<UL>
<LI> 1. Section One </LI>
<UL>
<LI>1.1 Subsection One-One</LI>
<UL>
<LI> ... </LI>
</UL>
<LI>1.2 Subsection One-Two</LI>
<UL>
<LI>1.2.1 Subsubsection One-Two-One
</LI><LI>1.2.2 Subsubsection One-Two-Two
</LI><LI>1.2.3 Subsubsection One-Two-Three &nbsp; &nbsp; <STRONG>
&lt;== Current Position </STRONG>
</LI><LI>1.2.4 Subsubsection One-Two-Four
</LI></UL>
<LI>1.3 Subsection One-Three</LI>
<UL>
<LI> ... </LI>
</UL>
<LI>1.4 Subsection One-Four</LI>
</UL>
</UL>
<HR SIZE=1>
<BR>
<FONT SIZE="-1">
This document was generated
by <I>root</I> on <I>January, 23 2003</I>
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>
</BODY>
</HTML>