You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
503 lines
21 KiB
HTML
503 lines
21 KiB
HTML
<HTML>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<!-- Created on March, 27 2008 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>Debugging with GDB: Commands</TITLE>
|
|
|
|
<META NAME="description" CONTENT="Debugging with GDB: Commands">
|
|
<META NAME="keywords" CONTENT="Debugging with GDB: Commands">
|
|
<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="SEC14"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_3.html#SEC13"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_4.html#SEC15"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_5.html#SEC18"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_5.html#SEC18"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H1> 3. GDB Commands </H1>
|
|
<!--docid::SEC14::-->
|
|
<P>
|
|
|
|
You can abbreviate a GDB command to the first few letters of the command
|
|
name, if that abbreviation is unambiguous; and you can repeat certain
|
|
GDB commands by typing just <KBD>RET</KBD>. You can also use the <KBD>TAB</KBD>
|
|
key to get GDB to fill out the rest of a word in a command (or to
|
|
show you the alternatives available, if there is more than one possibility).
|
|
</P><P>
|
|
|
|
<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_4.html#SEC15">3.1 Command Syntax</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">How to give commands to GDB</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_4.html#SEC16">3.2 Command Completion</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Command completion</TD></TR>
|
|
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="gdb_4.html#SEC17">3.3 Getting Help</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">How to ask GDB for help</TD></TR>
|
|
</TABLE></BLOCKQUOTE>
|
|
<P>
|
|
|
|
<A NAME="Command Syntax"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC15"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_4.html#SEC14"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_4.html#SEC16"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_4.html#SEC14"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_4.html#SEC14"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_5.html#SEC18"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 3.1 Command Syntax </H2>
|
|
<!--docid::SEC15::-->
|
|
<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. For example, the
|
|
command <CODE>step</CODE> accepts an argument which is the number of times to
|
|
step, as in <SAMP>`step 5'</SAMP>. You can also use the <CODE>step</CODE> command
|
|
with no arguments. Some commands do not allow any arguments.
|
|
</P><P>
|
|
|
|
<A NAME="IDX63"></A>
|
|
GDB command names may always be truncated if that abbreviation is
|
|
unambiguous. Other possible command abbreviations are listed in the
|
|
documentation for individual commands. In some cases, even ambiguous
|
|
abbreviations are allowed; for example, <CODE>s</CODE> is specially defined as
|
|
equivalent to <CODE>step</CODE> even though there are other commands whose
|
|
names start with <CODE>s</CODE>. You can test abbreviations by using them as
|
|
arguments to the <CODE>help</CODE> command.
|
|
</P><P>
|
|
|
|
<A NAME="IDX64"></A>
|
|
<A NAME="IDX65"></A>
|
|
A blank line as input to GDB (typing just <KBD>RET</KBD>) means to
|
|
repeat the previous command. Certain commands (for example, <CODE>run</CODE>)
|
|
will not repeat this way; these are commands whose unintentional
|
|
repetition might cause trouble and which you are unlikely to want to
|
|
repeat. User-defined commands can disable this feature; see
|
|
<A HREF="gdb_21.html#SEC230">dont-repeat</A>.
|
|
</P><P>
|
|
|
|
The <CODE>list</CODE> and <CODE>x</CODE> commands, when you repeat them with
|
|
<KBD>RET</KBD>, construct new arguments rather than repeating
|
|
exactly as typed. This permits easy scanning of source or memory.
|
|
</P><P>
|
|
|
|
GDB can also use <KBD>RET</KBD> in another way: to partition lengthy
|
|
output, in a way similar to the common utility <CODE>more</CODE>
|
|
(see section <A HREF="gdb_20.html#SEC224">Screen Size</A>). Since it is easy to press one
|
|
<KBD>RET</KBD> too many in this situation, GDB disables command
|
|
repetition after any command that generates this sort of display.
|
|
</P><P>
|
|
|
|
<A NAME="IDX66"></A>
|
|
<A NAME="IDX67"></A>
|
|
Any text from a <KBD>#</KBD> to the end of the line is a comment; it does
|
|
nothing. This is useful mainly in command files (see section <A HREF="gdb_21.html#SEC232">Command Files</A>).
|
|
</P><P>
|
|
|
|
<A NAME="IDX68"></A>
|
|
<A NAME="IDX69"></A>
|
|
The <KBD>Ctrl-o</KBD> binding is useful for repeating a complex sequence of
|
|
commands. This command accepts the current line, like <KBD>RET</KBD>, and
|
|
then fetches the next line relative to the current line from the history
|
|
for editing.
|
|
</P><P>
|
|
|
|
<A NAME="Completion"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC16"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_4.html#SEC15"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_4.html#SEC17"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_4.html#SEC17"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_4.html#SEC14"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_5.html#SEC18"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 3.2 Command Completion </H2>
|
|
<!--docid::SEC16::-->
|
|
<P>
|
|
|
|
<A NAME="IDX70"></A>
|
|
<A NAME="IDX71"></A>
|
|
GDB can fill in the rest of a word in a command for you, if there is
|
|
only one possibility; it can also show you what the valid possibilities
|
|
are for the next word in a command, at any time. This works for GDB
|
|
commands, GDB subcommands, and the names of symbols in your program.
|
|
</P><P>
|
|
|
|
Press the <KBD>TAB</KBD> key whenever you want GDB to fill out the rest
|
|
of a word. If there is only one possibility, GDB fills in the
|
|
word, and waits for you to finish the command (or press <KBD>RET</KBD> to
|
|
enter it). For example, if you type
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) info bre <KBD>TAB</KBD>
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
GDB fills in the rest of the word <SAMP>`breakpoints'</SAMP>, since that is
|
|
the only <CODE>info</CODE> subcommand beginning with <SAMP>`bre'</SAMP>:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) info breakpoints
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
You can either press <KBD>RET</KBD> at this point, to run the <CODE>info
|
|
breakpoints</CODE> command, or backspace and enter something else, if
|
|
<SAMP>`breakpoints'</SAMP> does not look like the command you expected. (If you
|
|
were sure you wanted <CODE>info breakpoints</CODE> in the first place, you
|
|
might as well just type <KBD>RET</KBD> immediately after <SAMP>`info bre'</SAMP>,
|
|
to exploit command abbreviations rather than command completion).
|
|
</P><P>
|
|
|
|
If there is more than one possibility for the next word when you press
|
|
<KBD>TAB</KBD>, GDB sounds a bell. You can either supply more
|
|
characters and try again, or just press <KBD>TAB</KBD> a second time;
|
|
GDB displays all the possible completions for that word. For
|
|
example, you might want to set a breakpoint on a subroutine whose name
|
|
begins with <SAMP>`make_'</SAMP>, but when you type <KBD>b make_<KBD>TAB</KBD></KBD> GDB
|
|
just sounds the bell. Typing <KBD>TAB</KBD> again displays all the
|
|
function names in your program that begin with those characters, for
|
|
example:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) b make_ <KBD>TAB</KBD>
|
|
GDB sounds bell; press <KBD>TAB</KBD> again, to see:
|
|
make_a_section_from_file make_environ
|
|
make_abs_section make_function_type
|
|
make_blockvector make_pointer_type
|
|
make_cleanup make_reference_type
|
|
make_command make_symbol_completion_list
|
|
(gdb) b make_
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
After displaying the available possibilities, GDB copies your
|
|
partial input (<SAMP>`b make_'</SAMP> in the example) so you can finish the
|
|
command.
|
|
</P><P>
|
|
|
|
If you just want to see the list of alternatives in the first place, you
|
|
can press <KBD>M-?</KBD> rather than pressing <KBD>TAB</KBD> twice. <KBD>M-?</KBD>
|
|
means <KBD><KBD>META</KBD> ?</KBD>. You can type this either by holding down a
|
|
key designated as the <KBD>META</KBD> shift on your keyboard (if there is
|
|
one) while typing <KBD>?</KBD>, or as <KBD>ESC</KBD> followed by <KBD>?</KBD>.
|
|
</P><P>
|
|
|
|
<A NAME="IDX72"></A>
|
|
<A NAME="IDX73"></A>
|
|
Sometimes the string you need, while logically a "word", may contain
|
|
parentheses or other characters that GDB normally excludes from
|
|
its notion of a word. To permit word completion to work in this
|
|
situation, you may enclose words in <CODE>'</CODE> (single quote marks) in
|
|
GDB commands.
|
|
</P><P>
|
|
|
|
The most likely situation where you might need this is in typing the
|
|
name of a C<TT>++</TT> function. This is because C<TT>++</TT> allows function
|
|
overloading (multiple definitions of the same function, distinguished
|
|
by argument type). For example, when you want to set a breakpoint you
|
|
may need to distinguish whether you mean the version of <CODE>name</CODE>
|
|
that takes an <CODE>int</CODE> parameter, <CODE>name(int)</CODE>, or the version
|
|
that takes a <CODE>float</CODE> parameter, <CODE>name(float)</CODE>. To use the
|
|
word-completion facilities in this situation, type a single quote
|
|
<CODE>'</CODE> at the beginning of the function name. This alerts
|
|
GDB that it may need to consider more information than usual
|
|
when you press <KBD>TAB</KBD> or <KBD>M-?</KBD> to request word completion:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) b 'bubble( <KBD>M-?</KBD>
|
|
bubble(double,double) bubble(int,int)
|
|
(gdb) b 'bubble(
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
In some cases, GDB can tell that completing a name requires using
|
|
quotes. When this happens, GDB inserts the quote for you (while
|
|
completing as much as it can) if you do not type the quote in the first
|
|
place:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) b bub <KBD>TAB</KBD>
|
|
GDB alters your input line to the following, and rings a bell:
|
|
(gdb) b 'bubble(
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
In general, GDB can tell that a quote is needed (and inserts it) if
|
|
you have not yet started typing the argument list when you ask for
|
|
completion on an overloaded symbol.
|
|
</P><P>
|
|
|
|
For more information about overloaded functions, see <A HREF="gdb_13.html#SEC115">C<TT>++</TT> Expressions</A>. You can use the command <CODE>set
|
|
overload-resolution off</CODE> to disable overload resolution;
|
|
see <A HREF="gdb_13.html#SEC119">GDB Features for C<TT>++</TT></A>.
|
|
</P><P>
|
|
|
|
<A NAME="Help"></A>
|
|
<HR SIZE="6">
|
|
<A NAME="SEC17"></A>
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_4.html#SEC16"> < </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_5.html#SEC18"> > </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_4.html#SEC14"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_4.html#SEC14"> Up </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_5.html#SEC18"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<H2> 3.3 Getting Help </H2>
|
|
<!--docid::SEC17::-->
|
|
<P>
|
|
|
|
You can always ask GDB itself for information on its commands,
|
|
using the command <CODE>help</CODE>.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX74"></A>
|
|
<DT><CODE>help</CODE>
|
|
<DD><DT><CODE>h</CODE>
|
|
<DD>You can use <CODE>help</CODE> (abbreviated <CODE>h</CODE>) with no arguments to
|
|
display a short list of named classes of commands:
|
|
<P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) help
|
|
List of classes of commands:
|
|
|
|
aliases -- Aliases of other commands
|
|
breakpoints -- Making program stop at certain points
|
|
data -- Examining data
|
|
files -- Specifying and examining files
|
|
internals -- Maintenance commands
|
|
obscure -- Obscure features
|
|
running -- Running the program
|
|
stack -- Examining the stack
|
|
status -- Status inquiries
|
|
support -- Support facilities
|
|
tracepoints -- Tracing of program execution without
|
|
stopping the program
|
|
user-defined -- User-defined commands
|
|
|
|
Type "help" followed by a class name for a list of
|
|
commands in that class.
|
|
Type "help" followed by command name for full
|
|
documentation.
|
|
Command name abbreviations are allowed if unambiguous.
|
|
(gdb)
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
<DT><CODE>help <VAR>class</VAR></CODE>
|
|
<DD>Using one of the general help classes as an argument, you can get a
|
|
list of the individual commands in that class. For example, here is the
|
|
help display for the class <CODE>status</CODE>:
|
|
<P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>(gdb) help status
|
|
Status inquiries.
|
|
|
|
List of commands:
|
|
|
|
info -- Generic command for showing things
|
|
about the program being debugged
|
|
show -- Generic command for showing things
|
|
about the debugger
|
|
|
|
Type "help" followed by command name for full
|
|
documentation.
|
|
Command name abbreviations are allowed if unambiguous.
|
|
(gdb)
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
<DT><CODE>help <VAR>command</VAR></CODE>
|
|
<DD>With a command name as <CODE>help</CODE> argument, GDB displays a
|
|
short paragraph on how to use that command.
|
|
<P>
|
|
|
|
<A NAME="IDX75"></A>
|
|
<DT><CODE>apropos <VAR>args</VAR></CODE>
|
|
<DD>The <CODE>apropos</CODE> command searches through all of the GDB
|
|
commands, and their documentation, for the regular expression specified in
|
|
<VAR>args</VAR>. It prints out all matches found. For example:
|
|
<P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>apropos reload
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
results in:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>set symbol-reloading -- Set dynamic symbol table reloading
|
|
multiple times in one run
|
|
show symbol-reloading -- Show dynamic symbol table reloading
|
|
multiple times in one run
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
<A NAME="IDX76"></A>
|
|
<DT><CODE>complete <VAR>args</VAR></CODE>
|
|
<DD>The <CODE>complete <VAR>args</VAR></CODE> command lists all the possible completions
|
|
for the beginning of a command. Use <VAR>args</VAR> to specify the beginning of the
|
|
command you want completed. For example:
|
|
<P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>complete i
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
results in:
|
|
</P><P>
|
|
|
|
<TABLE><tr><td> </td><td class=smallexample><FONT SIZE=-1><pre>if
|
|
ignore
|
|
info
|
|
inspect
|
|
</FONT></pre></td></tr></table></P><P>
|
|
|
|
This is intended for use by GNU Emacs.
|
|
</DL>
|
|
<P>
|
|
|
|
In addition to <CODE>help</CODE>, you can use the GDB commands <CODE>info</CODE>
|
|
and <CODE>show</CODE> to inquire about the state of your program, or the state
|
|
of GDB itself. Each command supports many topics of inquiry; this
|
|
manual introduces each of them in the appropriate context. The listings
|
|
under <CODE>info</CODE> and under <CODE>show</CODE> in the Index point to
|
|
all the sub-commands. See section <A HREF="gdb_38.html#SEC764">Index</A>.
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX77"></A>
|
|
<A NAME="IDX78"></A>
|
|
<DT><CODE>info</CODE>
|
|
<DD>This command (abbreviated <CODE>i</CODE>) is for describing the state of your
|
|
program. For example, you can show the arguments passed to a function
|
|
with <CODE>info args</CODE>, list the registers currently in use with <CODE>info
|
|
registers</CODE>, or list the breakpoints you have set with <CODE>info breakpoints</CODE>.
|
|
You can get a complete list of the <CODE>info</CODE> sub-commands with
|
|
<CODE>help info</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX79"></A>
|
|
<DT><CODE>set</CODE>
|
|
<DD>You can assign the result of an expression to an environment variable with
|
|
<CODE>set</CODE>. For example, you can set the GDB prompt to a $-sign with
|
|
<CODE>set prompt $</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX80"></A>
|
|
<DT><CODE>show</CODE>
|
|
<DD>In contrast to <CODE>info</CODE>, <CODE>show</CODE> is for describing the state of
|
|
GDB itself.
|
|
You can change most of the things you can <CODE>show</CODE>, by using the
|
|
related command <CODE>set</CODE>; for example, you can control what number
|
|
system is used for displays with <CODE>set radix</CODE>, or simply inquire
|
|
which is currently in use with <CODE>show radix</CODE>.
|
|
<P>
|
|
|
|
<A NAME="IDX81"></A>
|
|
To display all the settable parameters and their current
|
|
values, you can use <CODE>show</CODE> with no arguments; you may also use
|
|
<CODE>info set</CODE>. Both commands produce the same display.
|
|
</DL>
|
|
<P>
|
|
|
|
Here are three miscellaneous <CODE>show</CODE> subcommands, all of which are
|
|
exceptional in lacking corresponding <CODE>set</CODE> commands:
|
|
</P><P>
|
|
|
|
<DL COMPACT>
|
|
<A NAME="IDX82"></A>
|
|
<A NAME="IDX83"></A>
|
|
<DT><CODE>show version</CODE>
|
|
<DD>Show what version of GDB is running. You should include this
|
|
information in GDB bug-reports. If multiple versions of
|
|
GDB are in use at your site, you may need to determine which
|
|
version of GDB you are running; as GDB evolves, new
|
|
commands are introduced, and old ones may wither away. Also, many
|
|
system vendors ship variant versions of GDB, and there are
|
|
variant versions of GDB in GNU/Linux distributions as well.
|
|
The version number is the same as the one announced when you start
|
|
GDB.
|
|
<P>
|
|
|
|
<A NAME="IDX84"></A>
|
|
<A NAME="IDX85"></A>
|
|
<A NAME="IDX86"></A>
|
|
<DT><CODE>show copying</CODE>
|
|
<DD><DT><CODE>info copying</CODE>
|
|
<DD>Display information about permission for copying GDB.
|
|
<P>
|
|
|
|
<A NAME="IDX87"></A>
|
|
<A NAME="IDX88"></A>
|
|
<DT><CODE>show warranty</CODE>
|
|
<DD><DT><CODE>info warranty</CODE>
|
|
<DD>Display the GNU "NO WARRANTY" statement, or a warranty,
|
|
if your version of GDB comes with one.
|
|
<P>
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
<A NAME="Running"></A>
|
|
<HR SIZE="6">
|
|
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
|
|
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_4.html#SEC14"> << </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_5.html#SEC18"> >> </A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb.html#SEC_Top">Top</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_toc.html#SEC_Contents">Contents</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_38.html#SEC764">Index</A>]</TD>
|
|
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="gdb_abt.html#SEC_About"> ? </A>]</TD>
|
|
</TR></TABLE>
|
|
<BR>
|
|
<FONT SIZE="-1">
|
|
|
|
<address>
|
|
|
|
<p>Please send FSF & GNU inquiries & questions to <a
|
|
href="mailto:gnu@gnu.org">gnu@gnu.org</a>. There are also <a
|
|
href="http://www.gnu.org/home.html#ContactInfo">other ways to
|
|
contact</a> the FSF.</p>
|
|
|
|
<p>These pages are maintained by <a
|
|
href="http://www.gnu.org/software/gdb/">the GDB developers</a>.</p>
|
|
|
|
<p>Copyright Free Software Foundation, Inc., 59 Temple Place - Suite
|
|
330, Boston, MA 02111, USA.</p>
|
|
|
|
<p>Verbatim copying and distribution of this entire article is
|
|
permitted in any medium, provided this notice is preserved.</p>
|
|
|
|
</address>
|
|
|
|
This document was generated
|
|
by <I>GDB Administrator</I> on <I>March, 27 2008</I>
|
|
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
|
|
"><I>texi2html</I></A>
|
|
|
|
</BODY>
|
|
</HTML>
|