motify compile link error

motify compile link error
This commit is contained in:
ant 2016-09-18 09:03:25 +08:00
parent 923914edae
commit 03e74a8e50
5418 changed files with 1367914 additions and 206149 deletions

View file

@ -0,0 +1 @@
<meta http-equiv="refresh" content="0; url=How-Overlays-Work.html#A%20code%20overlay">

View file

@ -0,0 +1,58 @@
<html lang="en">
<head>
<title>AArch64 Features - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Standard-Target-Features.html#Standard-Target-Features" title="Standard Target Features">
<link rel="next" href="ARM-Features.html#ARM-Features" title="ARM Features">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="AArch64-Features"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="ARM-Features.html#ARM-Features">ARM Features</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Standard-Target-Features.html#Standard-Target-Features">Standard Target Features</a>
<hr>
</div>
<h4 class="subsection">G.4.1 AArch64 Features</h4>
<p><a name="index-target-descriptions_002c-AArch64-features-2853"></a>
The &lsquo;<samp><span class="samp">org.gnu.gdb.aarch64.core</span></samp>&rsquo; feature is required for AArch64
targets. It should contain registers &lsquo;<samp><span class="samp">x0</span></samp>&rsquo; through &lsquo;<samp><span class="samp">x30</span></samp>&rsquo;,
&lsquo;<samp><span class="samp">sp</span></samp>&rsquo;, &lsquo;<samp><span class="samp">pc</span></samp>&rsquo;, and &lsquo;<samp><span class="samp">cpsr</span></samp>&rsquo;.
<p>The &lsquo;<samp><span class="samp">org.gnu.gdb.aarch64.fpu</span></samp>&rsquo; feature is optional. If present,
it should contain registers &lsquo;<samp><span class="samp">v0</span></samp>&rsquo; through &lsquo;<samp><span class="samp">v31</span></samp>&rsquo;, &lsquo;<samp><span class="samp">fpsr</span></samp>&rsquo;,
and &lsquo;<samp><span class="samp">fpcr</span></samp>&rsquo;.
</body></html>

View file

@ -0,0 +1,61 @@
<html lang="en">
<head>
<title>AArch64 - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Architectures.html#Architectures" title="Architectures">
<link rel="next" href="i386.html#i386" title="i386">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="AArch64"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="i386.html#i386">i386</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Architectures.html#Architectures">Architectures</a>
<hr>
</div>
<h4 class="subsection">21.4.1 AArch64</h4>
<p><a name="index-AArch64-support-1500"></a>
When <span class="sc">gdb</span> is debugging the AArch64 architecture, it provides the
following special commands:
<dl>
<dt><code>set debug aarch64</code><dd><a name="index-set-debug-aarch64-1501"></a>This command determines whether AArch64 architecture-specific debugging
messages are to be displayed.
<br><dt><code>show debug aarch64</code><dd>Show whether AArch64 debugging messages are displayed.
</dl>
</body></html>

View file

@ -0,0 +1,122 @@
<html lang="en">
<head>
<title>ABI - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Controlling-GDB.html#Controlling-GDB" title="Controlling GDB">
<link rel="prev" href="Numbers.html#Numbers" title="Numbers">
<link rel="next" href="Auto_002dloading.html#Auto_002dloading" title="Auto-loading">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="ABI"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Auto_002dloading.html#Auto_002dloading">Auto-loading</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Numbers.html#Numbers">Numbers</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Controlling-GDB.html#Controlling-GDB">Controlling GDB</a>
<hr>
</div>
<h3 class="section">22.6 Configuring the Current ABI</h3>
<p><span class="sc">gdb</span> can determine the <dfn>ABI</dfn> (Application Binary Interface) of your
application automatically. However, sometimes you need to override its
conclusions. Use these commands to manage <span class="sc">gdb</span>'s view of the
current ABI.
<p><a name="index-OS-ABI-1577"></a><a name="index-set-osabi-1578"></a><a name="index-show-osabi-1579"></a><a name="index-Newlib-OS-ABI-and-its-influence-on-the-longjmp-handling-1580"></a>
One <span class="sc">gdb</span> configuration can debug binaries for multiple operating
system targets, either via remote debugging or native emulation.
<span class="sc">gdb</span> will autodetect the <dfn>OS ABI</dfn> (Operating System ABI) in use,
but you can override its conclusion using the <code>set osabi</code> command.
One example where this is useful is in debugging of binaries which use
an alternate C library (e.g. <span class="sc">uClibc</span> for <span class="sc">gnu</span>/Linux) which does
not have the same identifying marks that the standard C library for your
platform provides.
<p>When <span class="sc">gdb</span> is debugging the AArch64 architecture, it provides a
&ldquo;Newlib&rdquo; OS ABI. This is useful for handling <code>setjmp</code> and
<code>longjmp</code> when debugging binaries that use the <span class="sc">newlib</span> C library.
The &ldquo;Newlib&rdquo; OS ABI can be selected by <code>set osabi Newlib</code>.
<dl>
<dt><code>show osabi</code><dd>Show the OS ABI currently in use.
<br><dt><code>set osabi</code><dd>With no argument, show the list of registered available OS ABI's.
<br><dt><code>set osabi </code><var>abi</var><dd>Set the current OS ABI to <var>abi</var>.
</dl>
<p><a name="index-float-promotion-1581"></a>
Generally, the way that an argument of type <code>float</code> is passed to a
function depends on whether the function is prototyped. For a prototyped
(i.e. ANSI/ISO style) function, <code>float</code> arguments are passed unchanged,
according to the architecture's convention for <code>float</code>. For unprototyped
(i.e. K&amp;R style) functions, <code>float</code> arguments are first promoted to type
<code>double</code> and then passed.
<p>Unfortunately, some forms of debug information do not reliably indicate whether
a function is prototyped. If <span class="sc">gdb</span> calls a function that is not marked
as prototyped, it consults <kbd>set coerce-float-to-double</kbd>.
<a name="index-set-coerce_002dfloat_002dto_002ddouble-1582"></a>
<dl><dt><code>set coerce-float-to-double</code><dt><code>set coerce-float-to-double on</code><dd>Arguments of type <code>float</code> will be promoted to <code>double</code> when passed
to an unprototyped function. This is the default setting.
<br><dt><code>set coerce-float-to-double off</code><dd>Arguments of type <code>float</code> will be passed directly to unprototyped
functions.
<p><a name="index-show-coerce_002dfloat_002dto_002ddouble-1583"></a><br><dt><code>show coerce-float-to-double</code><dd>Show the current setting of promoting <code>float</code> to <code>double</code>.
</dl>
<p><a name="index-set-cp_002dabi-1584"></a><a name="index-show-cp_002dabi-1585"></a><span class="sc">gdb</span> needs to know the ABI used for your program's C<tt>++</tt>
objects. The correct C<tt>++</tt> ABI depends on which C<tt>++</tt> compiler was
used to build your application. <span class="sc">gdb</span> only fully supports
programs with a single C<tt>++</tt> ABI; if your program contains code using
multiple C<tt>++</tt> ABI's or if <span class="sc">gdb</span> can not identify your
program's ABI correctly, you can tell <span class="sc">gdb</span> which ABI to use.
Currently supported ABI's include &ldquo;gnu-v2&rdquo;, for <code>g++</code> versions
before 3.0, &ldquo;gnu-v3&rdquo;, for <code>g++</code> versions 3.0 and later, and
&ldquo;hpaCC&rdquo; for the HP ANSI C<tt>++</tt> compiler. Other C<tt>++</tt> compilers may
use the &ldquo;gnu-v2&rdquo; or &ldquo;gnu-v3&rdquo; ABI's as well. The default setting is
&ldquo;auto&rdquo;.
<dl>
<dt><code>show cp-abi</code><dd>Show the C<tt>++</tt> ABI currently in use.
<br><dt><code>set cp-abi</code><dd>With no argument, show the list of supported C<tt>++</tt> ABI's.
<br><dt><code>set cp-abi </code><var>abi</var><dt><code>set cp-abi auto</code><dd>Set the current C<tt>++</tt> ABI to <var>abi</var>, or return to automatic detection.
</dl>
</body></html>

View file

@ -0,0 +1,59 @@
<html lang="en">
<head>
<title>ARM Breakpoint Kinds - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="ARM_002dSpecific-Protocol-Details.html#ARM_002dSpecific-Protocol-Details" title="ARM-Specific Protocol Details">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="ARM-Breakpoint-Kinds"></a>
Up:&nbsp;<a rel="up" accesskey="u" href="ARM_002dSpecific-Protocol-Details.html#ARM_002dSpecific-Protocol-Details">ARM-Specific Protocol Details</a>
<hr>
</div>
<h5 class="subsubsection">E.5.1.1 <acronym>ARM</acronym> Breakpoint Kinds</h5>
<p><a name="index-breakpoint-kinds_002c-_0040acronym_007bARM_007d-2750"></a>
These breakpoint kinds are defined for the &lsquo;<samp><span class="samp">Z0</span></samp>&rsquo; and &lsquo;<samp><span class="samp">Z1</span></samp>&rsquo; packets.
<dl>
<dt><span class="roman">2</span><dd>16-bit Thumb mode breakpoint.
<br><dt><span class="roman">3</span><dd>32-bit Thumb mode (Thumb-2) breakpoint.
<br><dt><span class="roman">4</span><dd>32-bit <acronym>ARM</acronym> mode breakpoint.
</dl>
</body></html>

View file

@ -0,0 +1,83 @@
<html lang="en">
<head>
<title>ARM Features - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Standard-Target-Features.html#Standard-Target-Features" title="Standard Target Features">
<link rel="prev" href="AArch64-Features.html#AArch64-Features" title="AArch64 Features">
<link rel="next" href="i386-Features.html#i386-Features" title="i386 Features">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="ARM-Features"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="i386-Features.html#i386-Features">i386 Features</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="AArch64-Features.html#AArch64-Features">AArch64 Features</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Standard-Target-Features.html#Standard-Target-Features">Standard Target Features</a>
<hr>
</div>
<h4 class="subsection">G.4.2 ARM Features</h4>
<p><a name="index-target-descriptions_002c-ARM-features-2854"></a>
The &lsquo;<samp><span class="samp">org.gnu.gdb.arm.core</span></samp>&rsquo; feature is required for non-M-profile
ARM targets.
It should contain registers &lsquo;<samp><span class="samp">r0</span></samp>&rsquo; through &lsquo;<samp><span class="samp">r13</span></samp>&rsquo;, &lsquo;<samp><span class="samp">sp</span></samp>&rsquo;,
&lsquo;<samp><span class="samp">lr</span></samp>&rsquo;, &lsquo;<samp><span class="samp">pc</span></samp>&rsquo;, and &lsquo;<samp><span class="samp">cpsr</span></samp>&rsquo;.
<p>For M-profile targets (e.g. Cortex-M3), the &lsquo;<samp><span class="samp">org.gnu.gdb.arm.core</span></samp>&rsquo;
feature is replaced by &lsquo;<samp><span class="samp">org.gnu.gdb.arm.m-profile</span></samp>&rsquo;. It should contain
registers &lsquo;<samp><span class="samp">r0</span></samp>&rsquo; through &lsquo;<samp><span class="samp">r13</span></samp>&rsquo;, &lsquo;<samp><span class="samp">sp</span></samp>&rsquo;, &lsquo;<samp><span class="samp">lr</span></samp>&rsquo;, &lsquo;<samp><span class="samp">pc</span></samp>&rsquo;,
and &lsquo;<samp><span class="samp">xpsr</span></samp>&rsquo;.
<p>The &lsquo;<samp><span class="samp">org.gnu.gdb.arm.fpa</span></samp>&rsquo; feature is optional. If present, it
should contain registers &lsquo;<samp><span class="samp">f0</span></samp>&rsquo; through &lsquo;<samp><span class="samp">f7</span></samp>&rsquo; and &lsquo;<samp><span class="samp">fps</span></samp>&rsquo;.
<p>The &lsquo;<samp><span class="samp">org.gnu.gdb.xscale.iwmmxt</span></samp>&rsquo; feature is optional. If present,
it should contain at least registers &lsquo;<samp><span class="samp">wR0</span></samp>&rsquo; through &lsquo;<samp><span class="samp">wR15</span></samp>&rsquo; and
&lsquo;<samp><span class="samp">wCGR0</span></samp>&rsquo; through &lsquo;<samp><span class="samp">wCGR3</span></samp>&rsquo;. The &lsquo;<samp><span class="samp">wCID</span></samp>&rsquo;, &lsquo;<samp><span class="samp">wCon</span></samp>&rsquo;,
&lsquo;<samp><span class="samp">wCSSF</span></samp>&rsquo;, and &lsquo;<samp><span class="samp">wCASF</span></samp>&rsquo; registers are optional.
<p>The &lsquo;<samp><span class="samp">org.gnu.gdb.arm.vfp</span></samp>&rsquo; feature is optional. If present, it
should contain at least registers &lsquo;<samp><span class="samp">d0</span></samp>&rsquo; through &lsquo;<samp><span class="samp">d15</span></samp>&rsquo;. If
they are present, &lsquo;<samp><span class="samp">d16</span></samp>&rsquo; through &lsquo;<samp><span class="samp">d31</span></samp>&rsquo; should also be included.
<span class="sc">gdb</span> will synthesize the single-precision registers from
halves of the double-precision registers.
<p>The &lsquo;<samp><span class="samp">org.gnu.gdb.arm.neon</span></samp>&rsquo; feature is optional. It does not
need to contain registers; it instructs <span class="sc">gdb</span> to display the
VFP double-precision registers as vectors and to synthesize the
quad-precision registers from pairs of double-precision registers.
If this feature is present, &lsquo;<samp><span class="samp">org.gnu.gdb.arm.vfp</span></samp>&rsquo; must also
be present and include 32 double-precision registers.
</body></html>

View file

@ -0,0 +1,154 @@
<html lang="en">
<head>
<title>ARM - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Embedded-Processors.html#Embedded-Processors" title="Embedded Processors">
<link rel="next" href="M32R_002fD.html#M32R_002fD" title="M32R/D">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="ARM"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="M32R_002fD.html#M32R_002fD">M32R/D</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Embedded-Processors.html#Embedded-Processors">Embedded Processors</a>
<hr>
</div>
<h4 class="subsection">21.3.1 ARM</h4>
<p><a name="index-ARM-RDI-1388"></a>
<a name="index-target-rdi-1389"></a>
<dl><dt><code>target rdi </code><var>dev</var><dd>ARM Angel monitor, via RDI library interface to ADP protocol. You may
use this target to communicate with both boards running the Angel
monitor, or with the EmbeddedICE JTAG debug device.
<p><a name="index-target-rdp-1390"></a><br><dt><code>target rdp </code><var>dev</var><dd>ARM Demon monitor.
</dl>
<p><span class="sc">gdb</span> provides the following ARM-specific commands:
<dl>
<dt><code>set arm disassembler</code><dd><a name="index-set-arm-1391"></a>This commands selects from a list of disassembly styles. The
<code>"std"</code> style is the standard style.
<br><dt><code>show arm disassembler</code><dd><a name="index-show-arm-1392"></a>Show the current disassembly style.
<br><dt><code>set arm apcs32</code><dd><a name="index-ARM-32_002dbit-mode-1393"></a>This command toggles ARM operation mode between 32-bit and 26-bit.
<br><dt><code>show arm apcs32</code><dd>Display the current usage of the ARM 32-bit mode.
<br><dt><code>set arm fpu </code><var>fputype</var><dd>This command sets the ARM floating-point unit (FPU) type. The
argument <var>fputype</var> can be one of these:
<dl>
<dt><code>auto</code><dd>Determine the FPU type by querying the OS ABI.
<br><dt><code>softfpa</code><dd>Software FPU, with mixed-endian doubles on little-endian ARM
processors.
<br><dt><code>fpa</code><dd>GCC-compiled FPA co-processor.
<br><dt><code>softvfp</code><dd>Software FPU with pure-endian doubles.
<br><dt><code>vfp</code><dd>VFP co-processor.
</dl>
<br><dt><code>show arm fpu</code><dd>Show the current type of the FPU.
<br><dt><code>set arm abi</code><dd>This command forces <span class="sc">gdb</span> to use the specified ABI.
<br><dt><code>show arm abi</code><dd>Show the currently used ABI.
<br><dt><code>set arm fallback-mode (arm|thumb|auto)</code><dd><span class="sc">gdb</span> uses the symbol table, when available, to determine
whether instructions are ARM or Thumb. This command controls
<span class="sc">gdb</span>'s default behavior when the symbol table is not
available. The default is &lsquo;<samp><span class="samp">auto</span></samp>&rsquo;, which causes <span class="sc">gdb</span> to
use the current execution mode (from the <code>T</code> bit in the <code>CPSR</code>
register).
<br><dt><code>show arm fallback-mode</code><dd>Show the current fallback instruction mode.
<br><dt><code>set arm force-mode (arm|thumb|auto)</code><dd>This command overrides use of the symbol table to determine whether
instructions are ARM or Thumb. The default is &lsquo;<samp><span class="samp">auto</span></samp>&rsquo;, which
causes <span class="sc">gdb</span> to use the symbol table and then the setting
of &lsquo;<samp><span class="samp">set arm fallback-mode</span></samp>&rsquo;.
<br><dt><code>show arm force-mode</code><dd>Show the current forced instruction mode.
<br><dt><code>set debug arm</code><dd>Toggle whether to display ARM-specific debugging messages from the ARM
target support subsystem.
<br><dt><code>show debug arm</code><dd>Show whether ARM-specific debugging messages are enabled.
</dl>
<p>The following commands are available when an ARM target is debugged
using the RDI interface:
<dl>
<dt><code>rdilogfile </code><span class="roman">[</span><var>file</var><span class="roman">]</span><dd><a name="index-rdilogfile-1394"></a><a name="index-ADP-_0028Angel-Debugger-Protocol_0029-logging-1395"></a>Set the filename for the ADP (Angel Debugger Protocol) packet log.
With an argument, sets the log file to the specified <var>file</var>. With
no argument, show the current log file name. The default log file is
<samp><span class="file">rdi.log</span></samp>.
<br><dt><code>rdilogenable </code><span class="roman">[</span><var>arg</var><span class="roman">]</span><dd><a name="index-rdilogenable-1396"></a>Control logging of ADP packets. With an argument of 1 or <code>"yes"</code>
enables logging, with an argument 0 or <code>"no"</code> disables it. With
no arguments displays the current setting. When logging is enabled,
ADP packets exchanged between <span class="sc">gdb</span> and the RDI target device
are logged to a file.
<br><dt><code>set rdiromatzero</code><dd><a name="index-set-rdiromatzero-1397"></a><a name="index-ROM-at-zero-address_002c-RDI-1398"></a>Tell <span class="sc">gdb</span> whether the target has ROM at address 0. If on,
vector catching is disabled, so that zero address can be used. If off
(the default), vector catching is enabled. For this command to take
effect, it needs to be invoked prior to the <code>target rdi</code> command.
<br><dt><code>show rdiromatzero</code><dd><a name="index-show-rdiromatzero-1399"></a>Show the current setting of ROM at zero address.
<br><dt><code>set rdiheartbeat</code><dd><a name="index-set-rdiheartbeat-1400"></a><a name="index-RDI-heartbeat-1401"></a>Enable or disable RDI heartbeat packets. It is not recommended to
turn on this option, since it confuses ARM and EPI JTAG interface, as
well as the Angel monitor.
<br><dt><code>show rdiheartbeat</code><dd><a name="index-show-rdiheartbeat-1402"></a>Show the setting of RDI heartbeat packets.
</dl>
<dl>
<dt><code>target sim </code><span class="roman">[</span><var>simargs</var><span class="roman">]</span><code> ...</code><dd>The <span class="sc">gdb</span> ARM simulator accepts the following optional arguments.
<dl>
<dt><code>--swi-support=</code><var>type</var><dd>Tell the simulator which SWI interfaces to support.
<var>type</var> may be a comma separated list of the following values.
The default value is <code>all</code>.
<dl>
<dt><code>none</code><br><dt><code>demon</code><br><dt><code>angel</code><br><dt><code>redboot</code><br><dt><code>all</code><dd></dl>
</dl>
</dl>
</body></html>

View file

@ -0,0 +1,54 @@
<html lang="en">
<head>
<title>ARM-Specific Protocol Details - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Architecture_002dSpecific-Protocol-Details.html#Architecture_002dSpecific-Protocol-Details" title="Architecture-Specific Protocol Details">
<link rel="next" href="MIPS_002dSpecific-Protocol-Details.html#MIPS_002dSpecific-Protocol-Details" title="MIPS-Specific Protocol Details">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="ARM-Specific-Protocol-Details"></a>
<a name="ARM_002dSpecific-Protocol-Details"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="MIPS_002dSpecific-Protocol-Details.html#MIPS_002dSpecific-Protocol-Details">MIPS-Specific Protocol Details</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Architecture_002dSpecific-Protocol-Details.html#Architecture_002dSpecific-Protocol-Details">Architecture-Specific Protocol Details</a>
<hr>
</div>
<h4 class="subsection">E.5.1 <acronym>ARM</acronym>-specific Protocol Details</h4>
<ul class="menu">
<li><a accesskey="1" href="ARM-Breakpoint-Kinds.html#ARM-Breakpoint-Kinds">ARM Breakpoint Kinds</a>
</ul>
</body></html>

View file

@ -0,0 +1,60 @@
<html lang="en">
<head>
<title>AVR - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Embedded-Processors.html#Embedded-Processors" title="Embedded Processors">
<link rel="prev" href="Z8000.html#Z8000" title="Z8000">
<link rel="next" href="CRIS.html#CRIS" title="CRIS">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="AVR"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="CRIS.html#CRIS">CRIS</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Z8000.html#Z8000">Z8000</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Embedded-Processors.html#Embedded-Processors">Embedded Processors</a>
<hr>
</div>
<h4 class="subsection">21.3.12 Atmel AVR</h4>
<p><a name="index-AVR-1490"></a>
When configured for debugging the Atmel AVR, <span class="sc">gdb</span> supports the
following AVR-specific commands:
<dl>
<dt><code>info io_registers</code><dd><a name="index-info-io_005fregisters_0040r_007b_002c-AVR_007d-1491"></a><a name="index-I_002fO-registers-_0028Atmel-AVR_0029-1492"></a>This command displays information about the AVR I/O registers. For
each register, <span class="sc">gdb</span> prints its number and value.
</dl>
</body></html>

View file

@ -0,0 +1,65 @@
<html lang="en">
<head>
<title>Active Targets - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Targets.html#Targets" title="Targets">
<link rel="next" href="Target-Commands.html#Target-Commands" title="Target Commands">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Active-Targets"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Target-Commands.html#Target-Commands">Target Commands</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Targets.html#Targets">Targets</a>
<hr>
</div>
<h3 class="section">19.1 Active Targets</h3>
<p><a name="index-stacking-targets-1133"></a><a name="index-active-targets-1134"></a><a name="index-multiple-targets-1135"></a>
There are multiple classes of targets such as: processes, executable files or
recording sessions. Core files belong to the process class, making core file
and process mutually exclusive. Otherwise, <span class="sc">gdb</span> can work concurrently
on multiple active targets, one in each class. This allows you to (for
example) start a process and inspect its activity, while still having access to
the executable file after the process finishes. Or if you start process
recording (see <a href="Reverse-Execution.html#Reverse-Execution">Reverse Execution</a>) and <code>reverse-step</code> there, you are
presented a virtual layer of the recording target, while the process target
remains stopped at the chronologically last point of the process execution.
<p>Use the <code>core-file</code> and <code>exec-file</code> commands to select a new core
file or executable target (see <a href="Files.html#Files">Commands to Specify Files</a>). To
specify as a target a process that is already running, use the <code>attach</code>
command (see <a href="Attach.html#Attach">Debugging an Already-running Process</a>).
</body></html>

View file

@ -0,0 +1,106 @@
<html lang="en">
<head>
<title>Ada Glitches - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Ada.html#Ada" title="Ada">
<link rel="prev" href="Ravenscar-Profile.html#Ravenscar-Profile" title="Ravenscar Profile">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Ada-Glitches"></a>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Ravenscar-Profile.html#Ravenscar-Profile">Ravenscar Profile</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Ada.html#Ada">Ada</a>
<hr>
</div>
<h5 class="subsubsection">15.4.9.8 Known Peculiarities of Ada Mode</h5>
<p><a name="index-Ada_002c-problems-964"></a>
Besides the omissions listed previously (see <a href="Omissions-from-Ada.html#Omissions-from-Ada">Omissions from Ada</a>),
we know of several problems with and limitations of Ada mode in
<span class="sc">gdb</span>,
some of which will be fixed with planned future releases of the debugger
and the GNU Ada compiler.
<ul>
<li>Static constants that the compiler chooses not to materialize as objects in
storage are invisible to the debugger.
<li>Named parameter associations in function argument lists are ignored (the
argument lists are treated as positional).
<li>Many useful library packages are currently invisible to the debugger.
<li>Fixed-point arithmetic, conversions, input, and output is carried out using
floating-point arithmetic, and may give results that only approximate those on
the host machine.
<li>The GNAT compiler never generates the prefix <code>Standard</code> for any of
the standard symbols defined by the Ada language. <span class="sc">gdb</span> knows about
this: it will strip the prefix from names when you use it, and will never
look for a name you have so qualified among local symbols, nor match against
symbols in other packages or subprograms. If you have
defined entities anywhere in your program other than parameters and
local variables whose simple names match names in <code>Standard</code>,
GNAT's lack of qualification here can cause confusion. When this happens,
you can usually resolve the confusion
by qualifying the problematic names with package
<code>Standard</code> explicitly.
</ul>
<p>Older versions of the compiler sometimes generate erroneous debugging
information, resulting in the debugger incorrectly printing the value
of affected entities. In some cases, the debugger is able to work
around an issue automatically. In other cases, the debugger is able
to work around the issue, but the work-around has to be specifically
enabled.
<p><a name="index-set-ada-trust_002dPAD_002dover_002dXVS-965"></a><a name="index-show-ada-trust_002dPAD_002dover_002dXVS-966"></a>
<dl>
<dt><code>set ada trust-PAD-over-XVS on</code><dd>Configure GDB to strictly follow the GNAT encoding when computing the
value of Ada entities, particularly when <code>PAD</code> and <code>PAD___XVS</code>
types are involved (see <code>ada/exp_dbug.ads</code> in the GCC sources for
a complete description of the encoding used by the GNAT compiler).
This is the default.
<br><dt><code>set ada trust-PAD-over-XVS off</code><dd>This is related to the encoding using by the GNAT compiler. If <span class="sc">gdb</span>
sometimes prints the wrong value for certain entities, changing <code>ada
trust-PAD-over-XVS</code> to <code>off</code> activates a work-around which may fix
the issue. It is always safe to set <code>ada trust-PAD-over-XVS</code> to
<code>off</code>, but this incurs a slight performance penalty, so it is
recommended to leave this setting to <code>on</code> unless necessary.
</dl>
</body></html>

View file

@ -0,0 +1,88 @@
<html lang="en">
<head>
<title>Ada Mode Intro - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Ada.html#Ada" title="Ada">
<link rel="next" href="Omissions-from-Ada.html#Omissions-from-Ada" title="Omissions from Ada">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Ada-Mode-Intro"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Omissions-from-Ada.html#Omissions-from-Ada">Omissions from Ada</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Ada.html#Ada">Ada</a>
<hr>
</div>
<h5 class="subsubsection">15.4.9.1 Introduction</h5>
<p><a name="index-Ada-mode_002c-general-941"></a>
The Ada mode of <span class="sc">gdb</span> supports a fairly large subset of Ada expression
syntax, with some extensions.
The philosophy behind the design of this subset is
<ul>
<li>That <span class="sc">gdb</span> should provide basic literals and access to operations for
arithmetic, dereferencing, field selection, indexing, and subprogram calls,
leaving more sophisticated computations to subprograms written into the
program (which therefore may be called from <span class="sc">gdb</span>).
<li>That type safety and strict adherence to Ada language restrictions
are not particularly important to the <span class="sc">gdb</span> user.
<li>That brevity is important to the <span class="sc">gdb</span> user.
</ul>
<p>Thus, for brevity, the debugger acts as if all names declared in
user-written packages are directly visible, even if they are not visible
according to Ada rules, thus making it unnecessary to fully qualify most
names with their packages, regardless of context. Where this causes
ambiguity, <span class="sc">gdb</span> asks the user's intent.
<p>The debugger will start in Ada mode if it detects an Ada main program.
As for other languages, it will enter Ada mode when stopped in a program that
was translated from an Ada source file.
<p>While in Ada mode, you may use `<tt>&ndash;</tt>' for comments. This is useful
mostly for documenting command files. The standard <span class="sc">gdb</span> comment
(&lsquo;<samp><span class="samp">#</span></samp>&rsquo;) still works at the beginning of a line in Ada mode, but not in the
middle (to allow based literals).
<p>The debugger supports limited overloading. Given a subprogram call in which
the function symbol has multiple definitions, it will use the number of
actual parameters and some information about their types to attempt to narrow
the set of definitions. It also makes very limited use of context, preferring
procedures to functions in the context of the <code>call</code> command, and
functions to procedures elsewhere.
</body></html>

View file

@ -0,0 +1,66 @@
<html lang="en">
<head>
<title>Ada Tasks and Core Files - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Ada.html#Ada" title="Ada">
<link rel="prev" href="Ada-Tasks.html#Ada-Tasks" title="Ada Tasks">
<link rel="next" href="Ravenscar-Profile.html#Ravenscar-Profile" title="Ravenscar Profile">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Ada-Tasks-and-Core-Files"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Ravenscar-Profile.html#Ravenscar-Profile">Ravenscar Profile</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Ada-Tasks.html#Ada-Tasks">Ada Tasks</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Ada.html#Ada">Ada</a>
<hr>
</div>
<h5 class="subsubsection">15.4.9.6 Tasking Support when Debugging Core Files</h5>
<p><a name="index-Ada-tasking-and-core-file-debugging-958"></a>
When inspecting a core file, as opposed to debugging a live program,
tasking support may be limited or even unavailable, depending on
the platform being used.
For instance, on x86-linux, the list of tasks is available, but task
switching is not supported. On Tru64, however, task switching will work
as usual.
<p>On certain platforms, including Tru64, the debugger needs to perform some
memory writes in order to provide Ada tasking support. When inspecting
a core file, this means that the core file must be opened with read-write
privileges, using the command &lsquo;<samp><span class="samp">"set write on"</span></samp>&rsquo; (see <a href="Patching.html#Patching">Patching</a>).
Under these circumstances, you should make a backup copy of the core
file before inspecting it with <span class="sc">gdb</span>.
</body></html>

View file

@ -0,0 +1,204 @@
<html lang="en">
<head>
<title>Ada Tasks - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Ada.html#Ada" title="Ada">
<link rel="prev" href="Stopping-Before-Main-Program.html#Stopping-Before-Main-Program" title="Stopping Before Main Program">
<link rel="next" href="Ada-Tasks-and-Core-Files.html#Ada-Tasks-and-Core-Files" title="Ada Tasks and Core Files">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Ada-Tasks"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Ada-Tasks-and-Core-Files.html#Ada-Tasks-and-Core-Files">Ada Tasks and Core Files</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Stopping-Before-Main-Program.html#Stopping-Before-Main-Program">Stopping Before Main Program</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Ada.html#Ada">Ada</a>
<hr>
</div>
<h5 class="subsubsection">15.4.9.5 Extensions for Ada Tasks</h5>
<p><a name="index-Ada_002c-tasking-949"></a>
Support for Ada tasks is analogous to that for threads (see <a href="Threads.html#Threads">Threads</a>).
<span class="sc">gdb</span> provides the following task-related commands:
<a name="index-info-tasks-950"></a>
<dl><dt><code>info tasks</code><dd>This command shows a list of current Ada tasks, as in the following example:
<pre class="smallexample"> (gdb) info tasks
ID TID P-ID Pri State Name
1 8088000 0 15 Child Activation Wait main_task
2 80a4000 1 15 Accept Statement b
3 809a800 1 15 Child Activation Wait a
* 4 80ae800 3 15 Runnable c
</pre>
<p class="noindent">In this listing, the asterisk before the last task indicates it to be the
task currently being inspected.
<dl>
<dt>ID<dd>Represents <span class="sc">gdb</span>'s internal task number.
<br><dt>TID<dd>The Ada task ID.
<br><dt>P-ID<dd>The parent's task ID (<span class="sc">gdb</span>'s internal task number).
<br><dt>Pri<dd>The base priority of the task.
<br><dt>State<dd>Current state of the task.
<dl>
<dt><code>Unactivated</code><dd>The task has been created but has not been activated. It cannot be
executing.
<br><dt><code>Runnable</code><dd>The task is not blocked for any reason known to Ada. (It may be waiting
for a mutex, though.) It is conceptually "executing" in normal mode.
<br><dt><code>Terminated</code><dd>The task is terminated, in the sense of ARM 9.3 (5). Any dependents
that were waiting on terminate alternatives have been awakened and have
terminated themselves.
<br><dt><code>Child Activation Wait</code><dd>The task is waiting for created tasks to complete activation.
<br><dt><code>Accept Statement</code><dd>The task is waiting on an accept or selective wait statement.
<br><dt><code>Waiting on entry call</code><dd>The task is waiting on an entry call.
<br><dt><code>Async Select Wait</code><dd>The task is waiting to start the abortable part of an asynchronous
select statement.
<br><dt><code>Delay Sleep</code><dd>The task is waiting on a select statement with only a delay
alternative open.
<br><dt><code>Child Termination Wait</code><dd>The task is sleeping having completed a master within itself, and is
waiting for the tasks dependent on that master to become terminated or
waiting on a terminate Phase.
<br><dt><code>Wait Child in Term Alt</code><dd>The task is sleeping waiting for tasks on terminate alternatives to
finish terminating.
<br><dt><code>Accepting RV with </code><var>taskno</var><dd>The task is accepting a rendez-vous with the task <var>taskno</var>.
</dl>
<br><dt>Name<dd>Name of the task in the program.
</dl>
<p><a name="index-info-task-_0040var_007btaskno_007d-951"></a><br><dt><code>info task </code><var>taskno</var><dd>This command shows detailled informations on the specified task, as in
the following example:
<pre class="smallexample"> (gdb) info tasks
ID TID P-ID Pri State Name
1 8077880 0 15 Child Activation Wait main_task
* 2 807c468 1 15 Runnable task_1
(gdb) info task 2
Ada Task: 0x807c468
Name: task_1
Thread: 0x807f378
Parent: 1 (main_task)
Base Priority: 15
State: Runnable
</pre>
<br><dt><code>task</code><dd><a name="index-task_0040r_007b-_0028Ada_0029_007d-952"></a><a name="index-current-Ada-task-ID-953"></a>This command prints the ID of the current task.
<pre class="smallexample"> (gdb) info tasks
ID TID P-ID Pri State Name
1 8077870 0 15 Child Activation Wait main_task
* 2 807c458 1 15 Runnable t
(gdb) task
[Current task is 2]
</pre>
<br><dt><code>task </code><var>taskno</var><dd><a name="index-Ada-task-switching-954"></a>This command is like the <code>thread </code><var>threadno</var>
command (see <a href="Threads.html#Threads">Threads</a>). It switches the context of debugging
from the current task to the given task.
<pre class="smallexample"> (gdb) info tasks
ID TID P-ID Pri State Name
1 8077870 0 15 Child Activation Wait main_task
* 2 807c458 1 15 Runnable t
(gdb) task 1
[Switching to task 1]
#0 0x8067726 in pthread_cond_wait ()
(gdb) bt
#0 0x8067726 in pthread_cond_wait ()
#1 0x8056714 in system.os_interface.pthread_cond_wait ()
#2 0x805cb63 in system.task_primitives.operations.sleep ()
#3 0x806153e in system.tasking.stages.activate_tasks ()
#4 0x804aacc in un () at un.adb:5
</pre>
<br><dt><code>break </code><var>linespec</var><code> task </code><var>taskno</var><dt><code>break </code><var>linespec</var><code> task </code><var>taskno</var><code> if ...</code><dd><a name="index-breakpoints-and-tasks_002c-in-Ada-955"></a><a name="index-task-breakpoints_002c-in-Ada-956"></a><a name="index-break-_0040dots_007b_007d-task-_0040var_007btaskno_007d_0040r_007b-_0028Ada_0029_007d-957"></a>These commands are like the <code>break ... thread ...</code>
command (see <a href="Thread-Stops.html#Thread-Stops">Thread Stops</a>).
<var>linespec</var> specifies source lines, as described
in <a href="Specify-Location.html#Specify-Location">Specify Location</a>.
<p>Use the qualifier &lsquo;<samp><span class="samp">task </span><var>taskno</var></samp>&rsquo; with a breakpoint command
to specify that you only want <span class="sc">gdb</span> to stop the program when a
particular Ada task reaches this breakpoint. <var>taskno</var> is one of the
numeric task identifiers assigned by <span class="sc">gdb</span>, shown in the first
column of the &lsquo;<samp><span class="samp">info tasks</span></samp>&rsquo; display.
<p>If you do not specify &lsquo;<samp><span class="samp">task </span><var>taskno</var></samp>&rsquo; when you set a
breakpoint, the breakpoint applies to <em>all</em> tasks of your
program.
<p>You can use the <code>task</code> qualifier on conditional breakpoints as
well; in this case, place &lsquo;<samp><span class="samp">task </span><var>taskno</var></samp>&rsquo; before the
breakpoint condition (before the <code>if</code>).
<p>For example,
<pre class="smallexample"> (gdb) info tasks
ID TID P-ID Pri State Name
1 140022020 0 15 Child Activation Wait main_task
2 140045060 1 15 Accept/Select Wait t2
3 140044840 1 15 Runnable t1
* 4 140056040 1 15 Runnable t3
(gdb) b 15 task 2
Breakpoint 5 at 0x120044cb0: file test_task_debug.adb, line 15.
(gdb) cont
Continuing.
task # 1 running
task # 2 running
Breakpoint 5, test_task_debug () at test_task_debug.adb:15
15 flush;
(gdb) info tasks
ID TID P-ID Pri State Name
1 140022020 0 15 Child Activation Wait main_task
* 2 140045060 1 15 Runnable t2
3 140044840 1 15 Runnable t1
4 140056040 1 15 Delay Sleep t3
</pre>
</dl>
</body></html>

View file

@ -0,0 +1,72 @@
<html lang="en">
<head>
<title>Ada - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Supported-Languages.html#Supported-Languages" title="Supported Languages">
<link rel="prev" href="Modula_002d2.html#Modula_002d2" title="Modula-2">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Ada"></a>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Modula_002d2.html#Modula_002d2">Modula-2</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Supported-Languages.html#Supported-Languages">Supported Languages</a>
<hr>
</div>
<h4 class="subsection">15.4.9 Ada</h4>
<p><a name="index-Ada-939"></a>
The extensions made to <span class="sc">gdb</span> for Ada only support
output from the <span class="sc">gnu</span> Ada (GNAT) compiler.
Other Ada compilers are not currently supported, and
attempting to debug executables produced by them is most likely
to be difficult.
<p><a name="index-expressions-in-Ada-940"></a>
<ul class="menu">
<li><a accesskey="1" href="Ada-Mode-Intro.html#Ada-Mode-Intro">Ada Mode Intro</a>: General remarks on the Ada syntax
and semantics supported by Ada mode
in <span class="sc">gdb</span>.
<li><a accesskey="2" href="Omissions-from-Ada.html#Omissions-from-Ada">Omissions from Ada</a>: Restrictions on the Ada expression syntax.
<li><a accesskey="3" href="Additions-to-Ada.html#Additions-to-Ada">Additions to Ada</a>: Extensions of the Ada expression syntax.
<li><a accesskey="4" href="Stopping-Before-Main-Program.html#Stopping-Before-Main-Program">Stopping Before Main Program</a>: Debugging the program during elaboration.
<li><a accesskey="5" href="Ada-Tasks.html#Ada-Tasks">Ada Tasks</a>: Listing and setting breakpoints in tasks.
<li><a accesskey="6" href="Ada-Tasks-and-Core-Files.html#Ada-Tasks-and-Core-Files">Ada Tasks and Core Files</a>: Tasking Support when Debugging Core Files
<li><a accesskey="7" href="Ravenscar-Profile.html#Ravenscar-Profile">Ravenscar Profile</a>: Tasking Support when using the Ravenscar
Profile
<li><a accesskey="8" href="Ada-Glitches.html#Ada-Glitches">Ada Glitches</a>: Known peculiarities of Ada mode.
</ul>
</body></html>

View file

@ -0,0 +1,144 @@
<html lang="en">
<head>
<title>Additions to Ada - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Ada.html#Ada" title="Ada">
<link rel="prev" href="Omissions-from-Ada.html#Omissions-from-Ada" title="Omissions from Ada">
<link rel="next" href="Stopping-Before-Main-Program.html#Stopping-Before-Main-Program" title="Stopping Before Main Program">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Additions-to-Ada"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Stopping-Before-Main-Program.html#Stopping-Before-Main-Program">Stopping Before Main Program</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Omissions-from-Ada.html#Omissions-from-Ada">Omissions from Ada</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Ada.html#Ada">Ada</a>
<hr>
</div>
<h5 class="subsubsection">15.4.9.3 Additions to Ada</h5>
<p><a name="index-Ada_002c-deviations-from-946"></a>
As it does for other languages, <span class="sc">gdb</span> makes certain generic
extensions to Ada (see <a href="Expressions.html#Expressions">Expressions</a>):
<ul>
<li>If the expression <var>E</var> is a variable residing in memory (typically
a local variable or array element) and <var>N</var> is a positive integer,
then <var>E</var><code>@</code><var>N</var> displays the values of <var>E</var> and the
<var>N</var>-1 adjacent variables following it in memory as an array. In
Ada, this operator is generally not necessary, since its prime use is
in displaying parts of an array, and slicing will usually do this in
Ada. However, there are occasional uses when debugging programs in
which certain debugging information has been optimized away.
<li><var>B</var><code>::</code><var>var</var> means &ldquo;the variable named <var>var</var> that
appears in function or file <var>B</var>.&rdquo; When <var>B</var> is a file name,
you must typically surround it in single quotes.
<li>The expression <code>{</code><var>type</var><code>} </code><var>addr</var> means &ldquo;the variable of type
<var>type</var> that appears at address <var>addr</var>.&rdquo;
<li>A name starting with &lsquo;<samp><span class="samp">$</span></samp>&rsquo; is a convenience variable
(see <a href="Convenience-Vars.html#Convenience-Vars">Convenience Vars</a>) or a machine register (see <a href="Registers.html#Registers">Registers</a>).
</ul>
<p>In addition, <span class="sc">gdb</span> provides a few other shortcuts and outright
additions specific to Ada:
<ul>
<li>The assignment statement is allowed as an expression, returning
its right-hand operand as its value. Thus, you may enter
<pre class="smallexample"> (gdb) set x := y + 3
(gdb) print A(tmp := y + 1)
</pre>
<li>The semicolon is allowed as an &ldquo;operator,&rdquo; returning as its value
the value of its right-hand operand.
This allows, for example,
complex conditional breaks:
<pre class="smallexample"> (gdb) break f
(gdb) condition 1 (report(i); k += 1; A(k) &gt; 100)
</pre>
<li>Rather than use catenation and symbolic character names to introduce special
characters into strings, one may instead use a special bracket notation,
which is also used to print strings. A sequence of characters of the form
&lsquo;<samp><span class="samp">["</span><var>XX</var><span class="samp">"]</span></samp>&rsquo; within a string or character literal denotes the
(single) character whose numeric encoding is <var>XX</var> in hexadecimal. The
sequence of characters &lsquo;<samp><span class="samp">["""]</span></samp>&rsquo; also denotes a single quotation mark
in strings. For example,
<pre class="smallexample"> "One line.["0a"]Next line.["0a"]"
</pre>
<p class="noindent">contains an ASCII newline character (<code>Ada.Characters.Latin_1.LF</code>)
after each period.
<li>The subtype used as a prefix for the attributes <tt>'Pos</tt>, <tt>'Min</tt>, and
<tt>'Max</tt> is optional (and is ignored in any case). For example, it is valid
to write
<pre class="smallexample"> (gdb) print 'max(x, y)
</pre>
<li>When printing arrays, <span class="sc">gdb</span> uses positional notation when the
array has a lower bound of 1, and uses a modified named notation otherwise.
For example, a one-dimensional array of three integers with a lower bound
of 3 might print as
<pre class="smallexample"> (3 =&gt; 10, 17, 1)
</pre>
<p class="noindent">That is, in contrast to valid Ada, only the first component has a <code>=&gt;</code>
clause.
<li>You may abbreviate attributes in expressions with any unique,
multi-character subsequence of
their names (an exact match gets preference).
For example, you may use <tt>a'len</tt>, <tt>a'gth</tt>, or <tt>a'lh</tt>
in place of <tt>a'length</tt>.
<li><a name="index-quoting-Ada-internal-identifiers-947"></a>Since Ada is case-insensitive, the debugger normally maps identifiers you type
to lower case. The GNAT compiler uses upper-case characters for
some of its internal identifiers, which are normally of no interest to users.
For the rare occasions when you actually have to look at them,
enclose them in angle brackets to avoid the lower-case mapping.
For example,
<pre class="smallexample"> (gdb) print &lt;JMPBUF_SAVE&gt;[0]
</pre>
<li>Printing an object of class-wide type or dereferencing an
access-to-class-wide value will display all the components of the object's
specific type (as indicated by its run-time tag). Likewise, component
selection on such a value will operate on the specific type of the
object.
</ul>
</body></html>

View file

@ -0,0 +1,98 @@
<html lang="en">
<head>
<title>Agent Expressions - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="Remote-Protocol.html#Remote-Protocol" title="Remote Protocol">
<link rel="next" href="Target-Descriptions.html#Target-Descriptions" title="Target Descriptions">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Agent-Expressions"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Target-Descriptions.html#Target-Descriptions">Target Descriptions</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Remote-Protocol.html#Remote-Protocol">Remote Protocol</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>
<h2 class="appendix">Appendix F The GDB Agent Expression Mechanism</h2>
<p>In some applications, it is not feasible for the debugger to interrupt
the program's execution long enough for the developer to learn anything
helpful about its behavior. If the program's correctness depends on its
real-time behavior, delays introduced by a debugger might cause the
program to fail, even when the code itself is correct. It is useful to
be able to observe the program's behavior without interrupting it.
<p>Using GDB's <code>trace</code> and <code>collect</code> commands, the user can
specify locations in the program, and arbitrary expressions to evaluate
when those locations are reached. Later, using the <code>tfind</code>
command, she can examine the values those expressions had when the
program hit the trace points. The expressions may also denote objects
in memory &mdash; structures or arrays, for example &mdash; whose values GDB
should record; while visiting a particular tracepoint, the user may
inspect those objects as if they were in memory at that moment.
However, because GDB records these values without interacting with the
user, it can do so quickly and unobtrusively, hopefully not disturbing
the program's behavior.
<p>When GDB is debugging a remote target, the GDB <dfn>agent</dfn> code running
on the target computes the values of the expressions itself. To avoid
having a full symbolic expression evaluator on the agent, GDB translates
expressions in the source language into a simpler bytecode language, and
then sends the bytecode to the agent; the agent then executes the
bytecode, and records the values for GDB to retrieve later.
<p>The bytecode language is simple; there are forty-odd opcodes, the bulk
of which are the usual vocabulary of C operands (addition, subtraction,
shifts, and so on) and various sizes of literals and memory reference
operations. The bytecode interpreter operates strictly on machine-level
values &mdash; various sizes of integers and floating point numbers &mdash; and
requires no information about types or symbols; thus, the interpreter's
internal data structures are simple, and each bytecode requires only a
few native machine instructions to implement it. The interpreter is
small, and strict limits on the memory and time required to evaluate an
expression are easy to determine, making it suitable for use by the
debugging agent in real-time applications.
<ul class="menu">
<li><a accesskey="1" href="General-Bytecode-Design.html#General-Bytecode-Design">General Bytecode Design</a>: Overview of the interpreter.
<li><a accesskey="2" href="Bytecode-Descriptions.html#Bytecode-Descriptions">Bytecode Descriptions</a>: What each one does.
<li><a accesskey="3" href="Using-Agent-Expressions.html#Using-Agent-Expressions">Using Agent Expressions</a>: How agent expressions fit into the big picture.
<li><a accesskey="4" href="Varying-Target-Capabilities.html#Varying-Target-Capabilities">Varying Target Capabilities</a>: How to discover what the target can do.
<li><a accesskey="5" href="Rationale.html#Rationale">Rationale</a>: Why we did it this way.
</ul>
<!-- @node Rationale -->
<!-- @section Rationale -->
</body></html>

View file

@ -0,0 +1,125 @@
<html lang="en">
<head>
<title>Aliases - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Extending-GDB.html#Extending-GDB" title="Extending GDB">
<link rel="prev" href="Python.html#Python" title="Python">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Aliases"></a>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Python.html#Python">Python</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Extending-GDB.html#Extending-GDB">Extending GDB</a>
<hr>
</div>
<h3 class="section">23.3 Creating new spellings of existing commands</h3>
<p><a name="index-aliases-for-commands-2180"></a>
It is often useful to define alternate spellings of existing commands.
For example, if a new <span class="sc">gdb</span> command defined in Python has
a long name to type, it is handy to have an abbreviated version of it
that involves less typing.
<p><span class="sc">gdb</span> itself uses aliases. For example &lsquo;<samp><span class="samp">s</span></samp>&rsquo; is an alias
of the &lsquo;<samp><span class="samp">step</span></samp>&rsquo; command even though it is otherwise an ambiguous
abbreviation of other commands like &lsquo;<samp><span class="samp">set</span></samp>&rsquo; and &lsquo;<samp><span class="samp">show</span></samp>&rsquo;.
<p>Aliases are also used to provide shortened or more common versions
of multi-word commands. For example, <span class="sc">gdb</span> provides the
&lsquo;<samp><span class="samp">tty</span></samp>&rsquo; alias of the &lsquo;<samp><span class="samp">set inferior-tty</span></samp>&rsquo; command.
<p>You can define a new alias with the &lsquo;<samp><span class="samp">alias</span></samp>&rsquo; command.
<a name="index-alias-2181"></a>
<dl><dt><code>alias [-a] [--] </code><var>ALIAS</var><code> = </code><var>COMMAND</var><dd>
</dl>
<p><var>ALIAS</var> specifies the name of the new alias.
Each word of <var>ALIAS</var> must consist of letters, numbers, dashes and
underscores.
<p><var>COMMAND</var> specifies the name of an existing command
that is being aliased.
<p>The &lsquo;<samp><span class="samp">-a</span></samp>&rsquo; option specifies that the new alias is an abbreviation
of the command. Abbreviations are not shown in command
lists displayed by the &lsquo;<samp><span class="samp">help</span></samp>&rsquo; command.
<p>The &lsquo;<samp><span class="samp">--</span></samp>&rsquo; option specifies the end of options,
and is useful when <var>ALIAS</var> begins with a dash.
<p>Here is a simple example showing how to make an abbreviation
of a command so that there is less to type.
Suppose you were tired of typing &lsquo;<samp><span class="samp">disas</span></samp>&rsquo;, the current
shortest unambiguous abbreviation of the &lsquo;<samp><span class="samp">disassemble</span></samp>&rsquo; command
and you wanted an even shorter version named &lsquo;<samp><span class="samp">di</span></samp>&rsquo;.
The following will accomplish this.
<pre class="smallexample"> (gdb) alias -a di = disas
</pre>
<p>Note that aliases are different from user-defined commands.
With a user-defined command, you also need to write documentation
for it with the &lsquo;<samp><span class="samp">document</span></samp>&rsquo; command.
An alias automatically picks up the documentation of the existing command.
<p>Here is an example where we make &lsquo;<samp><span class="samp">elms</span></samp>&rsquo; an abbreviation of
&lsquo;<samp><span class="samp">elements</span></samp>&rsquo; in the &lsquo;<samp><span class="samp">set print elements</span></samp>&rsquo; command.
This is to show that you can make an abbreviation of any part
of a command.
<pre class="smallexample"> (gdb) alias -a set print elms = set print elements
(gdb) alias -a show print elms = show print elements
(gdb) set p elms 20
(gdb) show p elms
Limit on string chars or array elements to print is 200.
</pre>
<p>Note that if you are defining an alias of a &lsquo;<samp><span class="samp">set</span></samp>&rsquo; command,
and you want to have an alias for the corresponding &lsquo;<samp><span class="samp">show</span></samp>&rsquo;
command, then you need to define the latter separately.
<p>Unambiguously abbreviated commands are allowed in <var>COMMAND</var> and
<var>ALIAS</var>, just as they are normally.
<pre class="smallexample"> (gdb) alias -a set pr elms = set p ele
</pre>
<p>Finally, here is an example showing the creation of a one word
alias for a more complex command.
This creates alias &lsquo;<samp><span class="samp">spe</span></samp>&rsquo; of the command &lsquo;<samp><span class="samp">set print elements</span></samp>&rsquo;.
<pre class="smallexample"> (gdb) alias spe = set print elements
(gdb) spe 20
</pre>
</body></html>

View file

@ -0,0 +1,127 @@
<html lang="en">
<head>
<title>All-Stop Mode - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Thread-Stops.html#Thread-Stops" title="Thread Stops">
<link rel="next" href="Non_002dStop-Mode.html#Non_002dStop-Mode" title="Non-Stop Mode">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="All-Stop-Mode"></a>
<a name="All_002dStop-Mode"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Non_002dStop-Mode.html#Non_002dStop-Mode">Non-Stop Mode</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Thread-Stops.html#Thread-Stops">Thread Stops</a>
<hr>
</div>
<h4 class="subsection">5.5.1 All-Stop Mode</h4>
<p><a name="index-all_002dstop-mode-344"></a>
In all-stop mode, whenever your program stops under <span class="sc">gdb</span> for any reason,
<em>all</em> threads of execution stop, not just the current thread. This
allows you to examine the overall state of the program, including
switching between threads, without worrying that things may change
underfoot.
<p>Conversely, whenever you restart the program, <em>all</em> threads start
executing. <em>This is true even when single-stepping</em> with commands
like <code>step</code> or <code>next</code>.
<p>In particular, <span class="sc">gdb</span> cannot single-step all threads in lockstep.
Since thread scheduling is up to your debugging target's operating
system (not controlled by <span class="sc">gdb</span>), other threads may
execute more than one statement while the current thread completes a
single step. Moreover, in general other threads stop in the middle of a
statement, rather than at a clean statement boundary, when the program
stops.
<p>You might even find your program stopped in another thread after
continuing or even single-stepping. This happens whenever some other
thread runs into a breakpoint, a signal, or an exception before the
first thread completes whatever you requested.
<p><a name="index-automatic-thread-selection-345"></a><a name="index-switching-threads-automatically-346"></a><a name="index-threads_002c-automatic-switching-347"></a>Whenever <span class="sc">gdb</span> stops your program, due to a breakpoint or a
signal, it automatically selects the thread where that breakpoint or
signal happened. <span class="sc">gdb</span> alerts you to the context switch with a
message such as &lsquo;<samp><span class="samp">[Switching to Thread </span><var>n</var><span class="samp">]</span></samp>&rsquo; to identify the
thread.
<p>On some OSes, you can modify <span class="sc">gdb</span>'s default behavior by
locking the OS scheduler to allow only a single thread to run.
<dl>
<dt><code>set scheduler-locking </code><var>mode</var><dd><a name="index-scheduler-locking-mode-348"></a><a name="index-lock-scheduler-349"></a>Set the scheduler locking mode. If it is <code>off</code>, then there is no
locking and any thread may run at any time. If <code>on</code>, then only the
current thread may run when the inferior is resumed. The <code>step</code>
mode optimizes for single-stepping; it prevents other threads
from preempting the current thread while you are stepping, so that
the focus of debugging does not change unexpectedly.
Other threads only rarely (or never) get a chance to run
when you step. They are more likely to run when you &lsquo;<samp><span class="samp">next</span></samp>&rsquo; over a
function call, and they are completely free to run when you use commands
like &lsquo;<samp><span class="samp">continue</span></samp>&rsquo;, &lsquo;<samp><span class="samp">until</span></samp>&rsquo;, or &lsquo;<samp><span class="samp">finish</span></samp>&rsquo;. However, unless another
thread hits a breakpoint during its timeslice, <span class="sc">gdb</span> does not change
the current thread away from the thread that you are debugging.
<br><dt><code>show scheduler-locking</code><dd>Display the current scheduler locking mode.
</dl>
<p><a name="index-resume-threads-of-multiple-processes-simultaneously-350"></a>By default, when you issue one of the execution commands such as
<code>continue</code>, <code>next</code> or <code>step</code>, <span class="sc">gdb</span> allows only
threads of the current inferior to run. For example, if <span class="sc">gdb</span>
is attached to two inferiors, each with two threads, the
<code>continue</code> command resumes only the two threads of the current
inferior. This is useful, for example, when you debug a program that
forks and you want to hold the parent stopped (so that, for instance,
it doesn't run to exit), while you debug the child. In other
situations, you may not be interested in inspecting the current state
of any of the processes <span class="sc">gdb</span> is attached to, and you may want
to resume them all until some breakpoint is hit. In the latter case,
you can instruct <span class="sc">gdb</span> to allow all threads of all the
inferiors to run with the <code>set&nbsp;schedule-multiple</code><!-- /@w --> command.
<a name="index-set-schedule_002dmultiple-351"></a>
<dl><dt><code>set schedule-multiple</code><dd>Set the mode for allowing threads of multiple processes to be resumed
when an execution command is issued. When <code>on</code>, all threads of
all processes are allowed to run. When <code>off</code>, only the threads
of the current process are resumed. The default is <code>off</code>. The
<code>scheduler-locking</code> mode takes precedence when set to <code>on</code>,
or while you are stepping and set to <code>step</code>.
<br><dt><code>show schedule-multiple</code><dd>Display the current mode for resuming the execution of threads of
multiple processes.
</dl>
</body></html>

View file

@ -0,0 +1,53 @@
<html lang="en">
<head>
<title>Alpha - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Architectures.html#Architectures" title="Architectures">
<link rel="prev" href="i386.html#i386" title="i386">
<link rel="next" href="MIPS.html#MIPS" title="MIPS">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Alpha"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="MIPS.html#MIPS">MIPS</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="i386.html#i386">i386</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Architectures.html#Architectures">Architectures</a>
<hr>
</div>
<h4 class="subsection">21.4.3 Alpha</h4>
<p>See the following section.
</body></html>

View file

@ -0,0 +1,69 @@
<html lang="en">
<head>
<title>Altering - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="Symbols.html#Symbols" title="Symbols">
<link rel="next" href="GDB-Files.html#GDB-Files" title="GDB Files">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Altering"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="GDB-Files.html#GDB-Files">GDB Files</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Symbols.html#Symbols">Symbols</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>
<h2 class="chapter">17 Altering Execution</h2>
<p>Once you think you have found an error in your program, you might want to
find out for certain whether correcting the apparent error would lead to
correct results in the rest of the run. You can find the answer by
experiment, using the <span class="sc">gdb</span> features for altering execution of the
program.
<p>For example, you can store new values into variables or memory
locations, give your program a signal, restart it at a different
address, or even return prematurely from a function.
<ul class="menu">
<li><a accesskey="1" href="Assignment.html#Assignment">Assignment</a>: Assignment to variables
<li><a accesskey="2" href="Jumping.html#Jumping">Jumping</a>: Continuing at a different address
<li><a accesskey="3" href="Signaling.html#Signaling">Signaling</a>: Giving your program a signal
<li><a accesskey="4" href="Returning.html#Returning">Returning</a>: Returning from a function
<li><a accesskey="5" href="Calling.html#Calling">Calling</a>: Calling your program's functions
<li><a accesskey="6" href="Patching.html#Patching">Patching</a>: Patching your program
</ul>
</body></html>

View file

@ -0,0 +1,123 @@
<html lang="en">
<head>
<title>Ambiguous Expressions - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Data.html#Data" title="Data">
<link rel="prev" href="Expressions.html#Expressions" title="Expressions">
<link rel="next" href="Variables.html#Variables" title="Variables">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Ambiguous-Expressions"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Variables.html#Variables">Variables</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Expressions.html#Expressions">Expressions</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Data.html#Data">Data</a>
<hr>
</div>
<h3 class="section">10.2 Ambiguous Expressions</h3>
<p><a name="index-ambiguous-expressions-540"></a>
Expressions can sometimes contain some ambiguous elements. For instance,
some programming languages (notably Ada, C<tt>++</tt> and Objective-C) permit
a single function name to be defined several times, for application in
different contexts. This is called <dfn>overloading</dfn>. Another example
involving Ada is generics. A <dfn>generic package</dfn> is similar to C<tt>++</tt>
templates and is typically instantiated several times, resulting in
the same function name being defined in different contexts.
<p>In some cases and depending on the language, it is possible to adjust
the expression to remove the ambiguity. For instance in C<tt>++</tt>, you
can specify the signature of the function you want to break on, as in
<kbd>break </kbd><var>function</var><kbd>(</kbd><var>types</var><kbd>)</kbd>. In Ada, using the fully
qualified name of your function often makes the expression unambiguous
as well.
<p>When an ambiguity that needs to be resolved is detected, the debugger
has the capability to display a menu of numbered choices for each
possibility, and then waits for the selection with the prompt &lsquo;<samp><span class="samp">&gt;</span></samp>&rsquo;.
The first option is always &lsquo;<samp><span class="samp">[0] cancel</span></samp>&rsquo;, and typing <kbd>0 &lt;RET&gt;</kbd>
aborts the current command. If the command in which the expression was
used allows more than one choice to be selected, the next option in the
menu is &lsquo;<samp><span class="samp">[1] all</span></samp>&rsquo;, and typing <kbd>1 &lt;RET&gt;</kbd> selects all possible
choices.
<p>For example, the following session excerpt shows an attempt to set a
breakpoint at the overloaded symbol <code>String::after</code>.
We choose three particular definitions of that function name:
<!-- FIXME! This is likely to change to show arg type lists, at least -->
<pre class="smallexample"> (gdb) b String::after
[0] cancel
[1] all
[2] file:String.cc; line number:867
[3] file:String.cc; line number:860
[4] file:String.cc; line number:875
[5] file:String.cc; line number:853
[6] file:String.cc; line number:846
[7] file:String.cc; line number:735
&gt; 2 4 6
Breakpoint 1 at 0xb26c: file String.cc, line 867.
Breakpoint 2 at 0xb344: file String.cc, line 875.
Breakpoint 3 at 0xafcc: file String.cc, line 846.
Multiple breakpoints were set.
Use the "delete" command to delete unwanted
breakpoints.
(gdb)
</pre>
<a name="index-set-multiple_002dsymbols-541"></a>
<dl><dt><code>set multiple-symbols </code><var>mode</var><dd><a name="index-multiple_002dsymbols-menu-542"></a>
This option allows you to adjust the debugger behavior when an expression
is ambiguous.
<p>By default, <var>mode</var> is set to <code>all</code>. If the command with which
the expression is used allows more than one choice, then <span class="sc">gdb</span>
automatically selects all possible choices. For instance, inserting
a breakpoint on a function using an ambiguous name results in a breakpoint
inserted on each possible match. However, if a unique choice must be made,
then <span class="sc">gdb</span> uses the menu to help you disambiguate the expression.
For instance, printing the address of an overloaded function will result
in the use of the menu.
<p>When <var>mode</var> is set to <code>ask</code>, the debugger always uses the menu
when an ambiguity is detected.
<p>Finally, when <var>mode</var> is set to <code>cancel</code>, the debugger reports
an error due to the ambiguity and the command is aborted.
<p><a name="index-show-multiple_002dsymbols-543"></a><br><dt><code>show multiple-symbols</code><dd>Show the current value of the <code>multiple-symbols</code> setting.
</dl>
</body></html>

View file

@ -0,0 +1,73 @@
<html lang="en">
<head>
<title>Analyze Collected Data - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Tracepoints.html#Tracepoints" title="Tracepoints">
<link rel="prev" href="Set-Tracepoints.html#Set-Tracepoints" title="Set Tracepoints">
<link rel="next" href="Tracepoint-Variables.html#Tracepoint-Variables" title="Tracepoint Variables">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Analyze-Collected-Data"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Tracepoint-Variables.html#Tracepoint-Variables">Tracepoint Variables</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Set-Tracepoints.html#Set-Tracepoints">Set Tracepoints</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Tracepoints.html#Tracepoints">Tracepoints</a>
<hr>
</div>
<h3 class="section">13.2 Using the Collected Data</h3>
<p>After the tracepoint experiment ends, you use <span class="sc">gdb</span> commands
for examining the trace data. The basic idea is that each tracepoint
collects a trace <dfn>snapshot</dfn> every time it is hit and another
snapshot every time it single-steps. All these snapshots are
consecutively numbered from zero and go into a buffer, and you can
examine them later. The way you examine them is to <dfn>focus</dfn> on a
specific trace snapshot. When the remote stub is focused on a trace
snapshot, it will respond to all <span class="sc">gdb</span> requests for memory and
registers by reading from the buffer which belongs to that snapshot,
rather than from <em>real</em> memory or registers of the program being
debugged. This means that <strong>all</strong> <span class="sc">gdb</span> commands
(<code>print</code>, <code>info registers</code>, <code>backtrace</code>, etc.) will
behave as if we were currently debugging the program state as it was
when the tracepoint occurred. Any requests for data that are not in
the buffer will fail.
<ul class="menu">
<li><a accesskey="1" href="tfind.html#tfind">tfind</a>: How to select a trace snapshot
<li><a accesskey="2" href="tdump.html#tdump">tdump</a>: How to display all data for a snapshot
<li><a accesskey="3" href="save-tracepoints.html#save-tracepoints">save tracepoints</a>: How to save tracepoints for a future run
</ul>
</body></html>

View file

@ -0,0 +1,110 @@
<html lang="en">
<head>
<title>Annotations Overview - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Annotations.html#Annotations" title="Annotations">
<link rel="next" href="Server-Prefix.html#Server-Prefix" title="Server Prefix">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Annotations-Overview"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Server-Prefix.html#Server-Prefix">Server Prefix</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Annotations.html#Annotations">Annotations</a>
<hr>
</div>
<h3 class="section">28.1 What is an Annotation?</h3>
<p><a name="index-annotations-2367"></a>
Annotations start with a newline character, two &lsquo;<samp><span class="samp">control-z</span></samp>&rsquo;
characters, and the name of the annotation. If there is no additional
information associated with this annotation, the name of the annotation
is followed immediately by a newline. If there is additional
information, the name of the annotation is followed by a space, the
additional information, and a newline. The additional information
cannot contain newline characters.
<p>Any output not beginning with a newline and two &lsquo;<samp><span class="samp">control-z</span></samp>&rsquo;
characters denotes literal output from <span class="sc">gdb</span>. Currently there is
no need for <span class="sc">gdb</span> to output a newline followed by two
&lsquo;<samp><span class="samp">control-z</span></samp>&rsquo; characters, but if there was such a need, the
annotations could be extended with an &lsquo;<samp><span class="samp">escape</span></samp>&rsquo; annotation which
means those three characters as output.
<p>The annotation <var>level</var>, which is specified using the
<samp><span class="option">--annotate</span></samp> command line option (see <a href="Mode-Options.html#Mode-Options">Mode Options</a>), controls
how much information <span class="sc">gdb</span> prints together with its prompt,
values of expressions, source lines, and other types of output. Level 0
is for no annotations, level 1 is for use when <span class="sc">gdb</span> is run as a
subprocess of <span class="sc">gnu</span> Emacs, level 3 is the maximum annotation suitable
for programs that control <span class="sc">gdb</span>, and level 2 annotations have
been made obsolete (see <a href="../annotate/Limitations.html#Limitations">Limitations of the Annotation Interface</a>).
<a name="index-set-annotate-2368"></a>
<dl><dt><code>set annotate </code><var>level</var><dd>The <span class="sc">gdb</span> command <code>set annotate</code> sets the level of
annotations to the specified <var>level</var>.
<br><dt><code>show annotate</code><dd><a name="index-show-annotate-2369"></a>Show the current annotation level.
</dl>
<p>This chapter describes level 3 annotations.
<p>A simple example of starting up <span class="sc">gdb</span> with annotations is:
<pre class="smallexample"> $ <kbd>gdb --annotate=3</kbd>
GNU gdb 6.0
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it
under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty"
for details.
This GDB was configured as "i386-pc-linux-gnu"
^Z^Zpre-prompt
(gdb)
^Z^Zprompt
<kbd>quit</kbd>
^Z^Zpost-prompt
$
</pre>
<p>Here &lsquo;<samp><span class="samp">quit</span></samp>&rsquo; is input to <span class="sc">gdb</span>; the rest is output from
<span class="sc">gdb</span>. The three lines beginning &lsquo;<samp><span class="samp">^Z^Z</span></samp>&rsquo; (where &lsquo;<samp><span class="samp">^Z</span></samp>&rsquo;
denotes a &lsquo;<samp><span class="samp">control-z</span></samp>&rsquo; character) are annotations; the rest is
output from <span class="sc">gdb</span>.
</body></html>

View file

@ -0,0 +1,97 @@
<html lang="en">
<head>
<title>Annotations for Running - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Annotations.html#Annotations" title="Annotations">
<link rel="prev" href="Invalidation.html#Invalidation" title="Invalidation">
<link rel="next" href="Source-Annotations.html#Source-Annotations" title="Source Annotations">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Annotations-for-Running"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Source-Annotations.html#Source-Annotations">Source Annotations</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Invalidation.html#Invalidation">Invalidation</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Annotations.html#Annotations">Annotations</a>
<hr>
</div>
<h3 class="section">28.6 Running the Program</h3>
<p><a name="index-annotations-for-running-programs-2394"></a>
<a name="index-starting-annotation-2395"></a><a name="index-stopping-annotation-2396"></a>When the program starts executing due to a <span class="sc">gdb</span> command such as
<code>step</code> or <code>continue</code>,
<pre class="smallexample"> ^Z^Zstarting
</pre>
<p>is output. When the program stops,
<pre class="smallexample"> ^Z^Zstopped
</pre>
<p>is output. Before the <code>stopped</code> annotation, a variety of
annotations describe how the program stopped.
<a name="index-exited-annotation-2397"></a>
<dl><dt><code>^Z^Zexited </code><var>exit-status</var><dd>The program exited, and <var>exit-status</var> is the exit status (zero for
successful exit, otherwise nonzero).
<p><a name="index-signalled-annotation-2398"></a><a name="index-signal_002dname-annotation-2399"></a><a name="index-signal_002dname_002dend-annotation-2400"></a><a name="index-signal_002dstring-annotation-2401"></a><a name="index-signal_002dstring_002dend-annotation-2402"></a><br><dt><code>^Z^Zsignalled</code><dd>The program exited with a signal. After the <code>^Z^Zsignalled</code>, the
annotation continues:
<pre class="smallexample"> <var>intro-text</var>
^Z^Zsignal-name
<var>name</var>
^Z^Zsignal-name-end
<var>middle-text</var>
^Z^Zsignal-string
<var>string</var>
^Z^Zsignal-string-end
<var>end-text</var>
</pre>
<p class="noindent">where <var>name</var> is the name of the signal, such as <code>SIGILL</code> or
<code>SIGSEGV</code>, and <var>string</var> is the explanation of the signal, such
as <code>Illegal Instruction</code> or <code>Segmentation fault</code>.
<var>intro-text</var>, <var>middle-text</var>, and <var>end-text</var> are for the
user's benefit and have no particular format.
<p><a name="index-signal-annotation-2403"></a><br><dt><code>^Z^Zsignal</code><dd>The syntax of this annotation is just like <code>signalled</code>, but <span class="sc">gdb</span> is
just saying that the program received the signal, not that it was
terminated with it.
<p><a name="index-breakpoint-annotation-2404"></a><br><dt><code>^Z^Zbreakpoint </code><var>number</var><dd>The program hit breakpoint number <var>number</var>.
<p><a name="index-watchpoint-annotation-2405"></a><br><dt><code>^Z^Zwatchpoint </code><var>number</var><dd>The program hit watchpoint number <var>number</var>.
</dl>
</body></html>

View file

@ -0,0 +1,69 @@
<html lang="en">
<head>
<title>Annotations - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="GDB_002fMI.html#GDB_002fMI" title="GDB/MI">
<link rel="next" href="JIT-Interface.html#JIT-Interface" title="JIT Interface">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Annotations"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="JIT-Interface.html#JIT-Interface">JIT Interface</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="GDB_002fMI.html#GDB_002fMI">GDB/MI</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>
<h2 class="chapter">28 <span class="sc">gdb</span> Annotations</h2>
<p>This chapter describes annotations in <span class="sc">gdb</span>. Annotations were
designed to interface <span class="sc">gdb</span> to graphical user interfaces or other
similar programs which want to interact with <span class="sc">gdb</span> at a
relatively high level.
<p>The annotation mechanism has largely been superseded by <span class="sc">gdb/mi</span>
(see <a href="GDB_002fMI.html#GDB_002fMI">GDB/MI</a>).
<ul class="menu">
<li><a accesskey="1" href="Annotations-Overview.html#Annotations-Overview">Annotations Overview</a>: What annotations are; the general syntax.
<li><a accesskey="2" href="Server-Prefix.html#Server-Prefix">Server Prefix</a>: Issuing a command without affecting user state.
<li><a accesskey="3" href="Prompting.html#Prompting">Prompting</a>: Annotations marking <span class="sc">gdb</span>'s need for input.
<li><a accesskey="4" href="Errors.html#Errors">Errors</a>: Annotations for error messages.
<li><a accesskey="5" href="Invalidation.html#Invalidation">Invalidation</a>: Some annotations describe things now invalid.
<li><a accesskey="6" href="Annotations-for-Running.html#Annotations-for-Running">Annotations for Running</a>
Whether the program is running, how it stopped, etc.
<li><a accesskey="7" href="Source-Annotations.html#Source-Annotations">Source Annotations</a>: Annotations describing source code.
</ul>
</body></html>

View file

@ -0,0 +1,61 @@
<html lang="en">
<head>
<title>Architecture-Specific Protocol Details - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Remote-Protocol.html#Remote-Protocol" title="Remote Protocol">
<link rel="prev" href="General-Query-Packets.html#General-Query-Packets" title="General Query Packets">
<link rel="next" href="Tracepoint-Packets.html#Tracepoint-Packets" title="Tracepoint Packets">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Architecture-Specific-Protocol-Details"></a>
<a name="Architecture_002dSpecific-Protocol-Details"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Tracepoint-Packets.html#Tracepoint-Packets">Tracepoint Packets</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="General-Query-Packets.html#General-Query-Packets">General Query Packets</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Remote-Protocol.html#Remote-Protocol">Remote Protocol</a>
<hr>
</div>
<h3 class="section">E.5 Architecture-Specific Protocol Details</h3>
<p>This section describes how the remote protocol is applied to specific
target architectures. Also see <a href="Standard-Target-Features.html#Standard-Target-Features">Standard Target Features</a>, for
details of XML target descriptions for each architecture.
<ul class="menu">
<li><a accesskey="1" href="ARM_002dSpecific-Protocol-Details.html#ARM_002dSpecific-Protocol-Details">ARM-Specific Protocol Details</a>
<li><a accesskey="2" href="MIPS_002dSpecific-Protocol-Details.html#MIPS_002dSpecific-Protocol-Details">MIPS-Specific Protocol Details</a>
</ul>
</body></html>

View file

@ -0,0 +1,94 @@
<html lang="en">
<head>
<title>Architectures In Python - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Python-API.html#Python-API" title="Python API">
<link rel="prev" href="Lazy-Strings-In-Python.html#Lazy-Strings-In-Python" title="Lazy Strings In Python">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Architectures-In-Python"></a>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Lazy-Strings-In-Python.html#Lazy-Strings-In-Python">Lazy Strings In Python</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Python-API.html#Python-API">Python API</a>
<hr>
</div>
<h5 class="subsubsection">23.2.2.24 Python representation of architectures</h5>
<p><a name="index-Python-architectures-2163"></a>
<span class="sc">gdb</span> uses architecture specific parameters and artifacts in a
number of its various computations. An architecture is represented
by an instance of the <code>gdb.Architecture</code> class.
<p>A <code>gdb.Architecture</code> class has the following methods:
<div class="defun">
&mdash; Function: <b>Architecture.name</b> ()<var><a name="index-Architecture_002ename-2164"></a></var><br>
<blockquote><p>Return the name (string value) of the architecture.
</p></blockquote></div>
<div class="defun">
&mdash; Function: <b>Architecture.disassemble</b> (<var>start_pc </var><span class="roman">[</span><var>, end_pc </var><span class="roman">[</span><var>, count</var><span class="roman">]]</span>)<var><a name="index-Architecture_002edisassemble-2165"></a></var><br>
<blockquote><p>Return a list of disassembled instructions starting from the memory
address <var>start_pc</var>. The optional arguments <var>end_pc</var> and
<var>count</var> determine the number of instructions in the returned list.
If both the optional arguments <var>end_pc</var> and <var>count</var> are
specified, then a list of at most <var>count</var> disassembled instructions
whose start address falls in the closed memory address interval from
<var>start_pc</var> to <var>end_pc</var> are returned. If <var>end_pc</var> is not
specified, but <var>count</var> is specified, then <var>count</var> number of
instructions starting from the address <var>start_pc</var> are returned. If
<var>count</var> is not specified but <var>end_pc</var> is specified, then all
instructions whose start address falls in the closed memory address
interval from <var>start_pc</var> to <var>end_pc</var> are returned. If neither
<var>end_pc</var> nor <var>count</var> are specified, then a single instruction at
<var>start_pc</var> is returned. For all of these cases, each element of the
returned list is a Python <code>dict</code> with the following string keys:
<dl>
<dt><code>addr</code><dd>The value corresponding to this key is a Python long integer capturing
the memory address of the instruction.
<br><dt><code>asm</code><dd>The value corresponding to this key is a string value which represents
the instruction with assembly language mnemonics. The assembly
language flavor used is the same as that specified by the current CLI
variable <code>disassembly-flavor</code>. See <a href="Machine-Code.html#Machine-Code">Machine Code</a>.
<br><dt><code>length</code><dd>The value corresponding to this key is the length (integer value) of the
instruction in bytes.
</dl>
</p></blockquote></div>
</body></html>

View file

@ -0,0 +1,62 @@
<html lang="en">
<head>
<title>Architectures - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Configurations.html#Configurations" title="Configurations">
<link rel="prev" href="Embedded-Processors.html#Embedded-Processors" title="Embedded Processors">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Architectures"></a>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Embedded-Processors.html#Embedded-Processors">Embedded Processors</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Configurations.html#Configurations">Configurations</a>
<hr>
</div>
<h3 class="section">21.4 Architectures</h3>
<p>This section describes characteristics of architectures that affect
all uses of <span class="sc">gdb</span> with the architecture, both native and cross.
<ul class="menu">
<li><a accesskey="1" href="AArch64.html#AArch64">AArch64</a>
<li><a accesskey="2" href="i386.html#i386">i386</a>
<li><a accesskey="3" href="Alpha.html#Alpha">Alpha</a>
<li><a accesskey="4" href="MIPS.html#MIPS">MIPS</a>
<li><a accesskey="5" href="HPPA.html#HPPA">HPPA</a>: HP PA architecture
<li><a accesskey="6" href="SPU.html#SPU">SPU</a>: Cell Broadband Engine SPU architecture
<li><a accesskey="7" href="PowerPC.html#PowerPC">PowerPC</a>
</ul>
</body></html>

View file

@ -0,0 +1,78 @@
<html lang="en">
<head>
<title>Arguments - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Running.html#Running" title="Running">
<link rel="prev" href="Starting.html#Starting" title="Starting">
<link rel="next" href="Environment.html#Environment" title="Environment">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Arguments"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Environment.html#Environment">Environment</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Starting.html#Starting">Starting</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Running.html#Running">Running</a>
<hr>
</div>
<h3 class="section">4.3 Your Program's Arguments</h3>
<p><a name="index-arguments-_0028to-your-program_0029-116"></a>The arguments to your program can be specified by the arguments of the
<code>run</code> command.
They are passed to a shell, which expands wildcard characters and
performs redirection of I/O, and thence to your program. Your
<code>SHELL</code> environment variable (if it exists) specifies what shell
<span class="sc">gdb</span> uses. If you do not define <code>SHELL</code>, <span class="sc">gdb</span> uses
the default shell (<samp><span class="file">/bin/sh</span></samp> on Unix).
<p>On non-Unix systems, the program is usually invoked directly by
<span class="sc">gdb</span>, which emulates I/O redirection via the appropriate system
calls, and the wildcard characters are expanded by the startup code of
the program, not by the shell.
<p><code>run</code> with no arguments uses the same arguments used by the previous
<code>run</code>, or those set by the <code>set args</code> command.
<a name="index-set-args-117"></a>
<dl><dt><code>set args</code><dd>Specify the arguments to be used the next time your program is run. If
<code>set args</code> has no arguments, <code>run</code> executes your program
with no arguments. Once you have run your program with arguments,
using <code>set args</code> before the next <code>run</code> is the only way to run
it again without arguments.
<p><a name="index-show-args-118"></a><br><dt><code>show args</code><dd>Show the arguments to give your program when it is started.
</dl>
</body></html>

View file

@ -0,0 +1,106 @@
<html lang="en">
<head>
<title>Arrays - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Data.html#Data" title="Data">
<link rel="prev" href="Variables.html#Variables" title="Variables">
<link rel="next" href="Output-Formats.html#Output-Formats" title="Output Formats">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Arrays"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Output-Formats.html#Output-Formats">Output Formats</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Variables.html#Variables">Variables</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Data.html#Data">Data</a>
<hr>
</div>
<h3 class="section">10.4 Artificial Arrays</h3>
<p><a name="index-artificial-array-553"></a><a name="index-arrays-554"></a><a name="index-g_t_0040_0040_0040r_007b_002c-referencing-memory-as-an-array_007d-555"></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>You can do this by referring to a contiguous span of memory as an
<dfn>artificial array</dfn>, using the binary operator &lsquo;<samp><span class="samp">@</span></samp>&rsquo;. The left
operand of &lsquo;<samp><span class="samp">@</span></samp>&rsquo; should be the first element of the desired array
and be an individual object. The right operand should be the desired 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
<pre class="smallexample"> int *array = (int *) malloc (len * sizeof (int));
</pre>
<p class="noindent">you can print the contents of <code>array</code> with
<pre class="smallexample"> p *array@len
</pre>
<p>The left operand of &lsquo;<samp><span class="samp">@</span></samp>&rsquo; must reside in memory. Array values made
with &lsquo;<samp><span class="samp">@</span></samp>&rsquo; in this way behave just like other arrays in terms of
subscripting, and are coerced to pointers when used in expressions.
Artificial arrays most often appear in expressions via the value history
(see <a href="Value-History.html#Value-History">Value History</a>), after printing one out.
<p>Another way to create an artificial array is to use a cast.
This re-interprets a value as if it were an array.
The value need not be in memory:
<pre class="smallexample"> (gdb) p/x (short[2])0x12345678
$1 = {0x1234, 0x5678}
</pre>
<p>As a convenience, if you leave the array length out (as in
&lsquo;<samp><span class="samp">(</span><var>type</var><span class="samp">[])</span><var>value</var></samp>&rsquo;) <span class="sc">gdb</span> calculates the size to fill
the value (as &lsquo;<samp><span class="samp">sizeof(</span><var>value</var><span class="samp">)/sizeof(</span><var>type</var><span class="samp">)</span></samp>&rsquo;:
<pre class="smallexample"> (gdb) p/x (short[])0x12345678
$2 = {0x1234, 0x5678}
</pre>
<p>Sometimes the artificial array mechanism is not quite enough; in
moderately complex data structures, the elements of interest may not
actually be adjacent&mdash;for example, if you are interested in the values
of pointers in an array. One useful work-around in this situation is
to use a convenience variable (see <a href="Convenience-Vars.html#Convenience-Vars">Convenience Variables</a>) as a counter in an expression that prints the first
interesting value, and then repeat that expression via &lt;RET&gt;. For
instance, suppose you have an array <code>dtab</code> of pointers to
structures, and you are interested in the values of a field <code>fv</code>
in each structure. Here is an example of what you might type:
<pre class="smallexample"> set $i = 0
p dtab[$i++]-&gt;fv
&lt;RET&gt;
&lt;RET&gt;
...
</pre>
</body></html>

View file

@ -0,0 +1,130 @@
<html lang="en">
<head>
<title>Assignment - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Altering.html#Altering" title="Altering">
<link rel="next" href="Jumping.html#Jumping" title="Jumping">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Assignment"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Jumping.html#Jumping">Jumping</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Altering.html#Altering">Altering</a>
<hr>
</div>
<h3 class="section">17.1 Assignment to Variables</h3>
<p><a name="index-assignment-1014"></a><a name="index-setting-variables-1015"></a>To alter the value of a variable, evaluate an assignment expression.
See <a href="Expressions.html#Expressions">Expressions</a>. For example,
<pre class="smallexample"> print x=4
</pre>
<p class="noindent">stores the value 4 into the variable <code>x</code>, and then prints the
value of the assignment expression (which is 4).
See <a href="Languages.html#Languages">Using <span class="sc">gdb</span> with Different Languages</a>, for more
information on operators in supported languages.
<p><a name="index-set-variable-1016"></a><a name="index-variables_002c-setting-1017"></a>If you are not interested in seeing the value of the assignment, use the
<code>set</code> command instead of the <code>print</code> command. <code>set</code> is
really the same as <code>print</code> except that the expression's value is
not printed and is not put in the value history (see <a href="Value-History.html#Value-History">Value History</a>). The expression is evaluated only for its effects.
<p>If the beginning of the argument string of the <code>set</code> command
appears identical to a <code>set</code> subcommand, use the <code>set
variable</code> command instead of just <code>set</code>. This command is identical
to <code>set</code> except for its lack of subcommands. For example, if your
program has a variable <code>width</code>, you get an error if you try to set
a new value with just &lsquo;<samp><span class="samp">set width=13</span></samp>&rsquo;, because <span class="sc">gdb</span> has the
command <code>set width</code>:
<pre class="smallexample"> (gdb) whatis width
type = double
(gdb) p width
$4 = 13
(gdb) set width=47
Invalid syntax in expression.
</pre>
<p class="noindent">The invalid expression, of course, is &lsquo;<samp><span class="samp">=47</span></samp>&rsquo;. In
order to actually set the program's variable <code>width</code>, use
<pre class="smallexample"> (gdb) set var width=47
</pre>
<p>Because the <code>set</code> command has many subcommands that can conflict
with the names of program variables, it is a good idea to use the
<code>set variable</code> command instead of just <code>set</code>. For example, if
your program has a variable <code>g</code>, you run into problems if you try
to set a new value with just &lsquo;<samp><span class="samp">set g=4</span></samp>&rsquo;, because <span class="sc">gdb</span> has
the command <code>set gnutarget</code>, abbreviated <code>set g</code>:
<pre class="smallexample"> (gdb) whatis g
type = double
(gdb) p g
$1 = 1
(gdb) set g=4
(gdb) p g
$2 = 1
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/smith/cc_progs/a.out
"/home/smith/cc_progs/a.out": can't open to read symbols:
Invalid bfd target.
(gdb) show g
The current BFD target is "=4".
</pre>
<p class="noindent">The program variable <code>g</code> did not change, and you silently set the
<code>gnutarget</code> to an invalid value. In order to set the variable
<code>g</code>, use
<pre class="smallexample"> (gdb) set var g=4
</pre>
<p><span class="sc">gdb</span> allows more implicit conversions in assignments than C; you can
freely store an integer value into a pointer variable or vice versa,
and you can convert any structure to any other structure that is the
same length or shorter.
<!-- FIXME: how do structs align/pad in these conversions? -->
<!-- /doc@cygnus.com 18dec1990 -->
<p>To store values into arbitrary places in memory, use the &lsquo;<samp><span class="samp">{...}</span></samp>&rsquo;
construct to generate a value of specified type at a specified address
(see <a href="Expressions.html#Expressions">Expressions</a>). For example, <code>{int}0x83040</code> refers
to memory location <code>0x83040</code> as an integer (which implies a certain size
and representation in memory), and
<pre class="smallexample"> set {int}0x83040 = 4
</pre>
<p class="noindent">stores the value 4 into that memory location.
</body></html>

View file

@ -0,0 +1,85 @@
<html lang="en">
<head>
<title>Asynchronous and non-stop modes - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="GDB_002fMI-General-Design.html#GDB_002fMI-General-Design" title="GDB/MI General Design">
<link rel="prev" href="Context-management.html#Context-management" title="Context management">
<link rel="next" href="Thread-groups.html#Thread-groups" title="Thread groups">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Asynchronous-and-non-stop-modes"></a>
<a name="Asynchronous-and-non_002dstop-modes"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Thread-groups.html#Thread-groups">Thread groups</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Context-management.html#Context-management">Context management</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="GDB_002fMI-General-Design.html#GDB_002fMI-General-Design">GDB/MI General Design</a>
<hr>
</div>
<h4 class="subsection">27.1.2 Asynchronous command execution and non-stop mode</h4>
<p>On some targets, <span class="sc">gdb</span> is capable of processing MI commands
even while the target is running. This is called <dfn>asynchronous
command execution</dfn> (see <a href="Background-Execution.html#Background-Execution">Background Execution</a>). The frontend may
specify a preferrence for asynchronous execution using the
<code>-gdb-set target-async 1</code> command, which should be emitted before
either running the executable or attaching to the target. After the
frontend has started the executable or attached to the target, it can
find if asynchronous execution is enabled using the
<code>-list-target-features</code> command.
<p>Even if <span class="sc">gdb</span> can accept a command while target is running,
many commands that access the target do not work when the target is
running. Therefore, asynchronous command execution is most useful
when combined with non-stop mode (see <a href="Non_002dStop-Mode.html#Non_002dStop-Mode">Non-Stop Mode</a>). Then,
it is possible to examine the state of one thread, while other threads
are running.
<p>When a given thread is running, MI commands that try to access the
target in the context of that thread may not work, or may work only on
some targets. In particular, commands that try to operate on thread's
stack will not work, on any target. Commands that read memory, or
modify breakpoints, may work or not work, depending on the target. Note
that even commands that operate on global state, such as <code>print</code>,
<code>set</code>, and breakpoint commands, still access the target in the
context of a specific thread, so frontend should try to find a
stopped thread and perform the operation on that thread (using the
&lsquo;<samp><span class="samp">--thread</span></samp>&rsquo; option).
<p>Which commands will work in the context of a running thread is
highly target dependent. However, the two commands
<code>-exec-interrupt</code>, to stop a thread, and <code>-thread-info</code>,
to find the state of a thread, will always work.
</body></html>

View file

@ -0,0 +1,99 @@
<html lang="en">
<head>
<title>Attach - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Running.html#Running" title="Running">
<link rel="prev" href="Input_002fOutput.html#Input_002fOutput" title="Input/Output">
<link rel="next" href="Kill-Process.html#Kill-Process" title="Kill Process">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Attach"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Kill-Process.html#Kill-Process">Kill Process</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Input_002fOutput.html#Input_002fOutput">Input/Output</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Running.html#Running">Running</a>
<hr>
</div>
<h3 class="section">4.7 Debugging an Already-running Process</h3>
<p><a name="index-attach-139"></a><a name="index-attach-140"></a>
<dl>
<dt><code>attach </code><var>process-id</var><dd>This command attaches to a running process&mdash;one that was started
outside <span class="sc">gdb</span>. (<code>info files</code> shows your active
targets.) The command takes as argument a process ID. The usual way to
find out the <var>process-id</var> of a Unix process is with the <code>ps</code> utility,
or with the &lsquo;<samp><span class="samp">jobs -l</span></samp>&rsquo; shell command.
<p><code>attach</code> does not repeat if you press &lt;RET&gt; a second time after
executing the command.
</dl>
<p>To use <code>attach</code>, your program must be running in an environment
which supports processes; for example, <code>attach</code> does not work for
programs on bare-board targets that lack an operating system. You must
also have permission to send the process a signal.
<p>When you use <code>attach</code>, the debugger finds the program running in
the process first by looking in the current working directory, then (if
the program is not found) by using the source file search path
(see <a href="Source-Path.html#Source-Path">Specifying Source Directories</a>). You can also use
the <code>file</code> command to load the program. See <a href="Files.html#Files">Commands to Specify Files</a>.
<p>The first thing <span class="sc">gdb</span> does after arranging to debug the specified
process is to stop it. You can examine and modify an attached process
with all the <span class="sc">gdb</span> commands that are ordinarily available when
you start processes with <code>run</code>. You can insert breakpoints; you
can step and continue; you can modify storage. If you would rather the
process continue running, you may use the <code>continue</code> command after
attaching <span class="sc">gdb</span> to the process.
<a name="index-detach-141"></a>
<dl><dt><code>detach</code><dd>When you have finished debugging the attached process, you can use the
<code>detach</code> command to release it from <span class="sc">gdb</span> control. Detaching
the process continues its execution. After the <code>detach</code> command,
that process and <span class="sc">gdb</span> become completely independent once more, and you
are ready to <code>attach</code> another process or start one with <code>run</code>.
<code>detach</code> does not repeat if you press &lt;RET&gt; again after
executing the command.
</dl>
<p>If you exit <span class="sc">gdb</span> while you have an attached process, you detach
that process. If you use the <code>run</code> command, you kill that process.
By default, <span class="sc">gdb</span> asks for confirmation if you try to do either of these
things; you can control whether or not you need to confirm by using the
<code>set confirm</code> command (see <a href="Messages_002fWarnings.html#Messages_002fWarnings">Optional Warnings and Messages</a>).
</body></html>

View file

@ -0,0 +1,139 @@
<html lang="en">
<head>
<title>Auto Display - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Data.html#Data" title="Data">
<link rel="prev" href="Memory.html#Memory" title="Memory">
<link rel="next" href="Print-Settings.html#Print-Settings" title="Print Settings">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Auto-Display"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Print-Settings.html#Print-Settings">Print Settings</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Memory.html#Memory">Memory</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Data.html#Data">Data</a>
<hr>
</div>
<h3 class="section">10.7 Automatic Display</h3>
<p><a name="index-automatic-display-569"></a><a name="index-display-of-expressions-570"></a>
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 <dfn>automatic
display list</dfn> so that <span class="sc">gdb</span> prints its value each time your 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:
<pre class="smallexample"> 2: foo = 38
3: bar[5] = (struct hack *) 0x3804
</pre>
<p class="noindent">This display shows item numbers, expressions and their current values. As with
displays you request manually using <code>x</code> or <code>print</code>, you can
specify the output format you prefer; in fact, <code>display</code> decides
whether to use <code>print</code> or <code>x</code> depending your format
specification&mdash;it uses <code>x</code> if you specify either the &lsquo;<samp><span class="samp">i</span></samp>&rsquo;
or &lsquo;<samp><span class="samp">s</span></samp>&rsquo; format, or a unit size; otherwise it uses <code>print</code>.
<a name="index-display-571"></a>
<dl><dt><code>display </code><var>expr</var><dd>Add the expression <var>expr</var> to the list of expressions to display
each time your program stops. See <a href="Expressions.html#Expressions">Expressions</a>.
<p><code>display</code> does not repeat if you press &lt;RET&gt; again after using it.
<br><dt><code>display/</code><var>fmt</var> <var>expr</var><dd>For <var>fmt</var> specifying only a display format and not a size or
count, add the expression <var>expr</var> to the auto-display list but
arrange to display it each time in the specified format <var>fmt</var>.
See <a href="Output-Formats.html#Output-Formats">Output Formats</a>.
<br><dt><code>display/</code><var>fmt</var> <var>addr</var><dd>For <var>fmt</var> &lsquo;<samp><span class="samp">i</span></samp>&rsquo; or &lsquo;<samp><span class="samp">s</span></samp>&rsquo;, 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 your program stops. Examining means in effect
doing &lsquo;<samp><span class="samp">x/</span><var>fmt</var> <var>addr</var></samp>&rsquo;. See <a href="Memory.html#Memory">Examining Memory</a>.
</dl>
<p>For example, &lsquo;<samp><span class="samp">display/i $pc</span></samp>&rsquo; can be helpful, to see the machine
instruction about to be executed each time execution stops (&lsquo;<samp><span class="samp">$pc</span></samp>&rsquo;
is a common name for the program counter; see <a href="Registers.html#Registers">Registers</a>).
<a name="index-delete-display-572"></a>
<a name="index-undisplay-573"></a>
<dl><dt><code>undisplay </code><var>dnums</var><code>...</code><dt><code>delete display </code><var>dnums</var><code>...</code><dd>Remove items from the list of expressions to display. Specify the
numbers of the displays that you want affected with the command
argument <var>dnums</var>. It can be a single display number, one of the
numbers shown in the first field of the &lsquo;<samp><span class="samp">info display</span></samp>&rsquo; display;
or it could be a range of display numbers, as in <code>2-4</code>.
<p><code>undisplay</code> does not repeat if you press &lt;RET&gt; after using it.
(Otherwise you would just get the error &lsquo;<samp><span class="samp">No display number ...</span></samp>&rsquo;.)
<p><a name="index-disable-display-574"></a><br><dt><code>disable display </code><var>dnums</var><code>...</code><dd>Disable the display of item numbers <var>dnums</var>. A disabled display
item is not printed automatically, but is not forgotten. It may be
enabled again later. Specify the numbers of the displays that you
want affected with the command argument <var>dnums</var>. It can be a
single display number, one of the numbers shown in the first field of
the &lsquo;<samp><span class="samp">info display</span></samp>&rsquo; display; or it could be a range of display
numbers, as in <code>2-4</code>.
<p><a name="index-enable-display-575"></a><br><dt><code>enable display </code><var>dnums</var><code>...</code><dd>Enable display of item numbers <var>dnums</var>. It becomes effective once
again in auto display of its expression, until you specify otherwise.
Specify the numbers of the displays that you want affected with the
command argument <var>dnums</var>. It can be a single display number, one
of the numbers shown in the first field of the &lsquo;<samp><span class="samp">info display</span></samp>&rsquo;
display; or it could be a range of display numbers, as in <code>2-4</code>.
<br><dt><code>display</code><dd>Display the current values of the expressions on the list, just as is
done when your program stops.
<p><a name="index-info-display-576"></a><br><dt><code>info display</code><dd>Print the list of expressions previously set up to display
automatically, each one with its item number, but without showing the
values. This includes disabled expressions, which are marked as such.
It also includes expressions which would not be displayed right now
because they refer to automatic variables not currently available.
</dl>
<p><a name="index-display-disabled-out-of-scope-577"></a>If a display expression refers to local variables, then it does not make
sense outside the lexical context for which it was set up. Such an
expression is disabled when execution enters a context where one of its
variables is not defined. For example, if you give the command
<code>display last_char</code> while inside a function with an argument
<code>last_char</code>, <span class="sc">gdb</span> displays this argument while your program
continues to stop inside that function. When it stops elsewhere&mdash;where
there is no variable <code>last_char</code>&mdash;the display is disabled
automatically. The next time your program stops where <code>last_char</code>
is meaningful, you can enable the display expression once again.
</body></html>

View file

@ -0,0 +1,152 @@
<html lang="en">
<head>
<title>Auto-loading safe path - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Auto_002dloading.html#Auto_002dloading" title="Auto-loading">
<link rel="prev" href="objfile_002dgdb_002egdb-file.html#objfile_002dgdb_002egdb-file" title="objfile-gdb.gdb file">
<link rel="next" href="Auto_002dloading-verbose-mode.html#Auto_002dloading-verbose-mode" title="Auto-loading verbose mode">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Auto-loading-safe-path"></a>
<a name="Auto_002dloading-safe-path"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Auto_002dloading-verbose-mode.html#Auto_002dloading-verbose-mode">Auto-loading verbose mode</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="objfile_002dgdb_002egdb-file.html#objfile_002dgdb_002egdb-file">objfile-gdb.gdb file</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Auto_002dloading.html#Auto_002dloading">Auto-loading</a>
<hr>
</div>
<h4 class="subsection">22.7.4 Security restriction for auto-loading</h4>
<p><a name="index-auto_002dloading-safe_002dpath-1603"></a>
As the files of inferior can come from untrusted source (such as submitted by
an application user) <span class="sc">gdb</span> does not always load any files automatically.
<span class="sc">gdb</span> provides the &lsquo;<samp><span class="samp">set auto-load safe-path</span></samp>&rsquo; setting to list
directories trusted for loading files not explicitly requested by user.
Each directory can also be a shell wildcard pattern.
<p>If the path is not set properly you will see a warning and the file will not
get loaded:
<pre class="smallexample"> $ ./gdb -q ./gdb
Reading symbols from /home/user/gdb/gdb...done.
warning: File "/home/user/gdb/gdb-gdb.gdb" auto-loading has been
declined by your `auto-load safe-path' set
to "$debugdir:$datadir/auto-load".
warning: File "/home/user/gdb/gdb-gdb.py" auto-loading has been
declined by your `auto-load safe-path' set
to "$debugdir:$datadir/auto-load".
</pre>
<p class="noindent">To instruct <span class="sc">gdb</span> to go ahead and use the init files anyway,
invoke <span class="sc">gdb</span> like this:
<pre class="smallexample"> $ gdb -q -iex "set auto-load safe-path /home/user/gdb" ./gdb
</pre>
<p>The list of trusted directories is controlled by the following commands:
<dl>
<a name="set-auto_002dload-safe_002dpath"></a><a name="index-set-auto_002dload-safe_002dpath-1604"></a><dt><code>set auto-load safe-path </code><span class="roman">[</span><var>directories</var><span class="roman">]</span><dd>Set the list of directories (and their subdirectories) trusted for automatic
loading and execution of scripts. You can also enter a specific trusted file.
Each directory can also be a shell wildcard pattern; wildcards do not match
directory separator - see <code>FNM_PATHNAME</code> for system function <code>fnmatch</code>
(see <a href="../libc/Wildcard-Matching.html#Wildcard-Matching">fnmatch</a>).
If you omit <var>directories</var>, &lsquo;<samp><span class="samp">auto-load safe-path</span></samp>&rsquo; will be reset to
its default value as specified during <span class="sc">gdb</span> compilation.
<p>The list of directories uses path separator (&lsquo;<samp><span class="samp">:</span></samp>&rsquo; on GNU and Unix
systems, &lsquo;<samp><span class="samp">;</span></samp>&rsquo; on MS-Windows and MS-DOS) to separate directories, similarly
to the <samp><span class="env">PATH</span></samp> environment variable.
<p><a name="show-auto_002dload-safe_002dpath"></a><a name="index-show-auto_002dload-safe_002dpath-1605"></a><br><dt><code>show auto-load safe-path</code><dd>Show the list of directories trusted for automatic loading and execution of
scripts.
<p><a name="add_002dauto_002dload_002dsafe_002dpath"></a><a name="index-add_002dauto_002dload_002dsafe_002dpath-1606"></a><br><dt><code>add-auto-load-safe-path</code><dd>Add an entry (or list of entries) the list of directories trusted for automatic
loading and execution of scripts. Multiple entries may be delimited by the
host platform path separator in use.
</dl>
<p>This variable defaults to what <code>--with-auto-load-dir</code> has been configured
to (see <a href="with_002dauto_002dload_002ddir.html#with_002dauto_002dload_002ddir">with-auto-load-dir</a>). <samp><span class="file">$debugdir</span></samp> and <samp><span class="file">$datadir</span></samp>
substitution applies the same as for <a href="set-auto_002dload-scripts_002ddirectory.html#set-auto_002dload-scripts_002ddirectory">set auto-load scripts-directory</a>.
The default <code>set auto-load safe-path</code> value can be also overriden by
<span class="sc">gdb</span> configuration option <samp><span class="option">--with-auto-load-safe-path</span></samp>.
<p>Setting this variable to <samp><span class="file">/</span></samp> disables this security protection,
corresponding <span class="sc">gdb</span> configuration option is
<samp><span class="option">--without-auto-load-safe-path</span></samp>.
This variable is supposed to be set to the system directories writable by the
system superuser only. Users can add their source directories in init files in
their home directories (see <a href="Home-Directory-Init-File.html#Home-Directory-Init-File">Home Directory Init File</a>). See also deprecated
init file in the current directory
(see <a href="Init-File-in-the-Current-Directory-during-Startup.html#Init-File-in-the-Current-Directory-during-Startup">Init File in the Current Directory during Startup</a>).
<p>To force <span class="sc">gdb</span> to load the files it declined to load in the previous
example, you could use one of the following ways:
<dl>
<dt><samp><span class="file">~/.gdbinit</span></samp>: &lsquo;<samp><span class="samp">add-auto-load-safe-path ~/src/gdb</span></samp>&rsquo;<dd>Specify this trusted directory (or a file) as additional component of the list.
You have to specify also any existing directories displayed by
by &lsquo;<samp><span class="samp">show auto-load safe-path</span></samp>&rsquo; (such as &lsquo;<samp><span class="samp">/usr:/bin</span></samp>&rsquo; in this example).
<br><dt><kbd>gdb -iex "set auto-load safe-path /usr:/bin:~/src/gdb" ...</kbd><dd>Specify this directory as in the previous case but just for a single
<span class="sc">gdb</span> session.
<br><dt><kbd>gdb -iex "set auto-load safe-path /" ...</kbd><dd>Disable auto-loading safety for a single <span class="sc">gdb</span> session.
This assumes all the files you debug during this <span class="sc">gdb</span> session will come
from trusted sources.
<br><dt><kbd>./configure --without-auto-load-safe-path</kbd><dd>During compilation of <span class="sc">gdb</span> you may disable any auto-loading safety.
This assumes all the files you will ever debug with this <span class="sc">gdb</span> come from
trusted sources.
</dl>
<p>On the other hand you can also explicitly forbid automatic files loading which
also suppresses any such warning messages:
<dl>
<dt><kbd>gdb -iex "set auto-load no" ...</kbd><dd>You can use <span class="sc">gdb</span> command-line option for a single <span class="sc">gdb</span> session.
<br><dt><samp><span class="file">~/.gdbinit</span></samp>: &lsquo;<samp><span class="samp">set auto-load no</span></samp>&rsquo;<dd>Disable auto-loading globally for the user
(see <a href="Home-Directory-Init-File.html#Home-Directory-Init-File">Home Directory Init File</a>). While it is improbable, you could also
use system init file instead (see <a href="System_002dwide-configuration.html#System_002dwide-configuration">System-wide configuration</a>).
</dl>
<p>This setting applies to the file names as entered by user. If no entry matches
<span class="sc">gdb</span> tries as a last resort to also resolve all the file names into
their canonical form (typically resolving symbolic links) and compare the
entries again. <span class="sc">gdb</span> already canonicalizes most of the filenames on its
own before starting the comparison so a canonical form of directories is
recommended to be entered.
</body></html>

View file

@ -0,0 +1,78 @@
<html lang="en">
<head>
<title>Auto-loading verbose mode - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Auto_002dloading.html#Auto_002dloading" title="Auto-loading">
<link rel="prev" href="Auto_002dloading-safe-path.html#Auto_002dloading-safe-path" title="Auto-loading safe path">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Auto-loading-verbose-mode"></a>
<a name="Auto_002dloading-verbose-mode"></a>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Auto_002dloading-safe-path.html#Auto_002dloading-safe-path">Auto-loading safe path</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Auto_002dloading.html#Auto_002dloading">Auto-loading</a>
<hr>
</div>
<h4 class="subsection">22.7.5 Displaying files tried for auto-load</h4>
<p><a name="index-auto_002dloading-verbose-mode-1607"></a>
For better visibility of all the file locations where you can place scripts to
be auto-loaded with inferior &mdash; or to protect yourself against accidental
execution of untrusted scripts &mdash; <span class="sc">gdb</span> provides a feature for printing
all the files attempted to be loaded. Both existing and non-existing files may
be printed.
<p>For example the list of directories from which it is safe to auto-load files
(see <a href="Auto_002dloading-safe-path.html#Auto_002dloading-safe-path">Auto-loading safe path</a>) applies also to canonicalized filenames which
may not be too obvious while setting it up.
<pre class="smallexample"> (gdb) set debug auto-load on
(gdb) file ~/src/t/true
auto-load: Loading canned sequences of commands script "/tmp/true-gdb.gdb"
for objfile "/tmp/true".
auto-load: Updating directories of "/usr:/opt".
auto-load: Using directory "/usr".
auto-load: Using directory "/opt".
warning: File "/tmp/true-gdb.gdb" auto-loading has been declined
by your `auto-load safe-path' set to "/usr:/opt".
</pre>
<dl>
<a name="set-debug-auto_002dload"></a><a name="index-set-debug-auto_002dload-1608"></a><dt><code>set debug auto-load [on|off]</code><dd>Set whether to print the filenames attempted to be auto-loaded.
<p><a name="show-debug-auto_002dload"></a><a name="index-show-debug-auto_002dload-1609"></a><br><dt><code>show debug auto-load</code><dd>Show whether printing of the filenames attempted to be auto-loaded is turned
on or off.
</dl>
</body></html>

View file

@ -0,0 +1,175 @@
<html lang="en">
<head>
<title>Auto-loading - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Controlling-GDB.html#Controlling-GDB" title="Controlling GDB">
<link rel="prev" href="ABI.html#ABI" title="ABI">
<link rel="next" href="Messages_002fWarnings.html#Messages_002fWarnings" title="Messages/Warnings">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Auto-loading"></a>
<a name="Auto_002dloading"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Messages_002fWarnings.html#Messages_002fWarnings">Messages/Warnings</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="ABI.html#ABI">ABI</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Controlling-GDB.html#Controlling-GDB">Controlling GDB</a>
<hr>
</div>
<h3 class="section">22.7 Automatically loading associated files</h3>
<p><a name="index-auto_002dloading-1586"></a>
<span class="sc">gdb</span> sometimes reads files with commands and settings automatically,
without being explicitly told so by the user. We call this feature
<dfn>auto-loading</dfn>. While auto-loading is useful for automatically adapting
<span class="sc">gdb</span> to the needs of your project, it can sometimes produce unexpected
results or introduce security risks (e.g., if the file comes from untrusted
sources).
<p>Note that loading of these associated files (including the local <samp><span class="file">.gdbinit</span></samp>
file) requires accordingly configured <code>auto-load safe-path</code>
(see <a href="Auto_002dloading-safe-path.html#Auto_002dloading-safe-path">Auto-loading safe path</a>).
<p>For these reasons, <span class="sc">gdb</span> includes commands and options to let you
control when to auto-load files and which files should be auto-loaded.
<dl>
<a name="set-auto_002dload-off"></a><a name="index-set-auto_002dload-off-1587"></a><dt><code>set auto-load off</code><dd>Globally disable loading of all auto-loaded files.
You may want to use this command with the &lsquo;<samp><span class="samp">-iex</span></samp>&rsquo; option
(see <a href="Option-_002dinit_002deval_002dcommand.html#Option-_002dinit_002deval_002dcommand">Option -init-eval-command</a>) such as:
<pre class="smallexample"> $ <kbd>gdb -iex "set auto-load off" untrusted-executable corefile</kbd>
</pre>
<p>Be aware that system init file (see <a href="System_002dwide-configuration.html#System_002dwide-configuration">System-wide configuration</a>)
and init files from your home directory (see <a href="Home-Directory-Init-File.html#Home-Directory-Init-File">Home Directory Init File</a>)
still get read (as they come from generally trusted directories).
To prevent <span class="sc">gdb</span> from auto-loading even those init files, use the
<samp><span class="option">-nx</span></samp> option (see <a href="Mode-Options.html#Mode-Options">Mode Options</a>), in addition to
<code>set auto-load no</code>.
<p><a name="show-auto_002dload"></a><a name="index-show-auto_002dload-1588"></a><br><dt><code>show auto-load</code><dd>Show whether auto-loading of each specific &lsquo;<samp><span class="samp">auto-load</span></samp>&rsquo; file(s) is enabled
or disabled.
<pre class="smallexample"> (gdb) show auto-load
gdb-scripts: Auto-loading of canned sequences of commands scripts is on.
libthread-db: Auto-loading of inferior specific libthread_db is on.
local-gdbinit: Auto-loading of .gdbinit script from current directory
is on.
python-scripts: Auto-loading of Python scripts is on.
safe-path: List of directories from which it is safe to auto-load files
is $debugdir:$datadir/auto-load.
scripts-directory: List of directories from which to load auto-loaded scripts
is $debugdir:$datadir/auto-load.
</pre>
<p><a name="info-auto_002dload"></a><a name="index-info-auto_002dload-1589"></a><br><dt><code>info auto-load</code><dd>Print whether each specific &lsquo;<samp><span class="samp">auto-load</span></samp>&rsquo; file(s) have been auto-loaded or
not.
<pre class="smallexample"> (gdb) info auto-load
gdb-scripts:
Loaded Script
Yes /home/user/gdb/gdb-gdb.gdb
libthread-db: No auto-loaded libthread-db.
local-gdbinit: Local .gdbinit file "/home/user/gdb/.gdbinit" has been
loaded.
python-scripts:
Loaded Script
Yes /home/user/gdb/gdb-gdb.py
</pre>
</dl>
<p>These are various kinds of files <span class="sc">gdb</span> can automatically load:
<ul>
<li>See <a href="objfile_002dgdb_002epy-file.html#objfile_002dgdb_002epy-file">objfile-gdb.py file</a>, controlled by <a href="set-auto_002dload-python_002dscripts.html#set-auto_002dload-python_002dscripts">set auto-load python-scripts</a>.
<li>See <a href="objfile_002dgdb_002egdb-file.html#objfile_002dgdb_002egdb-file">objfile-gdb.gdb file</a>, controlled by <a href="set-auto_002dload-gdb_002dscripts.html#set-auto_002dload-gdb_002dscripts">set auto-load gdb-scripts</a>.
<li>See <a href="dotdebug_005fgdb_005fscripts-section.html#dotdebug_005fgdb_005fscripts-section">dotdebug_gdb_scripts section</a>,
controlled by <a href="set-auto_002dload-python_002dscripts.html#set-auto_002dload-python_002dscripts">set auto-load python-scripts</a>.
<li>See <a href="Init-File-in-the-Current-Directory.html#Init-File-in-the-Current-Directory">Init File in the Current Directory</a>,
controlled by <a href="set-auto_002dload-local_002dgdbinit.html#set-auto_002dload-local_002dgdbinit">set auto-load local-gdbinit</a>.
<li>See <a href="libthread_005fdb_002eso_002e1-file.html#libthread_005fdb_002eso_002e1-file">libthread_db.so.1 file</a>, controlled by <a href="set-auto_002dload-libthread_002ddb.html#set-auto_002dload-libthread_002ddb">set auto-load libthread-db</a>.
</ul>
<p>These are <span class="sc">gdb</span> control commands for the auto-loading:
<p><table summary=""><tr align="left"><td valign="top" width="50%">See <a href="set-auto_002dload-off.html#set-auto_002dload-off">set auto-load off</a>.
</td><td valign="top" width="50%">Disable auto-loading globally.
<br></td></tr><tr align="left"><td valign="top" width="50%">See <a href="show-auto_002dload.html#show-auto_002dload">show auto-load</a>.
</td><td valign="top" width="50%">Show setting of all kinds of files.
<br></td></tr><tr align="left"><td valign="top" width="50%">See <a href="info-auto_002dload.html#info-auto_002dload">info auto-load</a>.
</td><td valign="top" width="50%">Show state of all kinds of files.
<br></td></tr><tr align="left"><td valign="top" width="50%">See <a href="set-auto_002dload-gdb_002dscripts.html#set-auto_002dload-gdb_002dscripts">set auto-load gdb-scripts</a>.
</td><td valign="top" width="50%">Control for <span class="sc">gdb</span> command scripts.
<br></td></tr><tr align="left"><td valign="top" width="50%">See <a href="show-auto_002dload-gdb_002dscripts.html#show-auto_002dload-gdb_002dscripts">show auto-load gdb-scripts</a>.
</td><td valign="top" width="50%">Show setting of <span class="sc">gdb</span> command scripts.
<br></td></tr><tr align="left"><td valign="top" width="50%">See <a href="info-auto_002dload-gdb_002dscripts.html#info-auto_002dload-gdb_002dscripts">info auto-load gdb-scripts</a>.
</td><td valign="top" width="50%">Show state of <span class="sc">gdb</span> command scripts.
<br></td></tr><tr align="left"><td valign="top" width="50%">See <a href="set-auto_002dload-python_002dscripts.html#set-auto_002dload-python_002dscripts">set auto-load python-scripts</a>.
</td><td valign="top" width="50%">Control for <span class="sc">gdb</span> Python scripts.
<br></td></tr><tr align="left"><td valign="top" width="50%">See <a href="show-auto_002dload-python_002dscripts.html#show-auto_002dload-python_002dscripts">show auto-load python-scripts</a>.
</td><td valign="top" width="50%">Show setting of <span class="sc">gdb</span> Python scripts.
<br></td></tr><tr align="left"><td valign="top" width="50%">See <a href="info-auto_002dload-python_002dscripts.html#info-auto_002dload-python_002dscripts">info auto-load python-scripts</a>.
</td><td valign="top" width="50%">Show state of <span class="sc">gdb</span> Python scripts.
<br></td></tr><tr align="left"><td valign="top" width="50%">See <a href="set-auto_002dload-scripts_002ddirectory.html#set-auto_002dload-scripts_002ddirectory">set auto-load scripts-directory</a>.
</td><td valign="top" width="50%">Control for <span class="sc">gdb</span> auto-loaded scripts location.
<br></td></tr><tr align="left"><td valign="top" width="50%">See <a href="show-auto_002dload-scripts_002ddirectory.html#show-auto_002dload-scripts_002ddirectory">show auto-load scripts-directory</a>.
</td><td valign="top" width="50%">Show <span class="sc">gdb</span> auto-loaded scripts location.
<br></td></tr><tr align="left"><td valign="top" width="50%">See <a href="set-auto_002dload-local_002dgdbinit.html#set-auto_002dload-local_002dgdbinit">set auto-load local-gdbinit</a>.
</td><td valign="top" width="50%">Control for init file in the current directory.
<br></td></tr><tr align="left"><td valign="top" width="50%">See <a href="show-auto_002dload-local_002dgdbinit.html#show-auto_002dload-local_002dgdbinit">show auto-load local-gdbinit</a>.
</td><td valign="top" width="50%">Show setting of init file in the current directory.
<br></td></tr><tr align="left"><td valign="top" width="50%">See <a href="info-auto_002dload-local_002dgdbinit.html#info-auto_002dload-local_002dgdbinit">info auto-load local-gdbinit</a>.
</td><td valign="top" width="50%">Show state of init file in the current directory.
<br></td></tr><tr align="left"><td valign="top" width="50%">See <a href="set-auto_002dload-libthread_002ddb.html#set-auto_002dload-libthread_002ddb">set auto-load libthread-db</a>.
</td><td valign="top" width="50%">Control for thread debugging library.
<br></td></tr><tr align="left"><td valign="top" width="50%">See <a href="show-auto_002dload-libthread_002ddb.html#show-auto_002dload-libthread_002ddb">show auto-load libthread-db</a>.
</td><td valign="top" width="50%">Show setting of thread debugging library.
<br></td></tr><tr align="left"><td valign="top" width="50%">See <a href="info-auto_002dload-libthread_002ddb.html#info-auto_002dload-libthread_002ddb">info auto-load libthread-db</a>.
</td><td valign="top" width="50%">Show state of thread debugging library.
<br></td></tr><tr align="left"><td valign="top" width="50%">See <a href="set-auto_002dload-safe_002dpath.html#set-auto_002dload-safe_002dpath">set auto-load safe-path</a>.
</td><td valign="top" width="50%">Control directories trusted for automatic loading.
<br></td></tr><tr align="left"><td valign="top" width="50%">See <a href="show-auto_002dload-safe_002dpath.html#show-auto_002dload-safe_002dpath">show auto-load safe-path</a>.
</td><td valign="top" width="50%">Show directories trusted for automatic loading.
<br></td></tr><tr align="left"><td valign="top" width="50%">See <a href="add_002dauto_002dload_002dsafe_002dpath.html#add_002dauto_002dload_002dsafe_002dpath">add-auto-load-safe-path</a>.
</td><td valign="top" width="50%">Add directory trusted for automatic loading.
<br></td></tr></table>
<ul class="menu">
<li><a accesskey="1" href="Init-File-in-the-Current-Directory.html#Init-File-in-the-Current-Directory">Init File in the Current Directory</a>: &lsquo;<samp><span class="samp">set/show/info auto-load local-gdbinit</span></samp>&rsquo;
<li><a accesskey="2" href="libthread_005fdb_002eso_002e1-file.html#libthread_005fdb_002eso_002e1-file">libthread_db.so.1 file</a>: &lsquo;<samp><span class="samp">set/show/info auto-load libthread-db</span></samp>&rsquo;
<li><a accesskey="3" href="objfile_002dgdb_002egdb-file.html#objfile_002dgdb_002egdb-file">objfile-gdb.gdb file</a>: &lsquo;<samp><span class="samp">set/show/info auto-load gdb-script</span></samp>&rsquo;
<li><a accesskey="4" href="Auto_002dloading-safe-path.html#Auto_002dloading-safe-path">Auto-loading safe path</a>: &lsquo;<samp><span class="samp">set/show/info auto-load safe-path</span></samp>&rsquo;
<li><a accesskey="5" href="Auto_002dloading-verbose-mode.html#Auto_002dloading-verbose-mode">Auto-loading verbose mode</a>: &lsquo;<samp><span class="samp">set/show debug auto-load</span></samp>&rsquo;
See <a href="Python-Auto_002dloading.html#Python-Auto_002dloading">Python Auto-loading</a>.
</ul>
</body></html>

View file

@ -0,0 +1,103 @@
<html lang="en">
<head>
<title>Automatic Overlay Debugging - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Overlays.html#Overlays" title="Overlays">
<link rel="prev" href="Overlay-Commands.html#Overlay-Commands" title="Overlay Commands">
<link rel="next" href="Overlay-Sample-Program.html#Overlay-Sample-Program" title="Overlay Sample Program">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Automatic-Overlay-Debugging"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Overlay-Sample-Program.html#Overlay-Sample-Program">Overlay Sample Program</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Overlay-Commands.html#Overlay-Commands">Overlay Commands</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Overlays.html#Overlays">Overlays</a>
<hr>
</div>
<h3 class="section">14.3 Automatic Overlay Debugging</h3>
<p><a name="index-automatic-overlay-debugging-847"></a>
<span class="sc">gdb</span> can automatically track which overlays are mapped and which
are not, given some simple co-operation from the overlay manager in the
inferior. If you enable automatic overlay debugging with the
<code>overlay auto</code> command (see <a href="Overlay-Commands.html#Overlay-Commands">Overlay Commands</a>), <span class="sc">gdb</span>
looks in the inferior's memory for certain variables describing the
current state of the overlays.
<p>Here are the variables your overlay manager must define to support
<span class="sc">gdb</span>'s automatic overlay debugging:
<dl>
<dt><code>_ovly_table</code>:<dd>This variable must be an array of the following structures:
<pre class="smallexample"> struct
{
/* The overlay's mapped address. */
unsigned long vma;
/* The size of the overlay, in bytes. */
unsigned long size;
/* The overlay's load address. */
unsigned long lma;
/* Non-zero if the overlay is currently mapped;
zero otherwise. */
unsigned long mapped;
}
</pre>
<br><dt><code>_novlys</code>:<dd>This variable must be a four-byte signed integer, holding the total
number of elements in <code>_ovly_table</code>.
</dl>
<p>To decide whether a particular overlay is mapped or not, <span class="sc">gdb</span>
looks for an entry in <code>_ovly_table</code><!-- /@w --> whose <code>vma</code> and
<code>lma</code> members equal the VMA and LMA of the overlay's section in the
executable file. When <span class="sc">gdb</span> finds a matching entry, it consults
the entry's <code>mapped</code> member to determine whether the overlay is
currently mapped.
<p>In addition, your overlay manager may define a function called
<code>_ovly_debug_event</code>. If this function is defined, <span class="sc">gdb</span>
will silently set a breakpoint there. If the overlay manager then
calls this function whenever it has changed the overlay table, this
will enable <span class="sc">gdb</span> to accurately keep track of which overlays
are in program memory, and update any breakpoints that may be set
in overlays. This will allow breakpoints to work even if the
overlays are kept in ROM or other non-writable memory while they
are not being executed.
</body></html>

View file

@ -0,0 +1,65 @@
<html lang="en">
<head>
<title>Automatically - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Setting.html#Setting" title="Setting">
<link rel="prev" href="Manually.html#Manually" title="Manually">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Automatically"></a>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Manually.html#Manually">Manually</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Setting.html#Setting">Setting</a>
<hr>
</div>
<h4 class="subsection">15.1.3 Having <span class="sc">gdb</span> Infer the Source Language</h4>
<p>To have <span class="sc">gdb</span> set the working language automatically, use
&lsquo;<samp><span class="samp">set language local</span></samp>&rsquo; or &lsquo;<samp><span class="samp">set language auto</span></samp>&rsquo;. <span class="sc">gdb</span>
then infers the working language. That is, when your program stops in a
frame (usually by encountering a breakpoint), <span class="sc">gdb</span> sets the
working language to the language recorded for the function in that
frame. If the language for a frame is unknown (that is, if the function
or block corresponding to the frame was defined in a source file that
does not have a recognized extension), the current working language is
not changed, and <span class="sc">gdb</span> issues a warning.
<p>This may not seem necessary for most programs, which are written
entirely in one source language. However, program modules and libraries
written in one source language can be used by a main program written in
a different source language. Using &lsquo;<samp><span class="samp">set language auto</span></samp>&rsquo; in this
case frees you from having to set the working language manually.
</body></html>

View file

@ -0,0 +1,79 @@
<html lang="en">
<head>
<title>BSD libkvm Interface - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Native.html#Native" title="Native">
<link rel="prev" href="HP_002dUX.html#HP_002dUX" title="HP-UX">
<link rel="next" href="SVR4-Process-Information.html#SVR4-Process-Information" title="SVR4 Process Information">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="BSD-libkvm-Interface"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="SVR4-Process-Information.html#SVR4-Process-Information">SVR4 Process Information</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="HP_002dUX.html#HP_002dUX">HP-UX</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Native.html#Native">Native</a>
<hr>
</div>
<h4 class="subsection">21.1.2 BSD libkvm Interface</h4>
<p><a name="index-libkvm-1253"></a><a name="index-kernel-memory-image-1254"></a><a name="index-kernel-crash-dump-1255"></a>
BSD-derived systems (FreeBSD/NetBSD/OpenBSD) have a kernel memory
interface that provides a uniform interface for accessing kernel virtual
memory images, including live systems and crash dumps. <span class="sc">gdb</span>
uses this interface to allow you to debug live kernels and kernel crash
dumps on many native BSD configurations. This is implemented as a
special <code>kvm</code> debugging target. For debugging a live system, load
the currently running kernel into <span class="sc">gdb</span> and connect to the
<code>kvm</code> target:
<pre class="smallexample"> (gdb) <b>target kvm</b>
</pre>
<p>For debugging crash dumps, provide the file name of the crash dump as an
argument:
<pre class="smallexample"> (gdb) <b>target kvm /var/crash/bsd.0</b>
</pre>
<p>Once connected to the <code>kvm</code> target, the following commands are
available:
<a name="index-kvm-1256"></a>
<dl><dt><code>kvm pcb</code><dd>Set current context from the <dfn>Process Control Block</dfn> (PCB) address.
<br><dt><code>kvm proc</code><dd>Set current context from proc address. This command isn't available on
modern FreeBSD systems.
</dl>
</body></html>

View file

@ -0,0 +1,119 @@
<html lang="en">
<head>
<title>Background Execution - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Thread-Stops.html#Thread-Stops" title="Thread Stops">
<link rel="prev" href="Non_002dStop-Mode.html#Non_002dStop-Mode" title="Non-Stop Mode">
<link rel="next" href="Thread_002dSpecific-Breakpoints.html#Thread_002dSpecific-Breakpoints" title="Thread-Specific Breakpoints">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Background-Execution"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Thread_002dSpecific-Breakpoints.html#Thread_002dSpecific-Breakpoints">Thread-Specific Breakpoints</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Non_002dStop-Mode.html#Non_002dStop-Mode">Non-Stop Mode</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Thread-Stops.html#Thread-Stops">Thread Stops</a>
<hr>
</div>
<h4 class="subsection">5.5.3 Background Execution</h4>
<p><a name="index-foreground-execution-355"></a><a name="index-background-execution-356"></a><a name="index-asynchronous-execution-357"></a><a name="index-execution_002c-foreground_002c-background-and-asynchronous-358"></a>
<span class="sc">gdb</span>'s execution commands have two variants: the normal
foreground (synchronous) behavior, and a background
(asynchronous) behavior. In foreground execution, <span class="sc">gdb</span> waits for
the program to report that some thread has stopped before prompting for
another command. In background execution, <span class="sc">gdb</span> immediately gives
a command prompt so that you can issue other commands while your program runs.
<p>You need to explicitly enable asynchronous mode before you can use
background execution commands. You can use these commands to
manipulate the asynchronous mode setting:
<a name="index-set-target_002dasync-359"></a>
<dl><dt><code>set target-async on</code><dd>Enable asynchronous mode.
<br><dt><code>set target-async off</code><dd>Disable asynchronous mode.
<a name="index-show-target_002dasync-360"></a><br><dt><code>show target-async</code><dd>Show the current target-async setting.
</dl>
<p>If the target doesn't support async mode, <span class="sc">gdb</span> issues an error
message if you attempt to use the background execution commands.
<p>To specify background execution, add a <code>&amp;</code> to the command. For example,
the background form of the <code>continue</code> command is <code>continue&amp;</code>, or
just <code>c&amp;</code>. The execution commands that accept background execution
are:
<a name="index-run_0026-361"></a>
<dl><dt><code>run</code><dd>See <a href="Starting.html#Starting">Starting your Program</a>.
<br><dt><code>attach</code><dd><a name="index-attach_0026-362"></a>See <a href="Attach.html#Attach">Debugging an Already-running Process</a>.
<br><dt><code>step</code><dd><a name="index-step_0026-363"></a>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">step</a>.
<br><dt><code>stepi</code><dd><a name="index-stepi_0026-364"></a>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">stepi</a>.
<br><dt><code>next</code><dd><a name="index-next_0026-365"></a>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">next</a>.
<br><dt><code>nexti</code><dd><a name="index-nexti_0026-366"></a>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">nexti</a>.
<br><dt><code>continue</code><dd><a name="index-continue_0026-367"></a>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">continue</a>.
<br><dt><code>finish</code><dd><a name="index-finish_0026-368"></a>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">finish</a>.
<br><dt><code>until</code><dd><a name="index-until_0026-369"></a>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">until</a>.
</dl>
<p>Background execution is especially useful in conjunction with non-stop
mode for debugging programs with multiple threads; see <a href="Non_002dStop-Mode.html#Non_002dStop-Mode">Non-Stop Mode</a>.
However, you can also use these commands in the normal all-stop mode with
the restriction that you cannot issue another execution command until the
previous one finishes. Examples of commands that are valid in all-stop
mode while the program is running include <code>help</code> and <code>info break</code>.
<p>You can interrupt your program while it is running in the background by
using the <code>interrupt</code> command.
<a name="index-interrupt-370"></a>
<dl><dt><code>interrupt</code><dt><code>interrupt -a</code><dd>
Suspend execution of the running program. In all-stop mode,
<code>interrupt</code> stops the whole process, but in non-stop mode, it stops
only the current thread. To stop the whole program in non-stop mode,
use <code>interrupt -a</code>.
</dl>
</body></html>

View file

@ -0,0 +1,187 @@
<html lang="en">
<head>
<title>Backtrace - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Stack.html#Stack" title="Stack">
<link rel="prev" href="Frames.html#Frames" title="Frames">
<link rel="next" href="Selection.html#Selection" title="Selection">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Backtrace"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Selection.html#Selection">Selection</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Frames.html#Frames">Frames</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Stack.html#Stack">Stack</a>
<hr>
</div>
<h3 class="section">8.2 Backtraces</h3>
<p><a name="index-traceback-444"></a><a name="index-call-stack-traces-445"></a>A backtrace is a summary of how your 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.
<a name="index-backtrace-446"></a>
<a name="index-bt-_0040r_007b_0028_0040code_007bbacktrace_007d_0029_007d-447"></a>
<dl><dt><code>backtrace</code><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>Ctrl-c</kbd>.
<br><dt><code>backtrace </code><var>n</var><dt><code>bt </code><var>n</var><dd>Similar, but print only the innermost <var>n</var> frames.
<br><dt><code>backtrace -</code><var>n</var><dt><code>bt -</code><var>n</var><dd>Similar, but print only the outermost <var>n</var> frames.
<br><dt><code>backtrace full</code><dt><code>bt full</code><dt><code>bt full </code><var>n</var><dt><code>bt full -</code><var>n</var><dd>Print the values of the local variables also. <var>n</var> specifies the
number of frames to print, as described above.
</dl>
<p><a name="index-where-448"></a><a name="index-info-stack-449"></a>The names <code>where</code> and <code>info stack</code> (abbreviated <code>info s</code>)
are additional aliases for <code>backtrace</code>.
<p><a name="index-multiple-threads_002c-backtrace-450"></a>In a multi-threaded program, <span class="sc">gdb</span> by default shows the
backtrace only for the current thread. To display the backtrace for
several or all of the threads, use the command <code>thread apply</code>
(see <a href="Threads.html#Threads">thread apply</a>). For example, if you type <kbd>thread
apply all backtrace</kbd>, <span class="sc">gdb</span> will display the backtrace for all
the threads; this is handy when you debug a core dump of a
multi-threaded program.
<p>Each line in the backtrace shows the frame number and the function name.
The program counter value is also shown&mdash;unless you use <code>set
print address off</code>. The backtrace also shows the source file name and
line number, as well as the arguments to the function. The program
counter value is omitted if it is at the beginning of the code for that
line number.
<p>Here is an example of a backtrace. It was made with the command
&lsquo;<samp><span class="samp">bt 3</span></samp>&rsquo;, so it shows the innermost three frames.
<pre class="smallexample"> #0 m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8)
at builtin.c:993
#1 0x6e38 in expand_macro (sym=0x2b600, data=...) at macro.c:242
#2 0x6840 in expand_token (obs=0x0, t=177664, td=0xf7fffb08)
at macro.c:71
(More stack frames follow...)
</pre>
<p class="noindent">The display for frame zero does not begin with a program counter
value, indicating that your program has stopped at the beginning of the
code for line <code>993</code> of <code>builtin.c</code>.
<p class="noindent">The value of parameter <code>data</code> in frame 1 has been replaced by
<code>...</code>. By default, <span class="sc">gdb</span> prints the value of a parameter
only if it is a scalar (integer, pointer, enumeration, etc). See command
<kbd>set print frame-arguments</kbd> in <a href="Print-Settings.html#Print-Settings">Print Settings</a> for more details
on how to configure the way function parameter values are printed.
<p><a name="index-optimized-out_002c-in-backtrace-451"></a><a name="index-function-call-arguments_002c-optimized-out-452"></a>If your program was compiled with optimizations, some compilers will
optimize away arguments passed to functions if those arguments are
never used after the call. Such optimizations generate code that
passes arguments through registers, but doesn't store those arguments
in the stack frame. <span class="sc">gdb</span> has no way of displaying such
arguments in stack frames other than the innermost one. Here's what
such a backtrace might look like:
<pre class="smallexample"> #0 m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8)
at builtin.c:993
#1 0x6e38 in expand_macro (sym=&lt;optimized out&gt;) at macro.c:242
#2 0x6840 in expand_token (obs=0x0, t=&lt;optimized out&gt;, td=0xf7fffb08)
at macro.c:71
(More stack frames follow...)
</pre>
<p class="noindent">The values of arguments that were not saved in their stack frames are
shown as &lsquo;<samp><span class="samp">&lt;optimized out&gt;</span></samp>&rsquo;.
<p>If you need to display the values of such optimized-out arguments,
either deduce that from other variables whose values depend on the one
you are interested in, or recompile without optimizations.
<p><a name="index-backtrace-beyond-_0040code_007bmain_007d-function-453"></a><a name="index-program-entry-point-454"></a><a name="index-startup-code_002c-and-backtrace-455"></a>Most programs have a standard user entry point&mdash;a place where system
libraries and startup code transition into user code. For C this is
<code>main</code><a rel="footnote" href="#fn-1" name="fnd-1"><sup>1</sup></a>.
When <span class="sc">gdb</span> finds the entry function in a backtrace
it will terminate the backtrace, to avoid tracing into highly
system-specific (and generally uninteresting) code.
<p>If you need to examine the startup code, or limit the number of levels
in a backtrace, you can change this behavior:
<dl>
<dt><code>set backtrace past-main</code><dt><code>set backtrace past-main on</code><dd><a name="index-set-backtrace-456"></a>Backtraces will continue past the user entry point.
<br><dt><code>set backtrace past-main off</code><dd>Backtraces will stop when they encounter the user entry point. This is the
default.
<br><dt><code>show backtrace past-main</code><dd><a name="index-show-backtrace-457"></a>Display the current user entry point backtrace policy.
<br><dt><code>set backtrace past-entry</code><dt><code>set backtrace past-entry on</code><dd>Backtraces will continue past the internal entry point of an application.
This entry point is encoded by the linker when the application is built,
and is likely before the user entry point <code>main</code> (or equivalent) is called.
<br><dt><code>set backtrace past-entry off</code><dd>Backtraces will stop when they encounter the internal entry point of an
application. This is the default.
<br><dt><code>show backtrace past-entry</code><dd>Display the current internal entry point backtrace policy.
<br><dt><code>set backtrace limit </code><var>n</var><dt><code>set backtrace limit 0</code><dd><a name="index-backtrace-limit-458"></a>Limit the backtrace to <var>n</var> levels. A value of zero means
unlimited.
<br><dt><code>show backtrace limit</code><dd>Display the current limit on backtrace levels.
</dl>
<p>You can control how file names are displayed.
<dl>
<dt><code>set filename-display</code><dt><code>set filename-display relative</code><dd><a name="index-filename_002ddisplay-459"></a>Display file names relative to the compilation directory. This is the default.
<br><dt><code>set filename-display basename</code><dd>Display only basename of a filename.
<br><dt><code>set filename-display absolute</code><dd>Display an absolute filename.
<br><dt><code>show filename-display</code><dd>Show the current way to display filenames.
</dl>
<div class="footnote">
<hr>
<h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small>
Note that embedded programs (the so-called &ldquo;free-standing&rdquo;
environment) are not required to have a <code>main</code> function as the
entry point. They could even have multiple entry points.</p>
<hr></div>
</body></html>

View file

@ -0,0 +1,296 @@
<html lang="en">
<head>
<title>Basic Python - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Python-API.html#Python-API" title="Python API">
<link rel="next" href="Exception-Handling.html#Exception-Handling" title="Exception Handling">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Basic-Python"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Exception-Handling.html#Exception-Handling">Exception Handling</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Python-API.html#Python-API">Python API</a>
<hr>
</div>
<h5 class="subsubsection">23.2.2.1 Basic Python</h5>
<p><a name="index-python-functions-1718"></a><a name="index-python-module-1719"></a><a name="index-gdb-module-1720"></a><span class="sc">gdb</span> introduces a new Python module, named <code>gdb</code>. All
methods and classes added by <span class="sc">gdb</span> are placed in this module.
<span class="sc">gdb</span> automatically <code>import</code>s the <code>gdb</code> module for
use in all scripts evaluated by the <code>python</code> command.
<p><a name="index-gdb_002ePYTHONDIR-1721"></a>
<div class="defun">
&mdash; Variable: <b>gdb.PYTHONDIR</b><var><a name="index-gdb_002ePYTHONDIR-1722"></a></var><br>
<blockquote><p>A string containing the python directory (see <a href="Python.html#Python">Python</a>).
</p></blockquote></div>
<p><a name="index-gdb_002eexecute-1723"></a>
<div class="defun">
&mdash; Function: <b>gdb.execute</b> (<var>command </var><span class="roman">[</span><var>, from_tty </var><span class="roman">[</span><var>, to_string</var><span class="roman">]]</span>)<var><a name="index-gdb_002eexecute-1724"></a></var><br>
<blockquote><p>Evaluate <var>command</var>, a string, as a <span class="sc">gdb</span> CLI command.
If a GDB exception happens while <var>command</var> runs, it is
translated as described in <a href="Exception-Handling.html#Exception-Handling">Exception Handling</a>.
<p><var>from_tty</var> specifies whether <span class="sc">gdb</span> ought to consider this
command as having originated from the user invoking it interactively.
It must be a boolean value. If omitted, it defaults to <code>False</code>.
<p>By default, any output produced by <var>command</var> is sent to
<span class="sc">gdb</span>'s standard output. If the <var>to_string</var> parameter is
<code>True</code>, then output will be collected by <code>gdb.execute</code> and
returned as a string. The default is <code>False</code>, in which case the
return value is <code>None</code>. If <var>to_string</var> is <code>True</code>, the
<span class="sc">gdb</span> virtual terminal will be temporarily set to unlimited width
and height, and its pagination will be disabled; see <a href="Screen-Size.html#Screen-Size">Screen Size</a>.
</p></blockquote></div>
<p><a name="index-gdb_002ebreakpoints-1725"></a>
<div class="defun">
&mdash; Function: <b>gdb.breakpoints</b> ()<var><a name="index-gdb_002ebreakpoints-1726"></a></var><br>
<blockquote><p>Return a sequence holding all of <span class="sc">gdb</span>'s breakpoints.
See <a href="Breakpoints-In-Python.html#Breakpoints-In-Python">Breakpoints In Python</a>, for more information.
</p></blockquote></div>
<p><a name="index-gdb_002eparameter-1727"></a>
<div class="defun">
&mdash; Function: <b>gdb.parameter</b> (<var>parameter</var>)<var><a name="index-gdb_002eparameter-1728"></a></var><br>
<blockquote><p>Return the value of a <span class="sc">gdb</span> parameter. <var>parameter</var> is a
string naming the parameter to look up; <var>parameter</var> may contain
spaces if the parameter has a multi-part name. For example,
&lsquo;<samp><span class="samp">print object</span></samp>&rsquo; is a valid parameter name.
<p>If the named parameter does not exist, this function throws a
<code>gdb.error</code> (see <a href="Exception-Handling.html#Exception-Handling">Exception Handling</a>). Otherwise, the
parameter's value is converted to a Python value of the appropriate
type, and returned.
</p></blockquote></div>
<p><a name="index-gdb_002ehistory-1729"></a>
<div class="defun">
&mdash; Function: <b>gdb.history</b> (<var>number</var>)<var><a name="index-gdb_002ehistory-1730"></a></var><br>
<blockquote><p>Return a value from <span class="sc">gdb</span>'s value history (see <a href="Value-History.html#Value-History">Value History</a>). <var>number</var> indicates which history element to return.
If <var>number</var> is negative, then <span class="sc">gdb</span> will take its absolute value
and count backward from the last element (i.e., the most recent element) to
find the value to return. If <var>number</var> is zero, then <span class="sc">gdb</span> will
return the most recent element. If the element specified by <var>number</var>
doesn't exist in the value history, a <code>gdb.error</code> exception will be
raised.
<p>If no exception is raised, the return value is always an instance of
<code>gdb.Value</code> (see <a href="Values-From-Inferior.html#Values-From-Inferior">Values From Inferior</a>).
</p></blockquote></div>
<p><a name="index-gdb_002eparse_005fand_005feval-1731"></a>
<div class="defun">
&mdash; Function: <b>gdb.parse_and_eval</b> (<var>expression</var>)<var><a name="index-gdb_002eparse_005fand_005feval-1732"></a></var><br>
<blockquote><p>Parse <var>expression</var> as an expression in the current language,
evaluate it, and return the result as a <code>gdb.Value</code>.
<var>expression</var> must be a string.
<p>This function can be useful when implementing a new command
(see <a href="Commands-In-Python.html#Commands-In-Python">Commands In Python</a>), as it provides a way to parse the
command's argument as an expression. It is also useful simply to
compute values, for example, it is the only way to get the value of a
convenience variable (see <a href="Convenience-Vars.html#Convenience-Vars">Convenience Vars</a>) as a <code>gdb.Value</code>.
</p></blockquote></div>
<p><a name="index-gdb_002efind_005fpc_005fline-1733"></a>
<div class="defun">
&mdash; Function: <b>gdb.find_pc_line</b> (<var>pc</var>)<var><a name="index-gdb_002efind_005fpc_005fline-1734"></a></var><br>
<blockquote><p>Return the <code>gdb.Symtab_and_line</code> object corresponding to the
<var>pc</var> value. See <a href="Symbol-Tables-In-Python.html#Symbol-Tables-In-Python">Symbol Tables In Python</a>. If an invalid
value of <var>pc</var> is passed as an argument, then the <code>symtab</code> and
<code>line</code> attributes of the returned <code>gdb.Symtab_and_line</code> object
will be <code>None</code> and 0 respectively.
</p></blockquote></div>
<p><a name="index-gdb_002epost_005fevent-1735"></a>
<div class="defun">
&mdash; Function: <b>gdb.post_event</b> (<var>event</var>)<var><a name="index-gdb_002epost_005fevent-1736"></a></var><br>
<blockquote><p>Put <var>event</var>, a callable object taking no arguments, into
<span class="sc">gdb</span>'s internal event queue. This callable will be invoked at
some later point, during <span class="sc">gdb</span>'s event processing. Events
posted using <code>post_event</code> will be run in the order in which they
were posted; however, there is no way to know when they will be
processed relative to other events inside <span class="sc">gdb</span>.
<p><span class="sc">gdb</span> is not thread-safe. If your Python program uses multiple
threads, you must be careful to only call <span class="sc">gdb</span>-specific
functions in the main <span class="sc">gdb</span> thread. <code>post_event</code> ensures
this. For example:
<pre class="smallexample"> (gdb) python
&gt;import threading
&gt;
&gt;class Writer():
&gt; def __init__(self, message):
&gt; self.message = message;
&gt; def __call__(self):
&gt; gdb.write(self.message)
&gt;
&gt;class MyThread1 (threading.Thread):
&gt; def run (self):
&gt; gdb.post_event(Writer("Hello "))
&gt;
&gt;class MyThread2 (threading.Thread):
&gt; def run (self):
&gt; gdb.post_event(Writer("World\n"))
&gt;
&gt;MyThread1().start()
&gt;MyThread2().start()
&gt;end
(gdb) Hello World
</pre>
</blockquote></div>
<p><a name="index-gdb_002ewrite-1737"></a>
<div class="defun">
&mdash; Function: <b>gdb.write</b> (<var>string </var><span class="roman">[</span><var>, stream</var>])<var><a name="index-gdb_002ewrite-1738"></a></var><br>
<blockquote><p>Print a string to <span class="sc">gdb</span>'s paginated output stream. The
optional <var>stream</var> determines the stream to print to. The default
stream is <span class="sc">gdb</span>'s standard output stream. Possible stream
values are:
<a name="index-STDOUT-1739"></a>
<a name="index-gdb_002eSTDOUT-1740"></a>
<dl><dt><code>gdb.STDOUT</code><dd><span class="sc">gdb</span>'s standard output stream.
<p><a name="index-STDERR-1741"></a><a name="index-gdb_002eSTDERR-1742"></a><br><dt><code>gdb.STDERR</code><dd><span class="sc">gdb</span>'s standard error stream.
<p><a name="index-STDLOG-1743"></a><a name="index-gdb_002eSTDLOG-1744"></a><br><dt><code>gdb.STDLOG</code><dd><span class="sc">gdb</span>'s log stream (see <a href="Logging-Output.html#Logging-Output">Logging Output</a>).
</dl>
<p>Writing to <code>sys.stdout</code> or <code>sys.stderr</code> will automatically
call this function and will automatically direct the output to the
relevant stream.
</p></blockquote></div>
<p><a name="index-gdb_002eflush-1745"></a>
<div class="defun">
&mdash; Function: <b>gdb.flush</b> ()<var><a name="index-gdb_002eflush-1746"></a></var><br>
<blockquote><p>Flush the buffer of a <span class="sc">gdb</span> paginated stream so that the
contents are displayed immediately. <span class="sc">gdb</span> will flush the
contents of a stream automatically when it encounters a newline in the
buffer. The optional <var>stream</var> determines the stream to flush. The
default stream is <span class="sc">gdb</span>'s standard output stream. Possible
stream values are:
<a name="index-STDOUT-1747"></a>
<a name="index-gdb_002eSTDOUT-1748"></a>
<dl><dt><code>gdb.STDOUT</code><dd><span class="sc">gdb</span>'s standard output stream.
<p><a name="index-STDERR-1749"></a><a name="index-gdb_002eSTDERR-1750"></a><br><dt><code>gdb.STDERR</code><dd><span class="sc">gdb</span>'s standard error stream.
<p><a name="index-STDLOG-1751"></a><a name="index-gdb_002eSTDLOG-1752"></a><br><dt><code>gdb.STDLOG</code><dd><span class="sc">gdb</span>'s log stream (see <a href="Logging-Output.html#Logging-Output">Logging Output</a>).
</dl>
<p>Flushing <code>sys.stdout</code> or <code>sys.stderr</code> will automatically
call this function for the relevant stream.
</p></blockquote></div>
<p><a name="index-gdb_002etarget_005fcharset-1753"></a>
<div class="defun">
&mdash; Function: <b>gdb.target_charset</b> ()<var><a name="index-gdb_002etarget_005fcharset-1754"></a></var><br>
<blockquote><p>Return the name of the current target character set (see <a href="Character-Sets.html#Character-Sets">Character Sets</a>). This differs from <code>gdb.parameter('target-charset')</code> in
that &lsquo;<samp><span class="samp">auto</span></samp>&rsquo; is never returned.
</p></blockquote></div>
<p><a name="index-gdb_002etarget_005fwide_005fcharset-1755"></a>
<div class="defun">
&mdash; Function: <b>gdb.target_wide_charset</b> ()<var><a name="index-gdb_002etarget_005fwide_005fcharset-1756"></a></var><br>
<blockquote><p>Return the name of the current target wide character set
(see <a href="Character-Sets.html#Character-Sets">Character Sets</a>). This differs from
<code>gdb.parameter('target-wide-charset')</code> in that &lsquo;<samp><span class="samp">auto</span></samp>&rsquo; is
never returned.
</p></blockquote></div>
<p><a name="index-gdb_002esolib_005fname-1757"></a>
<div class="defun">
&mdash; Function: <b>gdb.solib_name</b> (<var>address</var>)<var><a name="index-gdb_002esolib_005fname-1758"></a></var><br>
<blockquote><p>Return the name of the shared library holding the given <var>address</var>
as a string, or <code>None</code>.
</p></blockquote></div>
<p><a name="index-gdb_002edecode_005fline-1759"></a>
<div class="defun">
&mdash; Function: <b>gdb.decode_line</b> <span class="roman">[</span><var>expression</var><span class="roman">]</span><var><a name="index-gdb_002edecode_005fline-1760"></a></var><br>
<blockquote><p>Return locations of the line specified by <var>expression</var>, or of the
current line if no argument was given. This function returns a Python
tuple containing two elements. The first element contains a string
holding any unparsed section of <var>expression</var> (or <code>None</code> if
the expression has been fully parsed). The second element contains
either <code>None</code> or another tuple that contains all the locations
that match the expression represented as <code>gdb.Symtab_and_line</code>
objects (see <a href="Symbol-Tables-In-Python.html#Symbol-Tables-In-Python">Symbol Tables In Python</a>). If <var>expression</var> is
provided, it is decoded the way that <span class="sc">gdb</span>'s inbuilt
<code>break</code> or <code>edit</code> commands do (see <a href="Specify-Location.html#Specify-Location">Specify Location</a>).
</p></blockquote></div>
<div class="defun">
&mdash; Function: <b>gdb.prompt_hook</b> (<var>current_prompt</var>)<var><a name="index-gdb_002eprompt_005fhook-1761"></a></var><br>
<blockquote><p><a name="prompt_005fhook"></a>If <var>prompt_hook</var> is callable, <span class="sc">gdb</span> will call the method
assigned to this operation before a prompt is displayed by
<span class="sc">gdb</span>.
<p>The parameter <code>current_prompt</code> contains the current <span class="sc">gdb</span>
prompt. This method must return a Python string, or <code>None</code>. If
a string is returned, the <span class="sc">gdb</span> prompt will be set to that
string. If <code>None</code> is returned, <span class="sc">gdb</span> will continue to use
the current prompt.
<p>Some prompts cannot be substituted in <span class="sc">gdb</span>. Secondary prompts
such as those used by readline for command input, and annotation
related prompts are prohibited from being changed.
</p></blockquote></div>
</body></html>

View file

@ -0,0 +1 @@
<meta http-equiv="refresh" content="0; url=Overview.html#Binary%20Data">

View file

@ -0,0 +1,71 @@
<html lang="en">
<head>
<title>Bindable Readline Commands - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Command-Line-Editing.html#Command-Line-Editing" title="Command Line Editing">
<link rel="prev" href="Readline-Init-File.html#Readline-Init-File" title="Readline Init File">
<link rel="next" href="Readline-vi-Mode.html#Readline-vi-Mode" title="Readline vi Mode">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Bindable-Readline-Commands"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Readline-vi-Mode.html#Readline-vi-Mode">Readline vi Mode</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Readline-Init-File.html#Readline-Init-File">Readline Init File</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Command-Line-Editing.html#Command-Line-Editing">Command Line Editing</a>
<hr>
</div>
<h3 class="section">32.4 Bindable Readline Commands</h3>
<ul class="menu">
<li><a accesskey="1" href="Commands-For-Moving.html#Commands-For-Moving">Commands For Moving</a>: Moving about the line.
<li><a accesskey="2" href="Commands-For-History.html#Commands-For-History">Commands For History</a>: Getting at previous lines.
<li><a accesskey="3" href="Commands-For-Text.html#Commands-For-Text">Commands For Text</a>: Commands for changing text.
<li><a accesskey="4" href="Commands-For-Killing.html#Commands-For-Killing">Commands For Killing</a>: Commands for killing and yanking.
<li><a accesskey="5" href="Numeric-Arguments.html#Numeric-Arguments">Numeric Arguments</a>: Specifying numeric arguments, repeat counts.
<li><a accesskey="6" href="Commands-For-Completion.html#Commands-For-Completion">Commands For Completion</a>: Getting Readline to do the typing for you.
<li><a accesskey="7" href="Keyboard-Macros.html#Keyboard-Macros">Keyboard Macros</a>: Saving and re-executing typed characters
<li><a accesskey="8" href="Miscellaneous-Commands.html#Miscellaneous-Commands">Miscellaneous Commands</a>: Other miscellaneous commands.
</ul>
<p>This section describes Readline commands that may be bound to key
sequences.
Command names without an accompanying key sequence are unbound by default.
<p>In the following descriptions, <dfn>point</dfn> refers to the current cursor
position, and <dfn>mark</dfn> refers to a cursor position saved by the
<code>set-mark</code> command.
The text between the point and mark is referred to as the <dfn>region</dfn>.
</body></html>

View file

@ -0,0 +1,141 @@
<html lang="en">
<head>
<title>Blocks In Python - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Python-API.html#Python-API" title="Python API">
<link rel="prev" href="Frames-In-Python.html#Frames-In-Python" title="Frames In Python">
<link rel="next" href="Symbols-In-Python.html#Symbols-In-Python" title="Symbols In Python">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Blocks-In-Python"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Symbols-In-Python.html#Symbols-In-Python">Symbols In Python</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Frames-In-Python.html#Frames-In-Python">Frames In Python</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Python-API.html#Python-API">Python API</a>
<hr>
</div>
<h5 class="subsubsection">23.2.2.18 Accessing frame blocks from Python.</h5>
<p><a name="index-blocks-in-python-2027"></a><a name="index-gdb_002eBlock-2028"></a>
Within each frame, <span class="sc">gdb</span> maintains information on each block
stored in that frame. These blocks are organized hierarchically, and
are represented individually in Python as a <code>gdb.Block</code>.
Please see <a href="Frames-In-Python.html#Frames-In-Python">Frames In Python</a>, for a more in-depth discussion on
frames. Furthermore, see <a href="Stack.html#Stack">Examining the Stack</a>, for more
detailed technical information on <span class="sc">gdb</span>'s book-keeping of the
stack.
<p>A <code>gdb.Block</code> is iterable. The iterator returns the symbols
(see <a href="Symbols-In-Python.html#Symbols-In-Python">Symbols In Python</a>) local to the block. Python programs
should not assume that a specific block object will always contain a
given symbol, since changes in <span class="sc">gdb</span> features and
infrastructure may cause symbols move across blocks in a symbol
table.
<p>The following block-related functions are available in the <code>gdb</code>
module:
<p><a name="index-gdb_002eblock_005ffor_005fpc-2029"></a>
<div class="defun">
&mdash; Function: <b>gdb.block_for_pc</b> (<var>pc</var>)<var><a name="index-gdb_002eblock_005ffor_005fpc-2030"></a></var><br>
<blockquote><p>Return the <code>gdb.Block</code> containing the given <var>pc</var> value. If the
block cannot be found for the <var>pc</var> value specified, the function
will return <code>None</code>.
</p></blockquote></div>
<p>A <code>gdb.Block</code> object has the following methods:
<div class="defun">
&mdash; Function: <b>Block.is_valid</b> ()<var><a name="index-Block_002eis_005fvalid-2031"></a></var><br>
<blockquote><p>Returns <code>True</code> if the <code>gdb.Block</code> object is valid,
<code>False</code> if not. A block object can become invalid if the block it
refers to doesn't exist anymore in the inferior. All other
<code>gdb.Block</code> methods will throw an exception if it is invalid at
the time the method is called. The block's validity is also checked
during iteration over symbols of the block.
</p></blockquote></div>
<p>A <code>gdb.Block</code> object has the following attributes:
<div class="defun">
&mdash; Variable: <b>Block.start</b><var><a name="index-Block_002estart-2032"></a></var><br>
<blockquote><p>The start address of the block. This attribute is not writable.
</p></blockquote></div>
<div class="defun">
&mdash; Variable: <b>Block.end</b><var><a name="index-Block_002eend-2033"></a></var><br>
<blockquote><p>The end address of the block. This attribute is not writable.
</p></blockquote></div>
<div class="defun">
&mdash; Variable: <b>Block.function</b><var><a name="index-Block_002efunction-2034"></a></var><br>
<blockquote><p>The name of the block represented as a <code>gdb.Symbol</code>. If the
block is not named, then this attribute holds <code>None</code>. This
attribute is not writable.
</p></blockquote></div>
<div class="defun">
&mdash; Variable: <b>Block.superblock</b><var><a name="index-Block_002esuperblock-2035"></a></var><br>
<blockquote><p>The block containing this block. If this parent block does not exist,
this attribute holds <code>None</code>. This attribute is not writable.
</p></blockquote></div>
<div class="defun">
&mdash; Variable: <b>Block.global_block</b><var><a name="index-Block_002eglobal_005fblock-2036"></a></var><br>
<blockquote><p>The global block associated with this block. This attribute is not
writable.
</p></blockquote></div>
<div class="defun">
&mdash; Variable: <b>Block.static_block</b><var><a name="index-Block_002estatic_005fblock-2037"></a></var><br>
<blockquote><p>The static block associated with this block. This attribute is not
writable.
</p></blockquote></div>
<div class="defun">
&mdash; Variable: <b>Block.is_global</b><var><a name="index-Block_002eis_005fglobal-2038"></a></var><br>
<blockquote><p><code>True</code> if the <code>gdb.Block</code> object is a global block,
<code>False</code> if not. This attribute is not
writable.
</p></blockquote></div>
<div class="defun">
&mdash; Variable: <b>Block.is_static</b><var><a name="index-Block_002eis_005fstatic-2039"></a></var><br>
<blockquote><p><code>True</code> if the <code>gdb.Block</code> object is a static block,
<code>False</code> if not. This attribute is not writable.
</p></blockquote></div>
</body></html>

View file

@ -0,0 +1,124 @@
<html lang="en">
<head>
<title>Bootstrapping - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Remote-Stub.html#Remote-Stub" title="Remote Stub">
<link rel="prev" href="Stub-Contents.html#Stub-Contents" title="Stub Contents">
<link rel="next" href="Debug-Session.html#Debug-Session" title="Debug Session">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Bootstrapping"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Debug-Session.html#Debug-Session">Debug Session</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Stub-Contents.html#Stub-Contents">Stub Contents</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Remote-Stub.html#Remote-Stub">Remote Stub</a>
<hr>
</div>
<h4 class="subsection">20.5.2 What You Must Do for the Stub</h4>
<p><a name="index-remote-stub_002c-support-routines-1244"></a>The debugging stubs that come with <span class="sc">gdb</span> are set up for a particular
chip architecture, but they have no information about the rest of your
debugging target machine.
<p>First of all you need to tell the stub how to communicate with the
serial port.
<dl>
<dt><code>int getDebugChar()</code><dd><a name="index-getDebugChar-1245"></a>Write this subroutine to read a single character from the serial port.
It may be identical to <code>getchar</code> for your target system; a
different name is used to allow you to distinguish the two if you wish.
<br><dt><code>void putDebugChar(int)</code><dd><a name="index-putDebugChar-1246"></a>Write this subroutine to write a single character to the serial port.
It may be identical to <code>putchar</code> for your target system; a
different name is used to allow you to distinguish the two if you wish.
</dl>
<p><a name="index-control-C_002c-and-remote-debugging-1247"></a><a name="index-interrupting-remote-targets-1248"></a>If you want <span class="sc">gdb</span> to be able to stop your program while it is
running, you need to use an interrupt-driven serial driver, and arrange
for it to stop when it receives a <code>^C</code> (&lsquo;<samp><span class="samp">\003</span></samp>&rsquo;, the control-C
character). That is the character which <span class="sc">gdb</span> uses to tell the
remote system to stop.
<p>Getting the debugging target to return the proper status to <span class="sc">gdb</span>
probably requires changes to the standard stub; one quick and dirty way
is to just execute a breakpoint instruction (the &ldquo;dirty&rdquo; part is that
<span class="sc">gdb</span> reports a <code>SIGTRAP</code> instead of a <code>SIGINT</code>).
<p>Other routines you need to supply are:
<dl>
<dt><code>void exceptionHandler (int </code><var>exception_number</var><code>, void *</code><var>exception_address</var><code>)</code><dd><a name="index-exceptionHandler-1249"></a>Write this function to install <var>exception_address</var> in the exception
handling tables. You need to do this because the stub does not have any
way of knowing what the exception handling tables on your target system
are like (for example, the processor's table might be in <span class="sc">rom</span>,
containing entries which point to a table in <span class="sc">ram</span>).
<var>exception_number</var> is the exception number which should be changed;
its meaning is architecture-dependent (for example, different numbers
might represent divide by zero, misaligned access, etc). When this
exception occurs, control should be transferred directly to
<var>exception_address</var>, and the processor state (stack, registers,
and so on) should be just as it is when a processor exception occurs. So if
you want to use a jump instruction to reach <var>exception_address</var>, it
should be a simple jump, not a jump to subroutine.
<p>For the 386, <var>exception_address</var> should be installed as an interrupt
gate so that interrupts are masked while the handler runs. The gate
should be at privilege level 0 (the most privileged level). The
<span class="sc">sparc</span> and 68k stubs are able to mask interrupts themselves without
help from <code>exceptionHandler</code>.
<br><dt><code>void flush_i_cache()</code><dd><a name="index-flush_005fi_005fcache-1250"></a>On <span class="sc">sparc</span> and <span class="sc">sparclite</span> only, write this subroutine to flush the
instruction cache, if any, on your target machine. If there is no
instruction cache, this subroutine may be a no-op.
<p>On target machines that have instruction caches, <span class="sc">gdb</span> requires this
function to make certain that the state of your program is stable.
</dl>
<p class="noindent">You must also make sure this library routine is available:
<dl>
<dt><code>void *memset(void *, int, int)</code><dd><a name="index-memset-1251"></a>This is the standard library function <code>memset</code> that sets an area of
memory to a known value. If you have one of the free versions of
<code>libc.a</code>, <code>memset</code> can be found there; otherwise, you must
either obtain it from your hardware manufacturer, or write your own.
</dl>
<p>If you do not use the GNU C compiler, you may need other standard
library subroutines as well; this varies from one stub to another,
but in general the stubs are likely to use any of the common library
subroutines which <span class="sc">gcc</span> generates as inline code.
</body></html>

View file

@ -0,0 +1,97 @@
<html lang="en">
<head>
<title>Branch Trace Format - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Remote-Protocol.html#Remote-Protocol" title="Remote Protocol">
<link rel="prev" href="Traceframe-Info-Format.html#Traceframe-Info-Format" title="Traceframe Info Format">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Branch-Trace-Format"></a>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Traceframe-Info-Format.html#Traceframe-Info-Format">Traceframe Info Format</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Remote-Protocol.html#Remote-Protocol">Remote Protocol</a>
<hr>
</div>
<h3 class="section">E.19 Branch Trace Format</h3>
<p><a name="index-branch-trace-format-2833"></a>
In order to display the branch trace of an inferior thread,
<span class="sc">gdb</span> needs to obtain the list of branches. This list is
represented as list of sequential code blocks that are connected via
branches. The code in each block has been executed sequentially.
<p>This list is obtained using the &lsquo;<samp><span class="samp">qXfer:btrace:read</span></samp>&rsquo;
(see <a href="qXfer-btrace-read.html#qXfer-btrace-read">qXfer btrace read</a>) packet and is an XML document.
<p><span class="sc">gdb</span> must be linked with the Expat library to support XML
traceframe info discovery. See <a href="Expat.html#Expat">Expat</a>.
<p>The top-level structure of the document is shown below:
<pre class="smallexample"> &lt;?xml version="1.0"?&gt;
&lt;!DOCTYPE btrace
PUBLIC "+//IDN gnu.org//DTD GDB Branch Trace V1.0//EN"
"http://sourceware.org/gdb/gdb-btrace.dtd"&gt;
&lt;btrace&gt;
block...
&lt;/btrace&gt;
</pre>
<ul>
<li>A block of sequentially executed instructions starting at <var>begin</var>
and ending at <var>end</var>:
<pre class="smallexample"> &lt;block begin="<var>begin</var>" end="<var>end</var>"/&gt;
</pre>
</ul>
<p>The formal DTD for the branch trace format is given below:
<pre class="smallexample"> &lt;!ELEMENT btrace (block)* &gt;
&lt;!ATTLIST btrace version CDATA #FIXED "1.0"&gt;
&lt;!ELEMENT block EMPTY&gt;
&lt;!ATTLIST block begin CDATA #REQUIRED
end CDATA #REQUIRED&gt;
</pre>
<!-- \input texinfo -->
<!-- %**start of header -->
<!-- @setfilename agentexpr.info -->
<!-- @settitle GDB Agent Expressions -->
<!-- @setchapternewpage off -->
<!-- %**end of header -->
<!-- This file is part of the GDB manual. -->
<!-- Copyright (C) 2003-2013 Free Software Foundation, Inc. -->
<!-- See the file gdb.texinfo for copying conditions. -->
</body></html>

View file

@ -0,0 +1,124 @@
<html lang="en">
<head>
<title>Break Commands - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Breakpoints.html#Breakpoints" title="Breakpoints">
<link rel="prev" href="Conditions.html#Conditions" title="Conditions">
<link rel="next" href="Dynamic-Printf.html#Dynamic-Printf" title="Dynamic Printf">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Break-Commands"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Dynamic-Printf.html#Dynamic-Printf">Dynamic Printf</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Conditions.html#Conditions">Conditions</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Breakpoints.html#Breakpoints">Breakpoints</a>
<hr>
</div>
<h4 class="subsection">5.1.7 Breakpoint Command Lists</h4>
<p><a name="index-breakpoint-commands-284"></a>You can give any breakpoint (or watchpoint or catchpoint) a series of
commands to execute when your program stops due to that breakpoint. For
example, you might want to print the values of certain expressions, or
enable other breakpoints.
<a name="index-commands-285"></a>
<a name="index-end_0040r_007b-_0028breakpoint-commands_0029_007d-286"></a>
<dl><dt><code>commands </code><span class="roman">[</span><var>range</var><code>...</code><span class="roman">]</span><dt><code>... </code><var>command-list</var><code> ...</code><dt><code>end</code><dd>Specify a list of commands for the given breakpoints. The commands
themselves appear on the following lines. Type a line containing just
<code>end</code> to terminate the commands.
<p>To remove all commands from a breakpoint, type <code>commands</code> and
follow it immediately with <code>end</code>; that is, give no commands.
<p>With no argument, <code>commands</code> refers to the last breakpoint,
watchpoint, or catchpoint set (not to the breakpoint most recently
encountered). If the most recent breakpoints were set with a single
command, then the <code>commands</code> will apply to all the breakpoints
set by that command. This applies to breakpoints set by
<code>rbreak</code>, and also applies when a single <code>break</code> command
creates multiple breakpoints (see <a href="Ambiguous-Expressions.html#Ambiguous-Expressions">Ambiguous Expressions</a>).
</dl>
<p>Pressing &lt;RET&gt; as a means of repeating the last <span class="sc">gdb</span> command is
disabled within a <var>command-list</var>.
<p>You can use breakpoint commands to start your program up again. Simply
use the <code>continue</code> command, or <code>step</code>, or any other command
that resumes execution.
<p>Any other commands in the command list, after a command that resumes
execution, are ignored. This is because any time you resume execution
(even with a simple <code>next</code> or <code>step</code>), you may encounter
another breakpoint&mdash;which could have its own command list, leading to
ambiguities about which list to execute.
<p><a name="index-silent-287"></a>If the first command you specify in a command list is <code>silent</code>, 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 none of the remaining commands print anything, you
see no sign that the breakpoint was reached. <code>silent</code> is
meaningful only at the beginning of a breakpoint command list.
<p>The commands <code>echo</code>, <code>output</code>, and <code>printf</code> allow you to
print precisely controlled output, and are often useful in silent
breakpoints. See <a href="Output.html#Output">Commands for Controlled Output</a>.
<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 <code>x</code> is positive.
<pre class="smallexample"> break foo if x&gt;0
commands
silent
printf "x is %d\n",x
cont
end
</pre>
<p>One application for breakpoint commands is to compensate for one bug so
you can test for 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 <code>continue</code> command
so that your program does not stop, and start with the <code>silent</code>
command so that no output is produced. Here is an example:
<pre class="smallexample"> break 403
commands
silent
set x = y + 4
cont
end
</pre>
</body></html>

View file

@ -0,0 +1,96 @@
<html lang="en">
<head>
<title>Breakpoint-related Warnings - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Breakpoints.html#Breakpoints" title="Breakpoints">
<link rel="prev" href="Error-in-Breakpoints.html#Error-in-Breakpoints" title="Error in Breakpoints">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Breakpoint-related-Warnings"></a>
<a name="Breakpoint_002drelated-Warnings"></a>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Error-in-Breakpoints.html#Error-in-Breakpoints">Error in Breakpoints</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Breakpoints.html#Breakpoints">Breakpoints</a>
<hr>
</div>
<h4 class="subsection">5.1.12 &ldquo;Breakpoint address adjusted...&rdquo;</h4>
<p><a name="index-breakpoint-address-adjusted-302"></a>
Some processor architectures place constraints on the addresses at
which breakpoints may be placed. For architectures thus constrained,
<span class="sc">gdb</span> will attempt to adjust the breakpoint's address to comply
with the constraints dictated by the architecture.
<p>One example of such an architecture is the Fujitsu FR-V. The FR-V is
a VLIW architecture in which a number of RISC-like instructions may be
bundled together for parallel execution. The FR-V architecture
constrains the location of a breakpoint instruction within such a
bundle to the instruction with the lowest address. <span class="sc">gdb</span>
honors this constraint by adjusting a breakpoint's address to the
first in the bundle.
<p>It is not uncommon for optimized code to have bundles which contain
instructions from different source statements, thus it may happen that
a breakpoint's address will be adjusted from one source statement to
another. Since this adjustment may significantly alter <span class="sc">gdb</span>'s
breakpoint related behavior from what the user expects, a warning is
printed when the breakpoint is first set and also when the breakpoint
is hit.
<p>A warning like the one below is printed when setting a breakpoint
that's been subject to address adjustment:
<pre class="smallexample"> warning: Breakpoint address adjusted from 0x00010414 to 0x00010410.
</pre>
<p>Such warnings are printed both for user settable and <span class="sc">gdb</span>'s
internal breakpoints. If you see one of these warnings, you should
verify that a breakpoint set at the adjusted address will have the
desired affect. If not, the breakpoint in question may be removed and
other breakpoints may be set which will have the desired behavior.
E.g., it may be sufficient to place the breakpoint at a later
instruction. A conditional breakpoint may also be useful in some
cases to prevent the breakpoint from triggering too often.
<p><span class="sc">gdb</span> will also issue a warning when stopping at one of these
adjusted breakpoints:
<pre class="smallexample"> warning: Breakpoint 1 address previously adjusted from 0x00010414
to 0x00010410.
</pre>
<p>When this warning is encountered, it may be too late to take remedial
action except in cases where the breakpoint is hit earlier or more
frequently than expected.
</body></html>

View file

@ -0,0 +1,249 @@
<html lang="en">
<head>
<title>Breakpoints In Python - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Python-API.html#Python-API" title="Python API">
<link rel="prev" href="Symbol-Tables-In-Python.html#Symbol-Tables-In-Python" title="Symbol Tables In Python">
<link rel="next" href="Finish-Breakpoints-in-Python.html#Finish-Breakpoints-in-Python" title="Finish Breakpoints in Python">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Breakpoints-In-Python"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Finish-Breakpoints-in-Python.html#Finish-Breakpoints-in-Python">Finish Breakpoints in Python</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Symbol-Tables-In-Python.html#Symbol-Tables-In-Python">Symbol Tables In Python</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Python-API.html#Python-API">Python API</a>
<hr>
</div>
<h5 class="subsubsection">23.2.2.21 Manipulating breakpoints using Python</h5>
<p><a name="index-breakpoints-in-python-2116"></a><a name="index-gdb_002eBreakpoint-2117"></a>
Python code can manipulate breakpoints via the <code>gdb.Breakpoint</code>
class.
<div class="defun">
&mdash; Function: <b>Breakpoint.__init__</b> (<var>spec </var><span class="roman">[</span><var>, type </var><span class="roman">[</span><var>, wp_class </var><span class="roman">[</span><var>,internal</var><span class="roman">]]]</span>)<var><a name="index-Breakpoint_002e_005f_005finit_005f_005f-2118"></a></var><br>
<blockquote><p>Create a new breakpoint. <var>spec</var> is a string naming the
location of the breakpoint, or an expression that defines a
watchpoint. The contents can be any location recognized by the
<code>break</code> command, or in the case of a watchpoint, by the <code>watch</code>
command. The optional <var>type</var> denotes the breakpoint to create
from the types defined later in this chapter. This argument can be
either: <code>gdb.BP_BREAKPOINT</code> or <code>gdb.BP_WATCHPOINT</code>. <var>type</var>
defaults to <code>gdb.BP_BREAKPOINT</code>. The optional <var>internal</var> argument
allows the breakpoint to become invisible to the user. The breakpoint
will neither be reported when created, nor will it be listed in the
output from <code>info breakpoints</code> (but will be listed with the
<code>maint info breakpoints</code> command). The optional <var>wp_class</var>
argument defines the class of watchpoint to create, if <var>type</var> is
<code>gdb.BP_WATCHPOINT</code>. If a watchpoint class is not provided, it is
assumed to be a <code>gdb.WP_WRITE</code> class.
</p></blockquote></div>
<div class="defun">
&mdash; Function: <b>Breakpoint.stop</b> (<var>self</var>)<var><a name="index-Breakpoint_002estop-2119"></a></var><br>
<blockquote><p>The <code>gdb.Breakpoint</code> class can be sub-classed and, in
particular, you may choose to implement the <code>stop</code> method.
If this method is defined as a sub-class of <code>gdb.Breakpoint</code>,
it will be called when the inferior reaches any location of a
breakpoint which instantiates that sub-class. If the method returns
<code>True</code>, the inferior will be stopped at the location of the
breakpoint, otherwise the inferior will continue.
<p>If there are multiple breakpoints at the same location with a
<code>stop</code> method, each one will be called regardless of the
return status of the previous. This ensures that all <code>stop</code>
methods have a chance to execute at that location. In this scenario
if one of the methods returns <code>True</code> but the others return
<code>False</code>, the inferior will still be stopped.
<p>You should not alter the execution state of the inferior (i.e., step,
next, etc.), alter the current frame context (i.e., change the current
active frame), or alter, add or delete any breakpoint. As a general
rule, you should not alter any data within <span class="sc">gdb</span> or the inferior
at this time.
<p>Example <code>stop</code> implementation:
<pre class="smallexample"> class MyBreakpoint (gdb.Breakpoint):
def stop (self):
inf_val = gdb.parse_and_eval("foo")
if inf_val == 3:
return True
return False
</pre>
</blockquote></div>
<p>The available watchpoint types represented by constants are defined in the
<code>gdb</code> module:
<a name="index-WP_005fREAD-2120"></a>
<a name="index-gdb_002eWP_005fREAD-2121"></a>
<dl><dt><code>gdb.WP_READ</code><dd>Read only watchpoint.
<p><a name="index-WP_005fWRITE-2122"></a><a name="index-gdb_002eWP_005fWRITE-2123"></a><br><dt><code>gdb.WP_WRITE</code><dd>Write only watchpoint.
<p><a name="index-WP_005fACCESS-2124"></a><a name="index-gdb_002eWP_005fACCESS-2125"></a><br><dt><code>gdb.WP_ACCESS</code><dd>Read/Write watchpoint.
</dl>
<div class="defun">
&mdash; Function: <b>Breakpoint.is_valid</b> ()<var><a name="index-Breakpoint_002eis_005fvalid-2126"></a></var><br>
<blockquote><p>Return <code>True</code> if this <code>Breakpoint</code> object is valid,
<code>False</code> otherwise. A <code>Breakpoint</code> object can become invalid
if the user deletes the breakpoint. In this case, the object still
exists, but the underlying breakpoint does not. In the cases of
watchpoint scope, the watchpoint remains valid even if execution of the
inferior leaves the scope of that watchpoint.
</p></blockquote></div>
<div class="defun">
&mdash; Function: <b>Breakpoint.delete</b><var><a name="index-Breakpoint_002edelete-2127"></a></var><br>
<blockquote><p>Permanently deletes the <span class="sc">gdb</span> breakpoint. This also
invalidates the Python <code>Breakpoint</code> object. Any further access
to this object's attributes or methods will raise an error.
</p></blockquote></div>
<div class="defun">
&mdash; Variable: <b>Breakpoint.enabled</b><var><a name="index-Breakpoint_002eenabled-2128"></a></var><br>
<blockquote><p>This attribute is <code>True</code> if the breakpoint is enabled, and
<code>False</code> otherwise. This attribute is writable.
</p></blockquote></div>
<div class="defun">
&mdash; Variable: <b>Breakpoint.silent</b><var><a name="index-Breakpoint_002esilent-2129"></a></var><br>
<blockquote><p>This attribute is <code>True</code> if the breakpoint is silent, and
<code>False</code> otherwise. This attribute is writable.
<p>Note that a breakpoint can also be silent if it has commands and the
first command is <code>silent</code>. This is not reported by the
<code>silent</code> attribute.
</p></blockquote></div>
<div class="defun">
&mdash; Variable: <b>Breakpoint.thread</b><var><a name="index-Breakpoint_002ethread-2130"></a></var><br>
<blockquote><p>If the breakpoint is thread-specific, this attribute holds the thread
id. If the breakpoint is not thread-specific, this attribute is
<code>None</code>. This attribute is writable.
</p></blockquote></div>
<div class="defun">
&mdash; Variable: <b>Breakpoint.task</b><var><a name="index-Breakpoint_002etask-2131"></a></var><br>
<blockquote><p>If the breakpoint is Ada task-specific, this attribute holds the Ada task
id. If the breakpoint is not task-specific (or the underlying
language is not Ada), this attribute is <code>None</code>. This attribute
is writable.
</p></blockquote></div>
<div class="defun">
&mdash; Variable: <b>Breakpoint.ignore_count</b><var><a name="index-Breakpoint_002eignore_005fcount-2132"></a></var><br>
<blockquote><p>This attribute holds the ignore count for the breakpoint, an integer.
This attribute is writable.
</p></blockquote></div>
<div class="defun">
&mdash; Variable: <b>Breakpoint.number</b><var><a name="index-Breakpoint_002enumber-2133"></a></var><br>
<blockquote><p>This attribute holds the breakpoint's number &mdash; the identifier used by
the user to manipulate the breakpoint. This attribute is not writable.
</p></blockquote></div>
<div class="defun">
&mdash; Variable: <b>Breakpoint.type</b><var><a name="index-Breakpoint_002etype-2134"></a></var><br>
<blockquote><p>This attribute holds the breakpoint's type &mdash; the identifier used to
determine the actual breakpoint type or use-case. This attribute is not
writable.
</p></blockquote></div>
<div class="defun">
&mdash; Variable: <b>Breakpoint.visible</b><var><a name="index-Breakpoint_002evisible-2135"></a></var><br>
<blockquote><p>This attribute tells whether the breakpoint is visible to the user
when set, or when the &lsquo;<samp><span class="samp">info breakpoints</span></samp>&rsquo; command is run. This
attribute is not writable.
</p></blockquote></div>
<p>The available types are represented by constants defined in the <code>gdb</code>
module:
<a name="index-BP_005fBREAKPOINT-2136"></a>
<a name="index-gdb_002eBP_005fBREAKPOINT-2137"></a>
<dl><dt><code>gdb.BP_BREAKPOINT</code><dd>Normal code breakpoint.
<p><a name="index-BP_005fWATCHPOINT-2138"></a><a name="index-gdb_002eBP_005fWATCHPOINT-2139"></a><br><dt><code>gdb.BP_WATCHPOINT</code><dd>Watchpoint breakpoint.
<p><a name="index-BP_005fHARDWARE_005fWATCHPOINT-2140"></a><a name="index-gdb_002eBP_005fHARDWARE_005fWATCHPOINT-2141"></a><br><dt><code>gdb.BP_HARDWARE_WATCHPOINT</code><dd>Hardware assisted watchpoint.
<p><a name="index-BP_005fREAD_005fWATCHPOINT-2142"></a><a name="index-gdb_002eBP_005fREAD_005fWATCHPOINT-2143"></a><br><dt><code>gdb.BP_READ_WATCHPOINT</code><dd>Hardware assisted read watchpoint.
<p><a name="index-BP_005fACCESS_005fWATCHPOINT-2144"></a><a name="index-gdb_002eBP_005fACCESS_005fWATCHPOINT-2145"></a><br><dt><code>gdb.BP_ACCESS_WATCHPOINT</code><dd>Hardware assisted access watchpoint.
</dl>
<div class="defun">
&mdash; Variable: <b>Breakpoint.hit_count</b><var><a name="index-Breakpoint_002ehit_005fcount-2146"></a></var><br>
<blockquote><p>This attribute holds the hit count for the breakpoint, an integer.
This attribute is writable, but currently it can only be set to zero.
</p></blockquote></div>
<div class="defun">
&mdash; Variable: <b>Breakpoint.location</b><var><a name="index-Breakpoint_002elocation-2147"></a></var><br>
<blockquote><p>This attribute holds the location of the breakpoint, as specified by
the user. It is a string. If the breakpoint does not have a location
(that is, it is a watchpoint) the attribute's value is <code>None</code>. This
attribute is not writable.
</p></blockquote></div>
<div class="defun">
&mdash; Variable: <b>Breakpoint.expression</b><var><a name="index-Breakpoint_002eexpression-2148"></a></var><br>
<blockquote><p>This attribute holds a breakpoint expression, as specified by
the user. It is a string. If the breakpoint does not have an
expression (the breakpoint is not a watchpoint) the attribute's value
is <code>None</code>. This attribute is not writable.
</p></blockquote></div>
<div class="defun">
&mdash; Variable: <b>Breakpoint.condition</b><var><a name="index-Breakpoint_002econdition-2149"></a></var><br>
<blockquote><p>This attribute holds the condition of the breakpoint, as specified by
the user. It is a string. If there is no condition, this attribute's
value is <code>None</code>. This attribute is writable.
</p></blockquote></div>
<div class="defun">
&mdash; Variable: <b>Breakpoint.commands</b><var><a name="index-Breakpoint_002ecommands-2150"></a></var><br>
<blockquote><p>This attribute holds the commands attached to the breakpoint. If
there are commands, this attribute's value is a string holding all the
commands, separated by newlines. If there are no commands, this
attribute is <code>None</code>. This attribute is not writable.
</p></blockquote></div>
</body></html>

View file

@ -0,0 +1,112 @@
<html lang="en">
<head>
<title>Breakpoints - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Stopping.html#Stopping" title="Stopping">
<link rel="next" href="Continuing-and-Stepping.html#Continuing-and-Stepping" title="Continuing and Stepping">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Breakpoints"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Continuing-and-Stepping.html#Continuing-and-Stepping">Continuing and Stepping</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Stopping.html#Stopping">Stopping</a>
<hr>
</div>
<h3 class="section">5.1 Breakpoints, Watchpoints, and Catchpoints</h3>
<p><a name="index-breakpoints-204"></a>A <dfn>breakpoint</dfn> makes your program stop whenever a certain point in
the program is reached. For each breakpoint, you can add conditions to
control in finer detail whether your program stops. You can set
breakpoints with the <code>break</code> command and its variants (see <a href="Set-Breaks.html#Set-Breaks">Setting Breakpoints</a>), to specify the place where your program
should stop by line number, function name or exact address in the
program.
<p>On some systems, you can set breakpoints in shared libraries before
the executable is run. There is a minor limitation on HP-UX systems:
you must wait until the executable is run in order to set breakpoints
in shared library routines that are not called directly by the program
(for example, routines that are arguments in a <code>pthread_create</code>
call).
<p><a name="index-watchpoints-205"></a><a name="index-data-breakpoints-206"></a><a name="index-memory-tracing-207"></a><a name="index-breakpoint-on-memory-address-208"></a><a name="index-breakpoint-on-variable-modification-209"></a>A <dfn>watchpoint</dfn> is a special breakpoint that stops your program
when the value of an expression changes. The expression may be a value
of a variable, or it could involve values of one or more variables
combined by operators, such as &lsquo;<samp><span class="samp">a + b</span></samp>&rsquo;. This is sometimes called
<dfn>data breakpoints</dfn>. You must use a different command to set
watchpoints (see <a href="Set-Watchpoints.html#Set-Watchpoints">Setting Watchpoints</a>), but aside
from that, you can manage a watchpoint like any other breakpoint: you
enable, disable, and delete both breakpoints and watchpoints using the
same commands.
<p>You can arrange to have values from your program displayed automatically
whenever <span class="sc">gdb</span> stops at a breakpoint. See <a href="Auto-Display.html#Auto-Display">Automatic Display</a>.
<p><a name="index-catchpoints-210"></a><a name="index-breakpoint-on-events-211"></a>A <dfn>catchpoint</dfn> is another special breakpoint that stops your program
when a certain kind of event occurs, such as the throwing of a C<tt>++</tt>
exception or the loading of a library. As with watchpoints, you use a
different command to set a catchpoint (see <a href="Set-Catchpoints.html#Set-Catchpoints">Setting Catchpoints</a>), but aside from that, you can manage a catchpoint like any
other breakpoint. (To stop when your program receives a signal, use the
<code>handle</code> command; see <a href="Signals.html#Signals">Signals</a>.)
<p><a name="index-breakpoint-numbers-212"></a><a name="index-numbers-for-breakpoints-213"></a><span class="sc">gdb</span> assigns a number to each breakpoint, watchpoint, or
catchpoint when you create it; these numbers are successive integers
starting with one. 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 <dfn>enabled</dfn> or
<dfn>disabled</dfn>; if disabled, it has no effect on your program until you
enable it again.
<p><a name="index-breakpoint-ranges-214"></a><a name="index-ranges-of-breakpoints-215"></a>Some <span class="sc">gdb</span> commands accept a range of breakpoints on which to
operate. A breakpoint range is either a single breakpoint number, like
&lsquo;<samp><span class="samp">5</span></samp>&rsquo;, or two such numbers, in increasing order, separated by a
hyphen, like &lsquo;<samp><span class="samp">5-7</span></samp>&rsquo;. When a breakpoint range is given to a command,
all breakpoints in that range are operated on.
<ul class="menu">
<li><a accesskey="1" href="Set-Breaks.html#Set-Breaks">Set Breaks</a>: Setting breakpoints
<li><a accesskey="2" href="Set-Watchpoints.html#Set-Watchpoints">Set Watchpoints</a>: Setting watchpoints
<li><a accesskey="3" href="Set-Catchpoints.html#Set-Catchpoints">Set Catchpoints</a>: Setting catchpoints
<li><a accesskey="4" href="Delete-Breaks.html#Delete-Breaks">Delete Breaks</a>: Deleting breakpoints
<li><a accesskey="5" href="Disabling.html#Disabling">Disabling</a>: Disabling breakpoints
<li><a accesskey="6" href="Conditions.html#Conditions">Conditions</a>: Break conditions
<li><a accesskey="7" href="Break-Commands.html#Break-Commands">Break Commands</a>: Breakpoint command lists
<li><a accesskey="8" href="Dynamic-Printf.html#Dynamic-Printf">Dynamic Printf</a>: Dynamic printf
<li><a accesskey="9" href="Save-Breakpoints.html#Save-Breakpoints">Save Breakpoints</a>: How to save breakpoints in a file
<li><a href="Static-Probe-Points.html#Static-Probe-Points">Static Probe Points</a>: Listing static probe points
<li><a href="Error-in-Breakpoints.html#Error-in-Breakpoints">Error in Breakpoints</a>: ``Cannot insert breakpoints''
<li><a href="Breakpoint_002drelated-Warnings.html#Breakpoint_002drelated-Warnings">Breakpoint-related Warnings</a>: ``Breakpoint address adjusted...''
</ul>
</body></html>

View file

@ -0,0 +1,72 @@
<html lang="en">
<head>
<title>Bug Criteria - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="GDB-Bugs.html#GDB-Bugs" title="GDB Bugs">
<link rel="next" href="Bug-Reporting.html#Bug-Reporting" title="Bug Reporting">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Bug-Criteria"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Bug-Reporting.html#Bug-Reporting">Bug Reporting</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="GDB-Bugs.html#GDB-Bugs">GDB Bugs</a>
<hr>
</div>
<h3 class="section">31.1 Have You Found a Bug?</h3>
<p><a name="index-bug-criteria-2428"></a>
If you are not sure whether you have found a bug, here are some guidelines:
<a name="index-fatal-signal-2429"></a>
<a name="index-debugger-crash-2430"></a>
<a name="index-crash-of-debugger-2431"></a>
<ul><li>If the debugger gets a fatal signal, for any input whatever, that is a
<span class="sc">gdb</span> bug. Reliable debuggers never crash.
<p><a name="index-error-on-valid-input-2432"></a><li>If <span class="sc">gdb</span> produces an error message for valid input, that is a
bug. (Note that if you're cross debugging, the problem may also be
somewhere in the connection to the target.)
<p><a name="index-invalid-input-2433"></a><li>If <span class="sc">gdb</span> does not produce an error message for invalid input,
that is a bug. However, you should note that your idea of
&ldquo;invalid input&rdquo; might be our idea of &ldquo;an extension&rdquo; or &ldquo;support
for traditional practice&rdquo;.
<li>If you are an experienced user of debugging tools, your suggestions
for improvement of <span class="sc">gdb</span> are welcome in any case.
</ul>
</body></html>

View file

@ -0,0 +1,223 @@
<html lang="en">
<head>
<title>Bug Reporting - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="GDB-Bugs.html#GDB-Bugs" title="GDB Bugs">
<link rel="prev" href="Bug-Criteria.html#Bug-Criteria" title="Bug Criteria">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Bug-Reporting"></a>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Bug-Criteria.html#Bug-Criteria">Bug Criteria</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="GDB-Bugs.html#GDB-Bugs">GDB Bugs</a>
<hr>
</div>
<h3 class="section">31.2 How to Report Bugs</h3>
<p><a name="index-bug-reports-2434"></a><a name="index-g_t_0040value_007bGDBN_007d-bugs_002c-reporting-2435"></a>
A number of companies and individuals offer support for <span class="sc">gnu</span> products.
If you obtained <span class="sc">gdb</span> from a support organization, we recommend you
contact that organization first.
<p>You can find contact information for many support companies and
individuals in the file <samp><span class="file">etc/SERVICE</span></samp> in the <span class="sc">gnu</span> Emacs
distribution.
<!-- should add a web page ref... -->
<p>In any event, we also recommend that you submit bug reports for
<span class="sc">gdb</span>. The preferred method is to submit them directly using
<a href="http://www.gnu.org/software/gdb/bugs/"><span class="sc">gdb</span>'s Bugs web page</a>. Alternatively, the <a href="mailto:bug-gdb@gnu.org">e-mail gateway</a> can
be used.
<p><strong>Do not send bug reports to &lsquo;</strong><samp><span class="samp">info-gdb</span></samp><strong>&rsquo;, or to
&lsquo;</strong><samp><span class="samp">help-gdb</span></samp><strong>&rsquo;, or to any newsgroups.</strong> Most users of <span class="sc">gdb</span> do
not want to receive bug reports. Those that do have arranged to receive
&lsquo;<samp><span class="samp">bug-gdb</span></samp>&rsquo;.
<p>The mailing list &lsquo;<samp><span class="samp">bug-gdb</span></samp>&rsquo; has a newsgroup &lsquo;<samp><span class="samp">gnu.gdb.bug</span></samp>&rsquo; which
serves as a repeater. The mailing list and the newsgroup carry exactly
the same messages. Often people think of posting bug reports to the
newsgroup instead of mailing them. This appears to work, but it has one
problem which can be crucial: a newsgroup posting often lacks a mail
path back to the sender. Thus, if we need to ask for more information,
we may be unable to reach you. For this reason, it is better to send
bug reports to the mailing list.
<p>The fundamental principle of reporting bugs usefully is this:
<strong>report all the facts</strong>. If you are not sure whether to state a
fact or leave it out, state it!
<p>Often people omit facts because they think they know what causes the
problem and assume that some details do not matter. Thus, you might
assume that the name of the variable you use in an example does not matter.
Well, probably it does not, but one cannot be sure. Perhaps the bug is a
stray memory reference which happens to fetch from the location where that
name is stored in memory; perhaps, if the name were different, the contents
of that location would fool the debugger into doing the right thing despite
the bug. Play it safe and give a specific, complete example. That is the
easiest thing for you to do, and the most helpful.
<p>Keep in mind that the purpose of a bug report is to enable us to fix the
bug. It may be that the bug has been reported previously, but neither
you nor we can know that unless your bug report is complete and
self-contained.
<p>Sometimes people give a few sketchy facts and ask, &ldquo;Does this ring a
bell?&rdquo; Those bug reports are useless, and we urge everyone to
<em>refuse to respond to them</em> except to chide the sender to report
bugs properly.
<p>To enable us to fix the bug, you should include all these things:
<ul>
<li>The version of <span class="sc">gdb</span>. <span class="sc">gdb</span> announces it if you start
with no arguments; you can also print it at any time using <code>show
version</code>.
<p>Without this, we will not know whether there is any point in looking for
the bug in the current version of <span class="sc">gdb</span>.
<li>The type of machine you are using, and the operating system name and
version number.
<li>What compiler (and its version) was used to compile <span class="sc">gdb</span>&mdash;e.g.
&ldquo;gcc&ndash;2.8.1&rdquo;.
<li>What compiler (and its version) was used to compile the program you are
debugging&mdash;e.g. &ldquo;gcc&ndash;2.8.1&rdquo;, or &ldquo;HP92453-01 A.10.32.03 HP
C Compiler&rdquo;. For <span class="sc">gcc</span>, you can say <kbd>gcc --version</kbd>
to get this information; for other compilers, see the documentation for
those compilers.
<li>The command arguments you gave the compiler to compile your example and
observe the bug. For example, did you use &lsquo;<samp><span class="samp">-O</span></samp>&rsquo;? To guarantee
you will not omit something important, list them all. A copy of the
Makefile (or the output from make) is sufficient.
<p>If we were to try to guess the arguments, we would probably guess wrong
and then we might not encounter the bug.
<li>A complete input script, and all necessary source files, that will
reproduce the bug.
<li>A description of what behavior you observe that you believe is
incorrect. For example, &ldquo;It gets a fatal signal.&rdquo;
<p>Of course, if the bug is that <span class="sc">gdb</span> gets a fatal signal, then we
will certainly notice it. But if the bug is incorrect output, we might
not notice unless it is glaringly wrong. You might as well not give us
a chance to make a mistake.
<p>Even if the problem you experience is a fatal signal, you should still
say so explicitly. Suppose something strange is going on, such as, your
copy of <span class="sc">gdb</span> is out of synch, or you have encountered a bug in
the C library on your system. (This has happened!) Your copy might
crash and ours would not. If you told us to expect a crash, then when
ours fails to crash, we would know that the bug was not happening for
us. If you had not told us to expect a crash, then we would not be able
to draw any conclusion from our observations.
<p><a name="index-script-2436"></a><a name="index-recording-a-session-script-2437"></a>To collect all this information, you can use a session recording program
such as <samp><span class="command">script</span></samp>, which is available on many Unix systems.
Just run your <span class="sc">gdb</span> session inside <samp><span class="command">script</span></samp> and then
include the <samp><span class="file">typescript</span></samp> file with your bug report.
<p>Another way to record a <span class="sc">gdb</span> session is to run <span class="sc">gdb</span>
inside Emacs and then save the entire buffer to a file.
<li>If you wish to suggest changes to the <span class="sc">gdb</span> source, send us context
diffs. If you even discuss something in the <span class="sc">gdb</span> source, refer to
it by context, not by line number.
<p>The line numbers in our development sources will not match those in your
sources. Your line numbers would convey no useful information to us.
</ul>
<p>Here are some things that are not necessary:
<ul>
<li>A description of the envelope of the bug.
<p>Often people who encounter a bug spend a lot of time investigating
which changes to the input file will make the bug go away and which
changes will not affect it.
<p>This is often time consuming and not very useful, because the way we
will find the bug is by running a single example under the debugger
with breakpoints, not by pure deduction from a series of examples.
We recommend that you save your time for something else.
<p>Of course, if you can find a simpler example to report <em>instead</em>
of the original one, that is a convenience for us. Errors in the
output will be easier to spot, running under the debugger will take
less time, and so on.
<p>However, simplification is not vital; if you do not want to do this,
report the bug anyway and send us the entire test case you used.
<li>A patch for the bug.
<p>A patch for the bug does help us if it is a good one. But do not omit
the necessary information, such as the test case, on the assumption that
a patch is all we need. We might see problems with your patch and decide
to fix the problem another way, or we might not understand it at all.
<p>Sometimes with a program as complicated as <span class="sc">gdb</span> it is very hard to
construct an example that will make the program follow a certain path
through the code. If you do not send us the example, we will not be able
to construct one, so we will not be able to verify that the bug is fixed.
<p>And if we cannot understand what bug you are trying to fix, or why your
patch should be an improvement, we will not install it. A test case will
help us to understand.
<li>A guess about what the bug is or what it depends on.
<p>Such guesses are usually wrong. Even we cannot guess right about such
things without first using the debugger to find the facts.
</ul>
<!-- The readline documentation is distributed with the readline code -->
<!-- and consists of the two following files: -->
<!-- rluser.texi -->
<!-- hsuser.texi -->
<!-- Use -I with makeinfo to point to the appropriate directory, -->
<!-- environment var TEXINPUTS with TeX. -->
<!-- %**start of header (This is for running Texinfo on a region.) -->
<!-- %**end of header (This is for running Texinfo on a region.) -->
<!-- If you are including this manual as an appendix, then set the -->
<!-- variable readline-appendix. -->
</body></html>

View file

@ -0,0 +1,137 @@
<html lang="en">
<head>
<title>Built-In Func/Proc - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Modula_002d2.html#Modula_002d2" title="Modula-2">
<link rel="prev" href="M2-Operators.html#M2-Operators" title="M2 Operators">
<link rel="next" href="M2-Constants.html#M2-Constants" title="M2 Constants">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Built-In-Func%2fProc"></a>
<a name="Built_002dIn-Func_002fProc"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="M2-Constants.html#M2-Constants">M2 Constants</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="M2-Operators.html#M2-Operators">M2 Operators</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Modula_002d2.html#Modula_002d2">Modula-2</a>
<hr>
</div>
<h5 class="subsubsection">15.4.8.2 Built-in Functions and Procedures</h5>
<p><a name="index-Modula_002d2-built_002dins-928"></a>
Modula-2 also makes available several built-in procedures and functions.
In describing these, the following metavariables are used:
<dl>
<dt><var>a</var><dd>represents an <code>ARRAY</code> variable.
<br><dt><var>c</var><dd>represents a <code>CHAR</code> constant or variable.
<br><dt><var>i</var><dd>represents a variable or constant of integral type.
<br><dt><var>m</var><dd>represents an identifier that belongs to a set. Generally used in the
same function with the metavariable <var>s</var>. The type of <var>s</var> should
be <code>SET OF </code><var>mtype</var> (where <var>mtype</var> is the type of <var>m</var>).
<br><dt><var>n</var><dd>represents a variable or constant of integral or floating-point type.
<br><dt><var>r</var><dd>represents a variable or constant of floating-point type.
<br><dt><var>t</var><dd>represents a type.
<br><dt><var>v</var><dd>represents a variable.
<br><dt><var>x</var><dd>represents a variable or constant of one of many types. See the
explanation of the function for details.
</dl>
<p>All Modula-2 built-in procedures also return a result, described below.
<dl>
<dt><code>ABS(</code><var>n</var><code>)</code><dd>Returns the absolute value of <var>n</var>.
<br><dt><code>CAP(</code><var>c</var><code>)</code><dd>If <var>c</var> is a lower case letter, it returns its upper case
equivalent, otherwise it returns its argument.
<br><dt><code>CHR(</code><var>i</var><code>)</code><dd>Returns the character whose ordinal value is <var>i</var>.
<br><dt><code>DEC(</code><var>v</var><code>)</code><dd>Decrements the value in the variable <var>v</var> by one. Returns the new value.
<br><dt><code>DEC(</code><var>v</var><code>,</code><var>i</var><code>)</code><dd>Decrements the value in the variable <var>v</var> by <var>i</var>. Returns the
new value.
<br><dt><code>EXCL(</code><var>m</var><code>,</code><var>s</var><code>)</code><dd>Removes the element <var>m</var> from the set <var>s</var>. Returns the new
set.
<br><dt><code>FLOAT(</code><var>i</var><code>)</code><dd>Returns the floating point equivalent of the integer <var>i</var>.
<br><dt><code>HIGH(</code><var>a</var><code>)</code><dd>Returns the index of the last member of <var>a</var>.
<br><dt><code>INC(</code><var>v</var><code>)</code><dd>Increments the value in the variable <var>v</var> by one. Returns the new value.
<br><dt><code>INC(</code><var>v</var><code>,</code><var>i</var><code>)</code><dd>Increments the value in the variable <var>v</var> by <var>i</var>. Returns the
new value.
<br><dt><code>INCL(</code><var>m</var><code>,</code><var>s</var><code>)</code><dd>Adds the element <var>m</var> to the set <var>s</var> if it is not already
there. Returns the new set.
<br><dt><code>MAX(</code><var>t</var><code>)</code><dd>Returns the maximum value of the type <var>t</var>.
<br><dt><code>MIN(</code><var>t</var><code>)</code><dd>Returns the minimum value of the type <var>t</var>.
<br><dt><code>ODD(</code><var>i</var><code>)</code><dd>Returns boolean TRUE if <var>i</var> is an odd number.
<br><dt><code>ORD(</code><var>x</var><code>)</code><dd>Returns the ordinal value of its argument. For example, the ordinal
value of a character is its <span class="sc">ascii</span> value (on machines supporting the
<span class="sc">ascii</span> character set). <var>x</var> must be of an ordered type, which include
integral, character and enumerated types.
<br><dt><code>SIZE(</code><var>x</var><code>)</code><dd>Returns the size of its argument. <var>x</var> can be a variable or a type.
<br><dt><code>TRUNC(</code><var>r</var><code>)</code><dd>Returns the integral part of <var>r</var>.
<br><dt><code>TSIZE(</code><var>x</var><code>)</code><dd>Returns the size of its argument. <var>x</var> can be a variable or a type.
<br><dt><code>VAL(</code><var>t</var><code>,</code><var>i</var><code>)</code><dd>Returns the member of the type <var>t</var> whose ordinal value is <var>i</var>.
</dl>
<blockquote>
<em>Warning:</em> Sets and their operations are not yet supported, so
<span class="sc">gdb</span> treats the use of procedures <code>INCL</code> and <code>EXCL</code> as
an error.
</blockquote>
<p><a name="index-Modula_002d2-constants-929"></a>
</body></html>

View file

@ -0,0 +1,74 @@
<html lang="en">
<head>
<title>Byte Order - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Targets.html#Targets" title="Targets">
<link rel="prev" href="Target-Commands.html#Target-Commands" title="Target Commands">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Byte-Order"></a>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Target-Commands.html#Target-Commands">Target Commands</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Targets.html#Targets">Targets</a>
<hr>
</div>
<h3 class="section">19.3 Choosing Target Byte Order</h3>
<p><a name="index-choosing-target-byte-order-1153"></a><a name="index-target-byte-order-1154"></a>
Some types of processors, such as the <acronym>MIPS</acronym>, PowerPC, and Renesas SH,
offer the ability to run either big-endian or little-endian byte
orders. Usually the executable or symbol will include a bit to
designate the endian-ness, and you will not need to worry about
which to use. However, you may still find it useful to adjust
<span class="sc">gdb</span>'s idea of processor endian-ness manually.
<a name="index-set-endian-1155"></a>
<dl><dt><code>set endian big</code><dd>Instruct <span class="sc">gdb</span> to assume the target is big-endian.
<br><dt><code>set endian little</code><dd>Instruct <span class="sc">gdb</span> to assume the target is little-endian.
<br><dt><code>set endian auto</code><dd>Instruct <span class="sc">gdb</span> to use the byte order associated with the
executable.
<br><dt><code>show endian</code><dd>Display <span class="sc">gdb</span>'s current idea of the target byte order.
</dl>
<p>Note that these commands merely adjust interpretation of symbolic
data on the host, and that they have absolutely no effect on the
target system.
</body></html>

View file

@ -0,0 +1,309 @@
<html lang="en">
<head>
<title>Bytecode Descriptions - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Agent-Expressions.html#Agent-Expressions" title="Agent Expressions">
<link rel="prev" href="General-Bytecode-Design.html#General-Bytecode-Design" title="General Bytecode Design">
<link rel="next" href="Using-Agent-Expressions.html#Using-Agent-Expressions" title="Using Agent Expressions">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Bytecode-Descriptions"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Using-Agent-Expressions.html#Using-Agent-Expressions">Using Agent Expressions</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="General-Bytecode-Design.html#General-Bytecode-Design">General Bytecode Design</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Agent-Expressions.html#Agent-Expressions">Agent Expressions</a>
<hr>
</div>
<h3 class="section">F.2 Bytecode Descriptions</h3>
<p>Each bytecode description has the following form:
<dl>
<dt><code>add</code> (0x02): <var>a</var> <var>b</var> <var>a+b</var><dd>
Pop the top two stack items, <var>a</var> and <var>b</var>, as integers; push
their sum, as an integer.
</dl>
<p>In this example, <code>add</code> is the name of the bytecode, and
<code>(0x02)</code> is the one-byte value used to encode the bytecode, in
hexadecimal. The phrase &ldquo;<var>a</var> <var>b</var> <var>a+b</var>&rdquo; shows
the stack before and after the bytecode executes. Beforehand, the stack
must contain at least two values, <var>a</var> and <var>b</var>; since the top of
the stack is to the right, <var>b</var> is on the top of the stack, and
<var>a</var> is underneath it. After execution, the bytecode will have
popped <var>a</var> and <var>b</var> from the stack, and replaced them with a
single value, <var>a+b</var>. There may be other values on the stack below
those shown, but the bytecode affects only those shown.
<p>Here is another example:
<dl>
<dt><code>const8</code> (0x22) <var>n</var>: <var>n</var><dd>Push the 8-bit integer constant <var>n</var> on the stack, without sign
extension.
</dl>
<p>In this example, the bytecode <code>const8</code> takes an operand <var>n</var>
directly from the bytecode stream; the operand follows the <code>const8</code>
bytecode itself. We write any such operands immediately after the name
of the bytecode, before the colon, and describe the exact encoding of
the operand in the bytecode stream in the body of the bytecode
description.
<p>For the <code>const8</code> bytecode, there are no stack items given before
the ; this simply means that the bytecode consumes no values
from the stack. If a bytecode consumes no values, or produces no
values, the list on either side of the may be empty.
<p>If a value is written as <var>a</var>, <var>b</var>, or <var>n</var>, then the bytecode
treats it as an integer. If a value is written is <var>addr</var>, then the
bytecode treats it as an address.
<p>We do not fully describe the floating point operations here; although
this design can be extended in a clean way to handle floating point
values, they are not of immediate interest to the customer, so we avoid
describing them, to save time.
<dl>
<dt><code>float</code> (0x01): <dd>
Prefix for floating-point bytecodes. Not implemented yet.
<br><dt><code>add</code> (0x02): <var>a</var> <var>b</var> <var>a+b</var><dd>Pop two integers from the stack, and push their sum, as an integer.
<br><dt><code>sub</code> (0x03): <var>a</var> <var>b</var> <var>a-b</var><dd>Pop two integers from the stack, subtract the top value from the
next-to-top value, and push the difference.
<br><dt><code>mul</code> (0x04): <var>a</var> <var>b</var> <var>a*b</var><dd>Pop two integers from the stack, multiply them, and push the product on
the stack. Note that, when one multiplies two <var>n</var>-bit numbers
yielding another <var>n</var>-bit number, it is irrelevant whether the
numbers are signed or not; the results are the same.
<br><dt><code>div_signed</code> (0x05): <var>a</var> <var>b</var> <var>a/b</var><dd>Pop two signed integers from the stack; divide the next-to-top value by
the top value, and push the quotient. If the divisor is zero, terminate
with an error.
<br><dt><code>div_unsigned</code> (0x06): <var>a</var> <var>b</var> <var>a/b</var><dd>Pop two unsigned integers from the stack; divide the next-to-top value
by the top value, and push the quotient. If the divisor is zero,
terminate with an error.
<br><dt><code>rem_signed</code> (0x07): <var>a</var> <var>b</var> <var>a modulo b</var><dd>Pop two signed integers from the stack; divide the next-to-top value by
the top value, and push the remainder. If the divisor is zero,
terminate with an error.
<br><dt><code>rem_unsigned</code> (0x08): <var>a</var> <var>b</var> <var>a modulo b</var><dd>Pop two unsigned integers from the stack; divide the next-to-top value
by the top value, and push the remainder. If the divisor is zero,
terminate with an error.
<br><dt><code>lsh</code> (0x09): <var>a</var> <var>b</var> <var>a&lt;&lt;b</var><dd>Pop two integers from the stack; let <var>a</var> be the next-to-top value,
and <var>b</var> be the top value. Shift <var>a</var> left by <var>b</var> bits, and
push the result.
<br><dt><code>rsh_signed</code> (0x0a): <var>a</var> <var>b</var> <code>(signed)</code><var>a&gt;&gt;b</var><dd>Pop two integers from the stack; let <var>a</var> be the next-to-top value,
and <var>b</var> be the top value. Shift <var>a</var> right by <var>b</var> bits,
inserting copies of the top bit at the high end, and push the result.
<br><dt><code>rsh_unsigned</code> (0x0b): <var>a</var> <var>b</var> <var>a&gt;&gt;b</var><dd>Pop two integers from the stack; let <var>a</var> be the next-to-top value,
and <var>b</var> be the top value. Shift <var>a</var> right by <var>b</var> bits,
inserting zero bits at the high end, and push the result.
<br><dt><code>log_not</code> (0x0e): <var>a</var> <var>!a</var><dd>Pop an integer from the stack; if it is zero, push the value one;
otherwise, push the value zero.
<br><dt><code>bit_and</code> (0x0f): <var>a</var> <var>b</var> <var>a&amp;b</var><dd>Pop two integers from the stack, and push their bitwise <code>and</code>.
<br><dt><code>bit_or</code> (0x10): <var>a</var> <var>b</var> <var>a|b</var><dd>Pop two integers from the stack, and push their bitwise <code>or</code>.
<br><dt><code>bit_xor</code> (0x11): <var>a</var> <var>b</var> <var>a^b</var><dd>Pop two integers from the stack, and push their bitwise
exclusive-<code>or</code>.
<br><dt><code>bit_not</code> (0x12): <var>a</var> <var>~a</var><dd>Pop an integer from the stack, and push its bitwise complement.
<br><dt><code>equal</code> (0x13): <var>a</var> <var>b</var> <var>a=b</var><dd>Pop two integers from the stack; if they are equal, push the value one;
otherwise, push the value zero.
<br><dt><code>less_signed</code> (0x14): <var>a</var> <var>b</var> <var>a&lt;b</var><dd>Pop two signed integers from the stack; if the next-to-top value is less
than the top value, push the value one; otherwise, push the value zero.
<br><dt><code>less_unsigned</code> (0x15): <var>a</var> <var>b</var> <var>a&lt;b</var><dd>Pop two unsigned integers from the stack; if the next-to-top value is less
than the top value, push the value one; otherwise, push the value zero.
<br><dt><code>ext</code> (0x16) <var>n</var>: <var>a</var> <var>a</var>, sign-extended from <var>n</var> bits<dd>Pop an unsigned value from the stack; treating it as an <var>n</var>-bit
twos-complement value, extend it to full length. This means that all
bits to the left of bit <var>n-1</var> (where the least significant bit is bit
0) are set to the value of bit <var>n-1</var>. Note that <var>n</var> may be
larger than or equal to the width of the stack elements of the bytecode
engine; in this case, the bytecode should have no effect.
<p>The number of source bits to preserve, <var>n</var>, is encoded as a single
byte unsigned integer following the <code>ext</code> bytecode.
<br><dt><code>zero_ext</code> (0x2a) <var>n</var>: <var>a</var> <var>a</var>, zero-extended from <var>n</var> bits<dd>Pop an unsigned value from the stack; zero all but the bottom <var>n</var>
bits. This means that all bits to the left of bit <var>n-1</var> (where the
least significant bit is bit 0) are set to the value of bit <var>n-1</var>.
<p>The number of source bits to preserve, <var>n</var>, is encoded as a single
byte unsigned integer following the <code>zero_ext</code> bytecode.
<br><dt><code>ref8</code> (0x17): <var>addr</var> <var>a</var><dt><code>ref16</code> (0x18): <var>addr</var> <var>a</var><dt><code>ref32</code> (0x19): <var>addr</var> <var>a</var><dt><code>ref64</code> (0x1a): <var>addr</var> <var>a</var><dd>Pop an address <var>addr</var> from the stack. For bytecode
<code>ref</code><var>n</var>, fetch an <var>n</var>-bit value from <var>addr</var>, using the
natural target endianness. Push the fetched value as an unsigned
integer.
<p>Note that <var>addr</var> may not be aligned in any particular way; the
<code>ref</code><var>n</var> bytecodes should operate correctly for any address.
<p>If attempting to access memory at <var>addr</var> would cause a processor
exception of some sort, terminate with an error.
<br><dt><code>ref_float</code> (0x1b): <var>addr</var> <var>d</var><dt><code>ref_double</code> (0x1c): <var>addr</var> <var>d</var><dt><code>ref_long_double</code> (0x1d): <var>addr</var> <var>d</var><dt><code>l_to_d</code> (0x1e): <var>a</var> <var>d</var><dt><code>d_to_l</code> (0x1f): <var>d</var> <var>a</var><dd>Not implemented yet.
<br><dt><code>dup</code> (0x28): <var>a</var> =&gt; <var>a</var> <var>a</var><dd>Push another copy of the stack's top element.
<br><dt><code>swap</code> (0x2b): <var>a</var> <var>b</var> =&gt; <var>b</var> <var>a</var><dd>Exchange the top two items on the stack.
<br><dt><code>pop</code> (0x29): <var>a</var> =&gt;<dd>Discard the top value on the stack.
<br><dt><code>pick</code> (0x32) <var>n</var>: <var>a</var> <small class="dots">...</small> <var>b</var> =&gt; <var>a</var> <small class="dots">...</small> <var>b</var> <var>a</var><dd>Duplicate an item from the stack and push it on the top of the stack.
<var>n</var>, a single byte, indicates the stack item to copy. If <var>n</var>
is zero, this is the same as <code>dup</code>; if <var>n</var> is one, it copies
the item under the top item, etc. If <var>n</var> exceeds the number of
items on the stack, terminate with an error.
<br><dt><code>rot</code> (0x33): <var>a</var> <var>b</var> <var>c</var> =&gt; <var>c</var> <var>b</var> <var>a</var><dd>Rotate the top three items on the stack.
<br><dt><code>if_goto</code> (0x20) <var>offset</var>: <var>a</var> <dd>Pop an integer off the stack; if it is non-zero, branch to the given
offset in the bytecode string. Otherwise, continue to the next
instruction in the bytecode stream. In other words, if <var>a</var> is
non-zero, set the <code>pc</code> register to <code>start</code> + <var>offset</var>.
Thus, an offset of zero denotes the beginning of the expression.
<p>The <var>offset</var> is stored as a sixteen-bit unsigned value, stored
immediately following the <code>if_goto</code> bytecode. It is always stored
most significant byte first, regardless of the target's normal
endianness. The offset is not guaranteed to fall at any particular
alignment within the bytecode stream; thus, on machines where fetching a
16-bit on an unaligned address raises an exception, you should fetch the
offset one byte at a time.
<br><dt><code>goto</code> (0x21) <var>offset</var>: <dd>Branch unconditionally to <var>offset</var>; in other words, set the
<code>pc</code> register to <code>start</code> + <var>offset</var>.
<p>The offset is stored in the same way as for the <code>if_goto</code> bytecode.
<br><dt><code>const8</code> (0x22) <var>n</var>: <var>n</var><dt><code>const16</code> (0x23) <var>n</var>: <var>n</var><dt><code>const32</code> (0x24) <var>n</var>: <var>n</var><dt><code>const64</code> (0x25) <var>n</var>: <var>n</var><dd>Push the integer constant <var>n</var> on the stack, without sign extension.
To produce a small negative value, push a small twos-complement value,
and then sign-extend it using the <code>ext</code> bytecode.
<p>The constant <var>n</var> is stored in the appropriate number of bytes
following the <code>const</code><var>b</var> bytecode. The constant <var>n</var> is
always stored most significant byte first, regardless of the target's
normal endianness. The constant is not guaranteed to fall at any
particular alignment within the bytecode stream; thus, on machines where
fetching a 16-bit on an unaligned address raises an exception, you
should fetch <var>n</var> one byte at a time.
<br><dt><code>reg</code> (0x26) <var>n</var>: <var>a</var><dd>Push the value of register number <var>n</var>, without sign extension. The
registers are numbered following GDB's conventions.
<p>The register number <var>n</var> is encoded as a 16-bit unsigned integer
immediately following the <code>reg</code> bytecode. It is always stored most
significant byte first, regardless of the target's normal endianness.
The register number is not guaranteed to fall at any particular
alignment within the bytecode stream; thus, on machines where fetching a
16-bit on an unaligned address raises an exception, you should fetch the
register number one byte at a time.
<br><dt><code>getv</code> (0x2c) <var>n</var>: <var>v</var><dd>Push the value of trace state variable number <var>n</var>, without sign
extension.
<p>The variable number <var>n</var> is encoded as a 16-bit unsigned integer
immediately following the <code>getv</code> bytecode. It is always stored most
significant byte first, regardless of the target's normal endianness.
The variable number is not guaranteed to fall at any particular
alignment within the bytecode stream; thus, on machines where fetching a
16-bit on an unaligned address raises an exception, you should fetch the
register number one byte at a time.
<br><dt><code>setv</code> (0x2d) <var>n</var>: <var>v</var><dd>Set trace state variable number <var>n</var> to the value found on the top
of the stack. The stack is unchanged, so that the value is readily
available if the assignment is part of a larger expression. The
handling of <var>n</var> is as described for <code>getv</code>.
<br><dt><code>trace</code> (0x0c): <var>addr</var> <var>size</var> <dd>Record the contents of the <var>size</var> bytes at <var>addr</var> in a trace
buffer, for later retrieval by GDB.
<br><dt><code>trace_quick</code> (0x0d) <var>size</var>: <var>addr</var> <var>addr</var><dd>Record the contents of the <var>size</var> bytes at <var>addr</var> in a trace
buffer, for later retrieval by GDB. <var>size</var> is a single byte
unsigned integer following the <code>trace</code> opcode.
<p>This bytecode is equivalent to the sequence <code>dup const8 </code><var>size</var><code>
trace</code>, but we provide it anyway to save space in bytecode strings.
<br><dt><code>trace16</code> (0x30) <var>size</var>: <var>addr</var> <var>addr</var><dd>Identical to trace_quick, except that <var>size</var> is a 16-bit big-endian
unsigned integer, not a single byte. This should probably have been
named <code>trace_quick16</code>, for consistency.
<br><dt><code>tracev</code> (0x2e) <var>n</var>: <var>a</var><dd>Record the value of trace state variable number <var>n</var> in the trace
buffer. The handling of <var>n</var> is as described for <code>getv</code>.
<br><dt><code>tracenz</code> (0x2f) <var>addr</var> <var>size</var> <dd>Record the bytes at <var>addr</var> in a trace buffer, for later retrieval
by GDB. Stop at either the first zero byte, or when <var>size</var> bytes
have been recorded, whichever occurs first.
<br><dt><code>printf</code> (0x34) <var>numargs</var> <var>string</var> <dd>Do a formatted print, in the style of the C function <code>printf</code>).
The value of <var>numargs</var> is the number of arguments to expect on the
stack, while <var>string</var> is the format string, prefixed with a
two-byte length. The last byte of the string must be zero, and is
included in the length. The format string includes escaped sequences
just as it appears in C source, so for instance the format string
<code>"\t%d\n"</code> is six characters long, and the output will consist of
a tab character, a decimal number, and a newline. At the top of the
stack, above the values to be printed, this bytecode will pop a
&ldquo;function&rdquo; and &ldquo;channel&rdquo;. If the function is nonzero, then the
target may treat it as a function and call it, passing the channel as
a first argument, as with the C function <code>fprintf</code>. If the
function is zero, then the target may simply call a standard formatted
print function of its choice. In all, this bytecode pops 2 +
<var>numargs</var> stack elements, and pushes nothing.
<br><dt><code>end</code> (0x27): <dd>Stop executing bytecode; the result should be the top element of the
stack. If the purpose of the expression was to compute an lvalue or a
range of memory, then the next-to-top of the stack is the lvalue's
address, and the top of the stack is the lvalue's size, in bytes.
</dl>
</body></html>

View file

@ -0,0 +1,61 @@
<html lang="en">
<head>
<title>C Checks - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="C.html#C" title="C">
<link rel="prev" href="C-Defaults.html#C-Defaults" title="C Defaults">
<link rel="next" href="Debugging-C.html#Debugging-C" title="Debugging C">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="C-Checks"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Debugging-C.html#Debugging-C">Debugging C</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="C-Defaults.html#C-Defaults">C Defaults</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="C.html#C">C</a>
<hr>
</div>
<h5 class="subsubsection">15.4.1.5 C and C<tt>++</tt> Type and Range Checks</h5>
<p><a name="index-C-and-C_0040t_007b_002b_002b_007d-checks-885"></a>
By default, when <span class="sc">gdb</span> parses C or C<tt>++</tt> expressions, strict type
checking is used. However, if you turn type checking off, <span class="sc">gdb</span>
will allow certain non-standard conversions, such as promoting integer
constants to pointers.
<p>Range checking, if turned on, is done on mathematical operations. Array
indices are not checked, since they are often used to index a pointer
that is not itself an array.
</body></html>

View file

@ -0,0 +1,109 @@
<html lang="en">
<head>
<title>C Constants - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="C.html#C" title="C">
<link rel="prev" href="C-Operators.html#C-Operators" title="C Operators">
<link rel="next" href="C-Plus-Plus-Expressions.html#C-Plus-Plus-Expressions" title="C Plus Plus Expressions">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="C-Constants"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="C-Plus-Plus-Expressions.html#C-Plus-Plus-Expressions">C Plus Plus Expressions</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="C-Operators.html#C-Operators">C Operators</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="C.html#C">C</a>
<hr>
</div>
<h5 class="subsubsection">15.4.1.2 C and C<tt>++</tt> Constants</h5>
<p><a name="index-C-and-C_0040t_007b_002b_002b_007d-constants-871"></a>
<span class="sc">gdb</span> allows you to express the constants of C and C<tt>++</tt> in the
following ways:
<ul>
<li>Integer constants are a sequence of digits. Octal constants are
specified by a leading &lsquo;<samp><span class="samp">0</span></samp>&rsquo; (i.e. zero), and hexadecimal constants
by a leading &lsquo;<samp><span class="samp">0x</span></samp>&rsquo; or &lsquo;<samp><span class="samp">0X</span></samp>&rsquo;. Constants may also end with a letter
&lsquo;<samp><span class="samp">l</span></samp>&rsquo;, specifying that the constant should be treated as a
<code>long</code> value.
<li>Floating point constants are a sequence of digits, followed by a decimal
point, followed by a sequence of digits, and optionally followed by an
exponent. An exponent is of the form:
&lsquo;<samp><span class="samp">e[[+]|-]</span><var>nnn</var><span class="samp"><!-- /@w --></span></samp>&rsquo;, where <var>nnn</var> is another
sequence of digits. The &lsquo;<samp><span class="samp">+</span></samp>&rsquo; is optional for positive exponents.
A floating-point constant may also end with a letter &lsquo;<samp><span class="samp">f</span></samp>&rsquo; or
&lsquo;<samp><span class="samp">F</span></samp>&rsquo;, specifying that the constant should be treated as being of
the <code>float</code> (as opposed to the default <code>double</code>) type; or with
a letter &lsquo;<samp><span class="samp">l</span></samp>&rsquo; or &lsquo;<samp><span class="samp">L</span></samp>&rsquo;, which specifies a <code>long double</code>
constant.
<li>Enumerated constants consist of enumerated identifiers, or their
integral equivalents.
<li>Character constants are a single character surrounded by single quotes
(<code>'</code>), or a number&mdash;the ordinal value of the corresponding character
(usually its <span class="sc">ascii</span> value). Within quotes, the single character may
be represented by a letter or by <dfn>escape sequences</dfn>, which are of
the form &lsquo;<samp><span class="samp">\</span><var>nnn</var></samp>&rsquo;, where <var>nnn</var> is the octal representation
of the character's ordinal value; or of the form &lsquo;<samp><span class="samp">\</span><var>x</var></samp>&rsquo;, where
&lsquo;<samp><var>x</var></samp>&rsquo; is a predefined special character&mdash;for example,
&lsquo;<samp><span class="samp">\n</span></samp>&rsquo; for newline.
<p>Wide character constants can be written by prefixing a character
constant with &lsquo;<samp><span class="samp">L</span></samp>&rsquo;, as in C. For example, &lsquo;<samp><span class="samp">L'x'</span></samp>&rsquo; is the wide
form of &lsquo;<samp><span class="samp">x</span></samp>&rsquo;. The target wide character set is used when
computing the value of this constant (see <a href="Character-Sets.html#Character-Sets">Character Sets</a>).
<li>String constants are a sequence of character constants surrounded by
double quotes (<code>"</code>). Any valid character constant (as described
above) may appear. Double quotes within the string must be preceded by
a backslash, so for instance &lsquo;<samp><span class="samp">"a\"b'c"</span></samp>&rsquo; is a string of five
characters.
<p>Wide string constants can be written by prefixing a string constant
with &lsquo;<samp><span class="samp">L</span></samp>&rsquo;, as in C. The target wide character set is used when
computing the value of this constant (see <a href="Character-Sets.html#Character-Sets">Character Sets</a>).
<li>Pointer constants are an integral value. You can also write pointers
to constants using the C operator &lsquo;<samp><span class="samp">&amp;</span></samp>&rsquo;.
<li>Array constants are comma-separated lists surrounded by braces &lsquo;<samp><span class="samp">{</span></samp>&rsquo;
and &lsquo;<samp><span class="samp">}</span></samp>&rsquo;; for example, &lsquo;<samp><span class="samp">{1,2,3}</span></samp>&rsquo; is a three-element array of
integers, &lsquo;<samp><span class="samp">{{1,2}, {3,4}, {5,6}}</span></samp>&rsquo; is a three-by-two array,
and &lsquo;<samp><span class="samp">{&amp;"hi", &amp;"there", &amp;"fred"}</span></samp>&rsquo; is a three-element array of pointers.
</ul>
</body></html>

View file

@ -0,0 +1,64 @@
<html lang="en">
<head>
<title>C Defaults - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="C.html#C" title="C">
<link rel="prev" href="C-Plus-Plus-Expressions.html#C-Plus-Plus-Expressions" title="C Plus Plus Expressions">
<link rel="next" href="C-Checks.html#C-Checks" title="C Checks">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="C-Defaults"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="C-Checks.html#C-Checks">C Checks</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="C-Plus-Plus-Expressions.html#C-Plus-Plus-Expressions">C Plus Plus Expressions</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="C.html#C">C</a>
<hr>
</div>
<h5 class="subsubsection">15.4.1.4 C and C<tt>++</tt> Defaults</h5>
<p><a name="index-C-and-C_0040t_007b_002b_002b_007d-defaults-884"></a>
If you allow <span class="sc">gdb</span> to set range checking automatically, it
defaults to <code>off</code> whenever the working language changes to
C or C<tt>++</tt>. This happens regardless of whether you or <span class="sc">gdb</span>
selects the working language.
<p>If you allow <span class="sc">gdb</span> to set the language automatically, it
recognizes source files whose names end with <samp><span class="file">.c</span></samp>, <samp><span class="file">.C</span></samp>, or
<samp><span class="file">.cc</span></samp>, etc, and when <span class="sc">gdb</span> enters code compiled from one of
these files, it sets the working language to C or C<tt>++</tt>.
See <a href="Automatically.html#Automatically">Having <span class="sc">gdb</span> Infer the Source Language</a>,
for further details.
</body></html>

View file

@ -0,0 +1,167 @@
<html lang="en">
<head>
<title>C Operators - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="C.html#C" title="C">
<link rel="next" href="C-Constants.html#C-Constants" title="C Constants">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="C-Operators"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="C-Constants.html#C-Constants">C Constants</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="C.html#C">C</a>
<hr>
</div>
<h5 class="subsubsection">15.4.1.1 C and C<tt>++</tt> Operators</h5>
<p><a name="index-C-and-C_0040t_007b_002b_002b_007d-operators-870"></a>
Operators must be defined on values of specific types. For instance,
<code>+</code> is defined on numbers, but not on structures. Operators are
often defined on groups of types.
<p>For the purposes of C and C<tt>++</tt>, the following definitions hold:
<ul>
<li><em>Integral types</em> include <code>int</code> with any of its storage-class
specifiers; <code>char</code>; <code>enum</code>; and, for C<tt>++</tt>, <code>bool</code>.
<li><em>Floating-point types</em> include <code>float</code>, <code>double</code>, and
<code>long double</code> (if supported by the target platform).
<li><em>Pointer types</em> include all types defined as <code>(</code><var>type</var><code> *)</code>.
<li><em>Scalar types</em> include all of the above.
</ul>
<p class="noindent">The following operators are supported. They are listed here
in order of increasing precedence:
<dl>
<dt><code>,</code><dd>The comma or sequencing operator. Expressions in a comma-separated list
are evaluated from left to right, with the result of the entire
expression being the last expression evaluated.
<br><dt><code>=</code><dd>Assignment. The value of an assignment expression is the value
assigned. Defined on scalar types.
<br><dt><var>op</var><code>=</code><dd>Used in an expression of the form <var>a</var><code>&nbsp;</code><var>op</var><code>=&nbsp;</code><var>b</var><!-- /@w -->,
and translated to <var>a</var><code>&nbsp;=&nbsp;</code><var>a&nbsp;op&nbsp;b</var><!-- /@w -->.
<var>op</var><code>=</code><!-- /@w --> and <code>=</code> have the same precedence.
<var>op</var> is any one of the operators <code>|</code>, <code>^</code>, <code>&amp;</code>,
<code>&lt;&lt;</code>, <code>&gt;&gt;</code>, <code>+</code>, <code>-</code>, <code>*</code>, <code>/</code>, <code>%</code>.
<br><dt><code>?:</code><dd>The ternary operator. <var>a</var><code> ? </code><var>b</var><code> : </code><var>c</var> can be thought
of as: if <var>a</var> then <var>b</var> else <var>c</var>. <var>a</var> should be of an
integral type.
<br><dt><code>||</code><dd>Logical <span class="sc">or</span>. Defined on integral types.
<br><dt><code>&amp;&amp;</code><dd>Logical <span class="sc">and</span>. Defined on integral types.
<br><dt><code>|</code><dd>Bitwise <span class="sc">or</span>. Defined on integral types.
<br><dt><code>^</code><dd>Bitwise exclusive-<span class="sc">or</span>. Defined on integral types.
<br><dt><code>&amp;</code><dd>Bitwise <span class="sc">and</span>. Defined on integral types.
<br><dt><code>==</code><span class="roman">, </span><code>!=</code><dd>Equality and inequality. Defined on scalar types. The value of these
expressions is 0 for false and non-zero for true.
<br><dt><code>&lt;</code><span class="roman">, </span><code>&gt;</code><span class="roman">, </span><code>&lt;=</code><span class="roman">, </span><code>&gt;=</code><dd>Less than, greater than, less than or equal, greater than or equal.
Defined on scalar types. The value of these expressions is 0 for false
and non-zero for true.
<br><dt><code>&lt;&lt;</code><span class="roman">, </span><code>&gt;&gt;</code><dd>left shift, and right shift. Defined on integral types.
<br><dt><code>@</code><dd>The <span class="sc">gdb</span> &ldquo;artificial array&rdquo; operator (see <a href="Expressions.html#Expressions">Expressions</a>).
<br><dt><code>+</code><span class="roman">, </span><code>-</code><dd>Addition and subtraction. Defined on integral types, floating-point types and
pointer types.
<br><dt><code>*</code><span class="roman">, </span><code>/</code><span class="roman">, </span><code>%</code><dd>Multiplication, division, and modulus. Multiplication and division are
defined on integral and floating-point types. Modulus is defined on
integral types.
<br><dt><code>++</code><span class="roman">, </span><code>--</code><dd>Increment and decrement. When appearing before a variable, the
operation is performed before the variable is used in an expression;
when appearing after it, the variable's value is used before the
operation takes place.
<br><dt><code>*</code><dd>Pointer dereferencing. Defined on pointer types. Same precedence as
<code>++</code>.
<br><dt><code>&amp;</code><dd>Address operator. Defined on variables. Same precedence as <code>++</code>.
<p>For debugging C<tt>++</tt>, <span class="sc">gdb</span> implements a use of &lsquo;<samp><span class="samp">&amp;</span></samp>&rsquo; beyond what is
allowed in the C<tt>++</tt> language itself: you can use &lsquo;<samp><span class="samp">&amp;(&amp;</span><var>ref</var><span class="samp">)</span></samp>&rsquo;
to examine the address
where a C<tt>++</tt> reference variable (declared with &lsquo;<samp><span class="samp">&amp;</span><var>ref</var></samp>&rsquo;) is
stored.
<br><dt><code>-</code><dd>Negative. Defined on integral and floating-point types. Same
precedence as <code>++</code>.
<br><dt><code>!</code><dd>Logical negation. Defined on integral types. Same precedence as
<code>++</code>.
<br><dt><code>~</code><dd>Bitwise complement operator. Defined on integral types. Same precedence as
<code>++</code>.
<br><dt><code>.</code><span class="roman">, </span><code>-&gt;</code><dd>Structure member, and pointer-to-structure member. For convenience,
<span class="sc">gdb</span> regards the two as equivalent, choosing whether to dereference a
pointer based on the stored type information.
Defined on <code>struct</code> and <code>union</code> data.
<br><dt><code>.*</code><span class="roman">, </span><code>-&gt;*</code><dd>Dereferences of pointers to members.
<br><dt><code>[]</code><dd>Array indexing. <var>a</var><code>[</code><var>i</var><code>]</code> is defined as
<code>*(</code><var>a</var><code>+</code><var>i</var><code>)</code>. Same precedence as <code>-&gt;</code>.
<br><dt><code>()</code><dd>Function parameter list. Same precedence as <code>-&gt;</code>.
<br><dt><code>::</code><dd>C<tt>++</tt> scope resolution operator. Defined on <code>struct</code>, <code>union</code>,
and <code>class</code> types.
<br><dt><code>::</code><dd>Doubled colons also represent the <span class="sc">gdb</span> scope operator
(see <a href="Expressions.html#Expressions">Expressions</a>). Same precedence as <code>::</code>,
above.
</dl>
<p>If an operator is redefined in the user code, <span class="sc">gdb</span> usually
attempts to invoke the redefined version instead of using the operator's
predefined meaning.
</body></html>

View file

@ -0,0 +1,121 @@
<html lang="en">
<head>
<title>C Plus Plus Expressions - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="C.html#C" title="C">
<link rel="prev" href="C-Constants.html#C-Constants" title="C Constants">
<link rel="next" href="C-Defaults.html#C-Defaults" title="C Defaults">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="C-Plus-Plus-Expressions"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="C-Defaults.html#C-Defaults">C Defaults</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="C-Constants.html#C-Constants">C Constants</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="C.html#C">C</a>
<hr>
</div>
<h5 class="subsubsection">15.4.1.3 C<tt>++</tt> Expressions</h5>
<p><a name="index-expressions-in-C_0040t_007b_002b_002b_007d-872"></a><span class="sc">gdb</span> expression handling can interpret most C<tt>++</tt> expressions.
<p><a name="index-debugging-C_0040t_007b_002b_002b_007d-programs-873"></a><a name="index-C_0040t_007b_002b_002b_007d-compilers-874"></a><a name="index-debug-formats-and-C_0040t_007b_002b_002b_007d-875"></a><a name="index-g_t_0040value_007bNGCC_007d-and-C_0040t_007b_002b_002b_007d-876"></a><blockquote>
<em>Warning:</em> <span class="sc">gdb</span> can only debug C<tt>++</tt> code if you use
the proper compiler and the proper debug format. Currently,
<span class="sc">gdb</span> works best when debugging C<tt>++</tt> code that is compiled
with the most recent version of <span class="sc">gcc</span> possible. The DWARF
debugging format is preferred; <span class="sc">gcc</span> defaults to this on most
popular platforms. Other compilers and/or debug formats are likely to
work badly or not at all when using <span class="sc">gdb</span> to debug C<tt>++</tt>
code. See <a href="Compilation.html#Compilation">Compilation</a>.
</blockquote>
<ol type=1 start=1>
<p><a name="index-member-functions-877"></a><li>Member function calls are allowed; you can use expressions like
<pre class="smallexample"> count = aml-&gt;GetOriginal(x, y)
</pre>
<p><a name="index-this_0040r_007b_002c-inside-C_0040t_007b_002b_002b_007d-member-functions_007d-878"></a><a name="index-namespace-in-C_0040t_007b_002b_002b_007d-879"></a><li>While a member function is active (in the selected stack frame), your
expressions have the same namespace available as the member function;
that is, <span class="sc">gdb</span> allows implicit references to the class instance
pointer <code>this</code> following the same rules as C<tt>++</tt>. <code>using</code>
declarations in the current scope are also respected by <span class="sc">gdb</span>.
<p><a name="index-call-overloaded-functions-880"></a><a name="index-overloaded-functions_002c-calling-881"></a><a name="index-type-conversions-in-C_0040t_007b_002b_002b_007d-882"></a><li>You can call overloaded functions; <span class="sc">gdb</span> resolves the function
call to the right definition, with some restrictions. <span class="sc">gdb</span> does not
perform overload resolution involving user-defined type conversions,
calls to constructors, or instantiations of templates that do not exist
in the program. It also cannot handle ellipsis argument lists or
default arguments.
<p>It does perform integral conversions and promotions, floating-point
promotions, arithmetic conversions, pointer conversions, conversions of
class objects to base classes, and standard conversions such as those of
functions or arrays to pointers; it requires an exact match on the
number of function arguments.
<p>Overload resolution is always performed, unless you have specified
<code>set overload-resolution off</code>. See <a href="Debugging-C-Plus-Plus.html#Debugging-C-Plus-Plus"><span class="sc">gdb</span> Features for C<tt>++</tt></a>.
<p>You must specify <code>set overload-resolution off</code> in order to use an
explicit function signature to call an overloaded function, as in
<pre class="smallexample"> p 'foo(char,int)'('x', 13)
</pre>
<p>The <span class="sc">gdb</span> command-completion facility can simplify this;
see <a href="Completion.html#Completion">Command Completion</a>.
<p><a name="index-reference-declarations-883"></a><li><span class="sc">gdb</span> understands variables declared as C<tt>++</tt> references; you can use
them in expressions just as you do in C<tt>++</tt> source&mdash;they are automatically
dereferenced.
<p>In the parameter list shown when <span class="sc">gdb</span> displays a frame, the values of
reference variables are not displayed (unlike other variables); this
avoids clutter, since references are often used for large structures.
The <em>address</em> of a reference variable is always shown, unless
you have specified &lsquo;<samp><span class="samp">set print address off</span></samp>&rsquo;.
<li><span class="sc">gdb</span> supports the C<tt>++</tt> name resolution operator <code>::</code>&mdash;your
expressions can use it just as expressions in your program do. Since
one scope may be defined in another, you can use <code>::</code> repeatedly if
necessary, for example in an expression like
&lsquo;<samp><var>scope1</var><span class="samp">::</span><var>scope2</var><span class="samp">::</span><var>name</var></samp>&rsquo;. <span class="sc">gdb</span> also allows
resolving name scope by reference to source files, in both C and C<tt>++</tt>
debugging (see <a href="Variables.html#Variables">Program Variables</a>).
<li><span class="sc">gdb</span> performs argument-dependent lookup, following the C<tt>++</tt>
specification.
</ol>
</body></html>

View file

@ -0,0 +1,71 @@
<html lang="en">
<head>
<title>C - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Supported-Languages.html#Supported-Languages" title="Supported Languages">
<link rel="next" href="D.html#D" title="D">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="C"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="D.html#D">D</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Supported-Languages.html#Supported-Languages">Supported Languages</a>
<hr>
</div>
<h4 class="subsection">15.4.1 C and C<tt>++</tt></h4>
<p><a name="index-C-and-C_0040t_007b_002b_002b_007d-865"></a><a name="index-expressions-in-C-or-C_0040t_007b_002b_002b_007d-866"></a>
Since C and C<tt>++</tt> are so closely related, many features of <span class="sc">gdb</span> apply
to both languages. Whenever this is the case, we discuss those languages
together.
<p><a name="index-C_0040t_007b_002b_002b_007d-867"></a><a name="index-g_t_0040code_007bg_002b_002b_007d_002c-_0040sc_007bgnu_007d-C_0040t_007b_002b_002b_007d-compiler-868"></a><a name="index-g_t_0040sc_007bgnu_007d-C_0040t_007b_002b_002b_007d-869"></a>The C<tt>++</tt> debugging facilities are jointly implemented by the C<tt>++</tt>
compiler and <span class="sc">gdb</span>. Therefore, to debug your C<tt>++</tt> code
effectively, you must compile your C<tt>++</tt> programs with a supported
C<tt>++</tt> compiler, such as <span class="sc">gnu</span> <code>g++</code>, or the HP ANSI C<tt>++</tt>
compiler (<code>aCC</code>).
<ul class="menu">
<li><a accesskey="1" href="C-Operators.html#C-Operators">C Operators</a>: C and C<tt>++</tt> operators
<li><a accesskey="2" href="C-Constants.html#C-Constants">C Constants</a>: C and C<tt>++</tt> constants
<li><a accesskey="3" href="C-Plus-Plus-Expressions.html#C-Plus-Plus-Expressions">C Plus Plus Expressions</a>: C<tt>++</tt> expressions
<li><a accesskey="4" href="C-Defaults.html#C-Defaults">C Defaults</a>: Default settings for C and C<tt>++</tt>
<li><a accesskey="5" href="C-Checks.html#C-Checks">C Checks</a>: C and C<tt>++</tt> type and range checks
<li><a accesskey="6" href="Debugging-C.html#Debugging-C">Debugging C</a>: <span class="sc">gdb</span> and C
<li><a accesskey="7" href="Debugging-C-Plus-Plus.html#Debugging-C-Plus-Plus">Debugging C Plus Plus</a>: <span class="sc">gdb</span> features for C<tt>++</tt>
<li><a accesskey="8" href="Decimal-Floating-Point.html#Decimal-Floating-Point">Decimal Floating Point</a>: Numbers in Decimal Floating Point format
</ul>
</body></html>

View file

@ -0,0 +1,75 @@
<html lang="en">
<head>
<title>CRIS - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Embedded-Processors.html#Embedded-Processors" title="Embedded Processors">
<link rel="prev" href="AVR.html#AVR" title="AVR">
<link rel="next" href="Super_002dH.html#Super_002dH" title="Super-H">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="CRIS"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Super_002dH.html#Super_002dH">Super-H</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="AVR.html#AVR">AVR</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Embedded-Processors.html#Embedded-Processors">Embedded Processors</a>
<hr>
</div>
<h4 class="subsection">21.3.13 CRIS</h4>
<p><a name="index-CRIS-1493"></a>
When configured for debugging CRIS, <span class="sc">gdb</span> provides the
following CRIS-specific commands:
<dl>
<dt><code>set cris-version </code><var>ver</var><dd><a name="index-CRIS-version-1494"></a>Set the current CRIS version to <var>ver</var>, either &lsquo;<samp><span class="samp">10</span></samp>&rsquo; or &lsquo;<samp><span class="samp">32</span></samp>&rsquo;.
The CRIS version affects register names and sizes. This command is useful in
case autodetection of the CRIS version fails.
<br><dt><code>show cris-version</code><dd>Show the current CRIS version.
<br><dt><code>set cris-dwarf2-cfi</code><dd><a name="index-DWARF_002d2-CFI-and-CRIS-1495"></a>Set the usage of DWARF-2 CFI for CRIS debugging. The default is &lsquo;<samp><span class="samp">on</span></samp>&rsquo;.
Change to &lsquo;<samp><span class="samp">off</span></samp>&rsquo; when using <code>gcc-cris</code> whose version is below
<code>R59</code>.
<br><dt><code>show cris-dwarf2-cfi</code><dd>Show the current state of using DWARF-2 CFI.
<br><dt><code>set cris-mode </code><var>mode</var><dd><a name="index-CRIS-mode-1496"></a>Set the current CRIS mode to <var>mode</var>. It should only be changed when
debugging in guru mode, in which case it should be set to
&lsquo;<samp><span class="samp">guru</span></samp>&rsquo; (the default is &lsquo;<samp><span class="samp">normal</span></samp>&rsquo;).
<br><dt><code>show cris-mode</code><dd>Show the current CRIS mode.
</dl>
</body></html>

View file

@ -0,0 +1,106 @@
<html lang="en">
<head>
<title>Caching Remote Data - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Data.html#Data" title="Data">
<link rel="prev" href="Character-Sets.html#Character-Sets" title="Character Sets">
<link rel="next" href="Searching-Memory.html#Searching-Memory" title="Searching Memory">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Caching-Remote-Data"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Searching-Memory.html#Searching-Memory">Searching Memory</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Character-Sets.html#Character-Sets">Character Sets</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Data.html#Data">Data</a>
<hr>
</div>
<h3 class="section">10.21 Caching Data of Remote Targets</h3>
<p><a name="index-caching-data-of-remote-targets-706"></a>
<span class="sc">gdb</span> caches data exchanged between the debugger and a
remote target (see <a href="Remote-Debugging.html#Remote-Debugging">Remote Debugging</a>). Such caching generally improves
performance, because it reduces the overhead of the remote protocol by
bundling memory reads and writes into large chunks. Unfortunately, simply
caching everything would lead to incorrect results, since <span class="sc">gdb</span>
does not necessarily know anything about volatile values, memory-mapped I/O
addresses, etc. Furthermore, in non-stop mode (see <a href="Non_002dStop-Mode.html#Non_002dStop-Mode">Non-Stop Mode</a>)
memory can be changed <em>while</em> a gdb command is executing.
Therefore, by default, <span class="sc">gdb</span> only caches data
known to be on the stack<a rel="footnote" href="#fn-1" name="fnd-1"><sup>1</sup></a>.
Other regions of memory can be explicitly marked as
cacheable; see see <a href="Memory-Region-Attributes.html#Memory-Region-Attributes">Memory Region Attributes</a>.
<a name="index-set-remotecache-707"></a>
<dl><dt><code>set remotecache on</code><dt><code>set remotecache off</code><dd>This option no longer does anything; it exists for compatibility
with old scripts.
<p><a name="index-show-remotecache-708"></a><br><dt><code>show remotecache</code><dd>Show the current state of the obsolete remotecache flag.
<p><a name="index-set-stack_002dcache-709"></a><br><dt><code>set stack-cache on</code><dt><code>set stack-cache off</code><dd>Enable or disable caching of stack accesses. When <code>ON</code>, use
caching. By default, this option is <code>ON</code>.
<p><a name="index-show-stack_002dcache-710"></a><br><dt><code>show stack-cache</code><dd>Show the current state of data caching for memory accesses.
<p><a name="index-info-dcache-711"></a><br><dt><code>info dcache </code><span class="roman">[</span><code>line</code><span class="roman">]</span><dd>Print the information about the data cache performance. The
information displayed includes the dcache width and depth, and for
each cache line, its number, address, and how many times it was
referenced. This command is useful for debugging the data cache
operation.
<p>If a line number is specified, the contents of that line will be
printed in hex.
<br><dt><code>set dcache size </code><var>size</var><dd><a name="index-dcache-size-712"></a><a name="index-set-dcache-size-713"></a>Set maximum number of entries in dcache (dcache depth above).
<br><dt><code>set dcache line-size </code><var>line-size</var><dd><a name="index-dcache-line_002dsize-714"></a><a name="index-set-dcache-line_002dsize-715"></a>Set number of bytes each dcache entry caches (dcache width above).
Must be a power of 2.
<br><dt><code>show dcache size</code><dd><a name="index-show-dcache-size-716"></a>Show maximum number of dcache entries. See also <a href="Caching-Remote-Data.html#Caching-Remote-Data">info dcache</a>.
<br><dt><code>show dcache line-size</code><dd><a name="index-show-dcache-line_002dsize-717"></a>Show default size of dcache lines. See also <a href="Caching-Remote-Data.html#Caching-Remote-Data">info dcache</a>.
</dl>
<div class="footnote">
<hr>
<h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small> In non-stop mode, it is moderately
rare for a running thread to modify the stack of a stopped thread
in a way that would interfere with a backtrace, and caching of
stack reads provides a significant speed up of remote backtraces.</p>
<hr></div>
</body></html>

View file

@ -0,0 +1,115 @@
<html lang="en">
<head>
<title>Calling - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Altering.html#Altering" title="Altering">
<link rel="prev" href="Returning.html#Returning" title="Returning">
<link rel="next" href="Patching.html#Patching" title="Patching">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Calling"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Patching.html#Patching">Patching</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Returning.html#Returning">Returning</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Altering.html#Altering">Altering</a>
<hr>
</div>
<h3 class="section">17.5 Calling Program Functions</h3>
<a name="index-calling-functions-1024"></a>
<a name="index-inferior-functions_002c-calling-1025"></a>
<dl><dt><code>print </code><var>expr</var><dd>Evaluate the expression <var>expr</var> and display the resulting value.
<var>expr</var> may include calls to functions in the program being
debugged.
<p><a name="index-call-1026"></a><br><dt><code>call </code><var>expr</var><dd>Evaluate the expression <var>expr</var> without displaying <code>void</code>
returned values.
<p>You can use this variant of the <code>print</code> command if you want to
execute a function from your program that does not return anything
(a.k.a. <dfn>a void function</dfn>), but without cluttering the output
with <code>void</code> returned values that <span class="sc">gdb</span> will otherwise
print. If the result is not void, it is printed and saved in the
value history.
</dl>
<p>It is possible for the function you call via the <code>print</code> or
<code>call</code> command to generate a signal (e.g., if there's a bug in
the function, or if you passed it incorrect arguments). What happens
in that case is controlled by the <code>set unwindonsignal</code> command.
<p>Similarly, with a C<tt>++</tt> program it is possible for the function you
call via the <code>print</code> or <code>call</code> command to generate an
exception that is not handled due to the constraints of the dummy
frame. In this case, any exception that is raised in the frame, but has
an out-of-frame exception handler will not be found. GDB builds a
dummy-frame for the inferior function call, and the unwinder cannot
seek for exception handlers outside of this dummy-frame. What happens
in that case is controlled by the
<code>set unwind-on-terminating-exception</code> command.
<dl>
<dt><code>set unwindonsignal</code><dd><a name="index-set-unwindonsignal-1027"></a><a name="index-unwind-stack-in-called-functions-1028"></a><a name="index-call-dummy-stack-unwinding-1029"></a>Set unwinding of the stack if a signal is received while in a function
that <span class="sc">gdb</span> called in the program being debugged. If set to on,
<span class="sc">gdb</span> unwinds the stack it created for the call and restores
the context to what it was before the call. If set to off (the
default), <span class="sc">gdb</span> stops in the frame where the signal was
received.
<br><dt><code>show unwindonsignal</code><dd><a name="index-show-unwindonsignal-1030"></a>Show the current setting of stack unwinding in the functions called by
<span class="sc">gdb</span>.
<br><dt><code>set unwind-on-terminating-exception</code><dd><a name="index-set-unwind_002don_002dterminating_002dexception-1031"></a><a name="index-unwind-stack-in-called-functions-with-unhandled-exceptions-1032"></a><a name="index-call-dummy-stack-unwinding-on-unhandled-exception_002e-1033"></a>Set unwinding of the stack if a C<tt>++</tt> exception is raised, but left
unhandled while in a function that <span class="sc">gdb</span> called in the program being
debugged. If set to on (the default), <span class="sc">gdb</span> unwinds the stack
it created for the call and restores the context to what it was before
the call. If set to off, <span class="sc">gdb</span> the exception is delivered to
the default C<tt>++</tt> exception handler and the inferior terminated.
<br><dt><code>show unwind-on-terminating-exception</code><dd><a name="index-show-unwind_002don_002dterminating_002dexception-1034"></a>Show the current setting of stack unwinding in the functions called by
<span class="sc">gdb</span>.
</dl>
<p><a name="index-weak-alias-functions-1035"></a>Sometimes, a function you wish to call is actually a <dfn>weak alias</dfn>
for another function. In such case, <span class="sc">gdb</span> might not pick up
the type information, including the types of the function arguments,
which causes <span class="sc">gdb</span> to call the inferior function incorrectly.
As a result, the called function will function erroneously and may
even crash. A solution to that is to use the name of the aliased
function instead.
</body></html>

View file

@ -0,0 +1,227 @@
<html lang="en">
<head>
<title>Character Sets - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Data.html#Data" title="Data">
<link rel="prev" href="Core-File-Generation.html#Core-File-Generation" title="Core File Generation">
<link rel="next" href="Caching-Remote-Data.html#Caching-Remote-Data" title="Caching Remote Data">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Character-Sets"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Caching-Remote-Data.html#Caching-Remote-Data">Caching Remote Data</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Core-File-Generation.html#Core-File-Generation">Core File Generation</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Data.html#Data">Data</a>
<hr>
</div>
<h3 class="section">10.20 Character Sets</h3>
<p><a name="index-character-sets-693"></a><a name="index-charset-694"></a><a name="index-translating-between-character-sets-695"></a><a name="index-host-character-set-696"></a><a name="index-target-character-set-697"></a>
If the program you are debugging uses a different character set to
represent characters and strings than the one <span class="sc">gdb</span> uses itself,
<span class="sc">gdb</span> can automatically translate between the character sets for
you. The character set <span class="sc">gdb</span> uses we call the <dfn>host
character set</dfn>; the one the inferior program uses we call the
<dfn>target character set</dfn>.
<p>For example, if you are running <span class="sc">gdb</span> on a <span class="sc">gnu</span>/Linux system, which
uses the ISO Latin 1 character set, but you are using <span class="sc">gdb</span>'s
remote protocol (see <a href="Remote-Debugging.html#Remote-Debugging">Remote Debugging</a>) to debug a program
running on an IBM mainframe, which uses the <span class="sc">ebcdic</span> character set,
then the host character set is Latin-1, and the target character set is
<span class="sc">ebcdic</span>. If you give <span class="sc">gdb</span> the command <code>set
target-charset EBCDIC-US</code>, then <span class="sc">gdb</span> translates between
<span class="sc">ebcdic</span> and Latin 1 as you print character or string values, or use
character and string literals in expressions.
<p><span class="sc">gdb</span> has no way to automatically recognize which character set
the inferior program uses; you must tell it, using the <code>set
target-charset</code> command, described below.
<p>Here are the commands for controlling <span class="sc">gdb</span>'s character set
support:
<dl>
<dt><code>set target-charset </code><var>charset</var><dd><a name="index-set-target_002dcharset-698"></a>Set the current target character set to <var>charset</var>. To display the
list of supported target character sets, type
<kbd>set&nbsp;target-charset&nbsp;&lt;TAB&gt;&lt;TAB&gt;<!-- /@w --></kbd>.
<br><dt><code>set host-charset </code><var>charset</var><dd><a name="index-set-host_002dcharset-699"></a>Set the current host character set to <var>charset</var>.
<p>By default, <span class="sc">gdb</span> uses a host character set appropriate to the
system it is running on; you can override that default using the
<code>set host-charset</code> command. On some systems, <span class="sc">gdb</span> cannot
automatically determine the appropriate host character set. In this
case, <span class="sc">gdb</span> uses &lsquo;<samp><span class="samp">UTF-8</span></samp>&rsquo;.
<p><span class="sc">gdb</span> can only use certain character sets as its host character
set. If you type <kbd>set&nbsp;host-charset&nbsp;&lt;TAB&gt;&lt;TAB&gt;<!-- /@w --></kbd>,
<span class="sc">gdb</span> will list the host character sets it supports.
<br><dt><code>set charset </code><var>charset</var><dd><a name="index-set-charset-700"></a>Set the current host and target character sets to <var>charset</var>. As
above, if you type <kbd>set&nbsp;charset&nbsp;&lt;TAB&gt;&lt;TAB&gt;<!-- /@w --></kbd>,
<span class="sc">gdb</span> will list the names of the character sets that can be used
for both host and target.
<br><dt><code>show charset</code><dd><a name="index-show-charset-701"></a>Show the names of the current host and target character sets.
<br><dt><code>show host-charset</code><dd><a name="index-show-host_002dcharset-702"></a>Show the name of the current host character set.
<br><dt><code>show target-charset</code><dd><a name="index-show-target_002dcharset-703"></a>Show the name of the current target character set.
<br><dt><code>set target-wide-charset </code><var>charset</var><dd><a name="index-set-target_002dwide_002dcharset-704"></a>Set the current target's wide character set to <var>charset</var>. This is
the character set used by the target's <code>wchar_t</code> type. To
display the list of supported wide character sets, type
<kbd>set&nbsp;target-wide-charset&nbsp;&lt;TAB&gt;&lt;TAB&gt;<!-- /@w --></kbd>.
<br><dt><code>show target-wide-charset</code><dd><a name="index-show-target_002dwide_002dcharset-705"></a>Show the name of the current target's wide character set.
</dl>
<p>Here is an example of <span class="sc">gdb</span>'s character set support in action.
Assume that the following source code has been placed in the file
<samp><span class="file">charset-test.c</span></samp>:
<pre class="smallexample"> #include &lt;stdio.h&gt;
char ascii_hello[]
= {72, 101, 108, 108, 111, 44, 32, 119,
111, 114, 108, 100, 33, 10, 0};
char ibm1047_hello[]
= {200, 133, 147, 147, 150, 107, 64, 166,
150, 153, 147, 132, 90, 37, 0};
main ()
{
printf ("Hello, world!\n");
}
</pre>
<p>In this program, <code>ascii_hello</code> and <code>ibm1047_hello</code> are arrays
containing the string &lsquo;<samp><span class="samp">Hello, world!</span></samp>&rsquo; followed by a newline,
encoded in the <span class="sc">ascii</span> and <span class="sc">ibm1047</span> character sets.
<p>We compile the program, and invoke the debugger on it:
<pre class="smallexample"> $ gcc -g charset-test.c -o charset-test
$ gdb -nw charset-test
GNU gdb 2001-12-19-cvs
Copyright 2001 Free Software Foundation, Inc.
...
(gdb)
</pre>
<p>We can use the <code>show charset</code> command to see what character sets
<span class="sc">gdb</span> is currently using to interpret and display characters and
strings:
<pre class="smallexample"> (gdb) show charset
The current host and target character set is `ISO-8859-1'.
(gdb)
</pre>
<p>For the sake of printing this manual, let's use <span class="sc">ascii</span> as our
initial character set:
<pre class="smallexample"> (gdb) set charset ASCII
(gdb) show charset
The current host and target character set is `ASCII'.
(gdb)
</pre>
<p>Let's assume that <span class="sc">ascii</span> is indeed the correct character set for our
host system &mdash; in other words, let's assume that if <span class="sc">gdb</span> prints
characters using the <span class="sc">ascii</span> character set, our terminal will display
them properly. Since our current target character set is also
<span class="sc">ascii</span>, the contents of <code>ascii_hello</code> print legibly:
<pre class="smallexample"> (gdb) print ascii_hello
$1 = 0x401698 "Hello, world!\n"
(gdb) print ascii_hello[0]
$2 = 72 'H'
(gdb)
</pre>
<p><span class="sc">gdb</span> uses the target character set for character and string
literals you use in expressions:
<pre class="smallexample"> (gdb) print '+'
$3 = 43 '+'
(gdb)
</pre>
<p>The <span class="sc">ascii</span> character set uses the number 43 to encode the &lsquo;<samp><span class="samp">+</span></samp>&rsquo;
character.
<p><span class="sc">gdb</span> relies on the user to tell it which character set the
target program uses. If we print <code>ibm1047_hello</code> while our target
character set is still <span class="sc">ascii</span>, we get jibberish:
<pre class="smallexample"> (gdb) print ibm1047_hello
$4 = 0x4016a8 "\310\205\223\223\226k@\246\226\231\223\204Z%"
(gdb) print ibm1047_hello[0]
$5 = 200 '\310'
(gdb)
</pre>
<p>If we invoke the <code>set target-charset</code> followed by &lt;TAB&gt;&lt;TAB&gt;,
<span class="sc">gdb</span> tells us the character sets it supports:
<pre class="smallexample"> (gdb) set target-charset
ASCII EBCDIC-US IBM1047 ISO-8859-1
(gdb) set target-charset
</pre>
<p>We can select <span class="sc">ibm1047</span> as our target character set, and examine the
program's strings again. Now the <span class="sc">ascii</span> string is wrong, but
<span class="sc">gdb</span> translates the contents of <code>ibm1047_hello</code> from the
target character set, <span class="sc">ibm1047</span>, to the host character set,
<span class="sc">ascii</span>, and they display correctly:
<pre class="smallexample"> (gdb) set target-charset IBM1047
(gdb) show charset
The current host character set is `ASCII'.
The current target character set is `IBM1047'.
(gdb) print ascii_hello
$6 = 0x401698 "\110\145%%?\054\040\167?\162%\144\041\012"
(gdb) print ascii_hello[0]
$7 = 72 '\110'
(gdb) print ibm1047_hello
$8 = 0x4016a8 "Hello, world!\n"
(gdb) print ibm1047_hello[0]
$9 = 200 'H'
(gdb)
</pre>
<p>As above, <span class="sc">gdb</span> uses the target character set for character and
string literals you use in expressions:
<pre class="smallexample"> (gdb) print '+'
$10 = 78 '+'
(gdb)
</pre>
<p>The <span class="sc">ibm1047</span> character set uses the number 78 to encode the &lsquo;<samp><span class="samp">+</span></samp>&rsquo;
character.
</body></html>

View file

@ -0,0 +1,150 @@
<html lang="en">
<head>
<title>Checkpoint/Restart - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Running.html#Running" title="Running">
<link rel="prev" href="Forks.html#Forks" title="Forks">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Checkpoint%2fRestart"></a>
<a name="Checkpoint_002fRestart"></a>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Forks.html#Forks">Forks</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Running.html#Running">Running</a>
<hr>
</div>
<h3 class="section">4.12 Setting a <em>Bookmark</em> to Return to Later</h3>
<p><a name="index-checkpoint-193"></a><a name="index-restart-194"></a><a name="index-bookmark-195"></a><a name="index-snapshot-of-a-process-196"></a><a name="index-rewind-program-state-197"></a>
On certain operating systems<a rel="footnote" href="#fn-1" name="fnd-1"><sup>1</sup></a>, <span class="sc">gdb</span> is able to save a <dfn>snapshot</dfn> of a
program's state, called a <dfn>checkpoint</dfn>, and come back to it
later.
<p>Returning to a checkpoint effectively undoes everything that has
happened in the program since the <code>checkpoint</code> was saved. This
includes changes in memory, registers, and even (within some limits)
system state. Effectively, it is like going back in time to the
moment when the checkpoint was saved.
<p>Thus, if you're stepping thru a program and you think you're
getting close to the point where things go wrong, you can save
a checkpoint. Then, if you accidentally go too far and miss
the critical statement, instead of having to restart your program
from the beginning, you can just go back to the checkpoint and
start again from there.
<p>This can be especially useful if it takes a lot of time or
steps to reach the point where you think the bug occurs.
<p>To use the <code>checkpoint</code>/<code>restart</code> method of debugging:
<a name="index-checkpoint-198"></a>
<dl><dt><code>checkpoint</code><dd>Save a snapshot of the debugged program's current execution state.
The <code>checkpoint</code> command takes no arguments, but each checkpoint
is assigned a small integer id, similar to a breakpoint id.
<p><a name="index-info-checkpoints-199"></a><br><dt><code>info checkpoints</code><dd>List the checkpoints that have been saved in the current debugging
session. For each checkpoint, the following information will be
listed:
<dl>
<dt><code>Checkpoint ID</code><br><dt><code>Process ID</code><br><dt><code>Code Address</code><br><dt><code>Source line, or label</code><dd></dl>
<p><a name="index-restart-_0040var_007bcheckpoint_002did_007d-200"></a><br><dt><code>restart </code><var>checkpoint-id</var><dd>Restore the program state that was saved as checkpoint number
<var>checkpoint-id</var>. All program variables, registers, stack frames
etc. will be returned to the values that they had when the checkpoint
was saved. In essence, gdb will &ldquo;wind back the clock&rdquo; to the point
in time when the checkpoint was saved.
<p>Note that breakpoints, <span class="sc">gdb</span> variables, command history etc.
are not affected by restoring a checkpoint. In general, a checkpoint
only restores things that reside in the program being debugged, not in
the debugger.
<p><a name="index-delete-checkpoint-_0040var_007bcheckpoint_002did_007d-201"></a><br><dt><code>delete checkpoint </code><var>checkpoint-id</var><dd>Delete the previously-saved checkpoint identified by <var>checkpoint-id</var>.
</dl>
<p>Returning to a previously saved checkpoint will restore the user state
of the program being debugged, plus a significant subset of the system
(OS) state, including file pointers. It won't &ldquo;un-write&rdquo; data from
a file, but it will rewind the file pointer to the previous location,
so that the previously written data can be overwritten. For files
opened in read mode, the pointer will also be restored so that the
previously read data can be read again.
<p>Of course, characters that have been sent to a printer (or other
external device) cannot be &ldquo;snatched back&rdquo;, and characters received
from eg. a serial device can be removed from internal program buffers,
but they cannot be &ldquo;pushed back&rdquo; into the serial pipeline, ready to
be received again. Similarly, the actual contents of files that have
been changed cannot be restored (at this time).
<p>However, within those constraints, you actually can &ldquo;rewind&rdquo; your
program to a previously saved point in time, and begin debugging it
again &mdash; and you can change the course of events so as to debug a
different execution path this time.
<p><a name="index-checkpoints-and-process-id-202"></a>Finally, there is one bit of internal program state that will be
different when you return to a checkpoint &mdash; the program's process
id. Each checkpoint will have a unique process id (or <var>pid</var>),
and each will be different from the program's original <var>pid</var>.
If your program has saved a local copy of its process id, this could
potentially pose a problem.
<h4 class="subsection">4.12.1 A Non-obvious Benefit of Using Checkpoints</h4>
<p>On some systems such as <span class="sc">gnu</span>/Linux, address space randomization
is performed on new processes for security reasons. This makes it
difficult or impossible to set a breakpoint, or watchpoint, on an
absolute address if you have to restart the program, since the
absolute location of a symbol will change from one execution to the
next.
<p>A checkpoint, however, is an <em>identical</em> copy of a process.
Therefore if you create a checkpoint at (eg.) the start of main,
and simply return to that checkpoint instead of restarting the
process, you can avoid the effects of address randomization and
your symbols will all stay in the same place.
<div class="footnote">
<hr>
<h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small> Currently, only
<span class="sc">gnu</span>/Linux.</p>
<hr></div>
</body></html>

View file

@ -0,0 +1,71 @@
<html lang="en">
<head>
<title>Checks - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Languages.html#Languages" title="Languages">
<link rel="prev" href="Show.html#Show" title="Show">
<link rel="next" href="Supported-Languages.html#Supported-Languages" title="Supported Languages">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Checks"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Supported-Languages.html#Supported-Languages">Supported Languages</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Show.html#Show">Show</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Languages.html#Languages">Languages</a>
<hr>
</div>
<h3 class="section">15.3 Type and Range Checking</h3>
<p>Some languages are designed to guard you against making seemingly common
errors through a series of compile- and run-time checks. These include
checking the type of arguments to functions and operators and making
sure mathematical overflows are caught at run time. Checks such as
these help to ensure a program's correctness once it has been compiled
by eliminating type mismatches and providing active checks for range
errors when your program is running.
<p>By default <span class="sc">gdb</span> checks for these errors according to the
rules of the current source language. Although <span class="sc">gdb</span> does not check
the statements in your program, it can check expressions entered directly
into <span class="sc">gdb</span> for evaluation via the <code>print</code> command, for example.
<ul class="menu">
<li><a accesskey="1" href="Type-Checking.html#Type-Checking">Type Checking</a>: An overview of type checking
<li><a accesskey="2" href="Range-Checking.html#Range-Checking">Range Checking</a>: An overview of range checking
</ul>
<p><a name="index-type-checking-857"></a><a name="index-checks_002c-type-858"></a>
</body></html>

View file

@ -0,0 +1,158 @@
<html lang="en">
<head>
<title>Command Files - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Sequences.html#Sequences" title="Sequences">
<link rel="prev" href="Hooks.html#Hooks" title="Hooks">
<link rel="next" href="Output.html#Output" title="Output">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Command-Files"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Output.html#Output">Output</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Hooks.html#Hooks">Hooks</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Sequences.html#Sequences">Sequences</a>
<hr>
</div>
<h4 class="subsection">23.1.3 Command Files</h4>
<p><a name="index-command-files-1690"></a><a name="index-scripting-commands-1691"></a>A command file for <span class="sc">gdb</span> is a text file made of lines that are
<span class="sc">gdb</span> commands. Comments (lines starting with <kbd>#</kbd>) 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>You can request the execution of a command file with the <code>source</code>
command. Note that the <code>source</code> command is also used to evaluate
scripts that are not Command Files. The exact behavior can be configured
using the <code>script-extension</code> setting.
See <a href="Extending-GDB.html#Extending-GDB">Extending GDB</a>.
<a name="index-source-1692"></a>
<a name="index-execute-commands-from-a-file-1693"></a>
<dl><dt><code>source [-s] [-v] </code><var>filename</var><dd>Execute the command file <var>filename</var>.
</dl>
<p>The lines in a command file are generally executed sequentially,
unless the order of execution is changed by one of the
<em>flow-control commands</em> described below. The commands are not
printed as they are executed. An error in any command terminates
execution of the command file and control is returned to the console.
<p><span class="sc">gdb</span> first searches for <var>filename</var> in the current directory.
If the file is not found there, and <var>filename</var> does not specify a
directory, then <span class="sc">gdb</span> also looks for the file on the source search path
(specified with the &lsquo;<samp><span class="samp">directory</span></samp>&rsquo; command);
except that <samp><span class="file">$cdir</span></samp> is not searched because the compilation directory
is not relevant to scripts.
<p>If <code>-s</code> is specified, then <span class="sc">gdb</span> searches for <var>filename</var>
on the search path even if <var>filename</var> specifies a directory.
The search is done by appending <var>filename</var> to each element of the
search path. So, for example, if <var>filename</var> is <samp><span class="file">mylib/myscript</span></samp>
and the search path contains <samp><span class="file">/home/user</span></samp> then <span class="sc">gdb</span> will
look for the script <samp><span class="file">/home/user/mylib/myscript</span></samp>.
The search is also done if <var>filename</var> is an absolute path.
For example, if <var>filename</var> is <samp><span class="file">/tmp/myscript</span></samp> and
the search path contains <samp><span class="file">/home/user</span></samp> then <span class="sc">gdb</span> will
look for the script <samp><span class="file">/home/user/tmp/myscript</span></samp>.
For DOS-like systems, if <var>filename</var> contains a drive specification,
it is stripped before concatenation. For example, if <var>filename</var> is
<samp><span class="file">d:myscript</span></samp> and the search path contains <samp><span class="file">c:/tmp</span></samp> then <span class="sc">gdb</span>
will look for the script <samp><span class="file">c:/tmp/myscript</span></samp>.
<p>If <code>-v</code>, for verbose mode, is given then <span class="sc">gdb</span> displays
each command as it is executed. The option must be given before
<var>filename</var>, and is interpreted as part of the filename anywhere else.
<p>Commands that would ask for confirmation if used interactively proceed
without asking when used in a command file. Many <span class="sc">gdb</span> commands that
normally print messages to say what they are doing omit the messages
when called from command files.
<p><span class="sc">gdb</span> also accepts command input from standard input. In this
mode, normal output goes to standard output and error output goes to
standard error. Errors in a command file supplied on standard input do
not terminate execution of the command file&mdash;execution continues with
the next command.
<pre class="smallexample"> gdb &lt; cmds &gt; log 2&gt;&amp;1
</pre>
<p>(The syntax above will vary depending on the shell used.) This example
will execute commands from the file <samp><span class="file">cmds</span></samp>. All output and errors
would be directed to <samp><span class="file">log</span></samp>.
<p>Since commands stored on command files tend to be more general than
commands typed interactively, they frequently need to deal with
complicated situations, such as different or unexpected values of
variables and symbols, changes in how the program being debugged is
built, etc. <span class="sc">gdb</span> provides a set of flow-control commands to
deal with these complexities. Using these commands, you can write
complex scripts that loop over data structures, execute commands
conditionally, etc.
<a name="index-if-1694"></a>
<a name="index-else-1695"></a>
<dl><dt><code>if</code><dt><code>else</code><dd>This command allows to include in your script conditionally executed
commands. The <code>if</code> command takes a single argument, which is an
expression to evaluate. It is followed by a series of commands that
are executed only if the expression is true (its value is nonzero).
There can then optionally be an <code>else</code> line, followed by a series
of commands that are only executed if the expression was false. The
end of the list is marked by a line containing <code>end</code>.
<p><a name="index-while-1696"></a><br><dt><code>while</code><dd>This command allows to write loops. Its syntax is similar to
<code>if</code>: the command takes a single argument, which is an expression
to evaluate, and must be followed by the commands to execute, one per
line, terminated by an <code>end</code>. These commands are called the
<dfn>body</dfn> of the loop. The commands in the body of <code>while</code> are
executed repeatedly as long as the expression evaluates to true.
<p><a name="index-loop_005fbreak-1697"></a><br><dt><code>loop_break</code><dd>This command exits the <code>while</code> loop in whose body it is included.
Execution of the script continues after that <code>while</code>s <code>end</code>
line.
<p><a name="index-loop_005fcontinue-1698"></a><br><dt><code>loop_continue</code><dd>This command skips the execution of the rest of the body of commands
in the <code>while</code> loop in whose body it is included. Execution
branches to the beginning of the <code>while</code> loop, where it evaluates
the controlling expression.
<p><a name="index-end_0040r_007b-_0028if_002felse_002fwhile-commands_0029_007d-1699"></a><br><dt><code>end</code><dd>Terminate the block of commands that are the body of <code>if</code>,
<code>else</code>, or <code>while</code> flow-control commands.
</dl>
</body></html>

View file

@ -0,0 +1,136 @@
<html lang="en">
<head>
<title>Command History - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Controlling-GDB.html#Controlling-GDB" title="Controlling GDB">
<link rel="prev" href="Editing.html#Editing" title="Editing">
<link rel="next" href="Screen-Size.html#Screen-Size" title="Screen Size">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Command-History"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Screen-Size.html#Screen-Size">Screen Size</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Editing.html#Editing">Editing</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Controlling-GDB.html#Controlling-GDB">Controlling GDB</a>
<hr>
</div>
<h3 class="section">22.3 Command History</h3>
<p><a name="index-command-history-1544"></a>
<span class="sc">gdb</span> can keep track of the commands you type during your
debugging sessions, so that you can be certain of precisely what
happened. Use these commands to manage the <span class="sc">gdb</span> command
history facility.
<p><span class="sc">gdb</span> uses the <span class="sc">gnu</span> History library, a part of the Readline
package, to provide the history facility.
See <a href="Using-History-Interactively.html#Using-History-Interactively">Using History Interactively</a>,
for the detailed description of the History library.
<p>To issue a command to <span class="sc">gdb</span> without affecting certain aspects of
the state which is seen by users, prefix it with &lsquo;<samp><span class="samp">server </span></samp>&rsquo;
(see <a href="Server-Prefix.html#Server-Prefix">Server Prefix</a>). This
means that this command will not affect the command history, nor will it
affect <span class="sc">gdb</span>'s notion of which command to repeat if &lt;RET&gt; is
pressed on a line by itself.
<p><a name="index-g_t_0040code_007bserver_007d_002c-command-prefix-1545"></a>The server prefix does not affect the recording of values into the value
history; to print a value without recording it into the value history,
use the <code>output</code> command instead of the <code>print</code> command.
<p>Here is the description of <span class="sc">gdb</span> commands related to command
history.
<a name="index-history-substitution-1546"></a>
<a name="index-history-file-1547"></a>
<a name="index-set-history-filename-1548"></a>
<a name="index-g_t_0040env_007bGDBHISTFILE_007d_002c-environment-variable-1549"></a>
<dl><dt><code>set history filename </code><var>fname</var><dd>Set the name of the <span class="sc">gdb</span> command history file to <var>fname</var>.
This is the file where <span class="sc">gdb</span> reads an initial command history
list, and where it writes the command history from this session when it
exits. You can access this list through history expansion or through
the history command editing characters listed below. This file defaults
to the value of the environment variable <code>GDBHISTFILE</code>, or to
<samp><span class="file">./.gdb_history</span></samp> (<samp><span class="file">./_gdb_history</span></samp> on MS-DOS) if this variable
is not set.
<p><a name="index-save-command-history-1550"></a><a name="index-set-history-save-1551"></a><br><dt><code>set history save</code><dt><code>set history save on</code><dd>Record command history in a file, whose name may be specified with the
<code>set history filename</code> command. By default, this option is disabled.
<br><dt><code>set history save off</code><dd>Stop recording command history in a file.
<p><a name="index-history-size-1552"></a><a name="index-set-history-size-1553"></a><a name="index-g_t_0040env_007bHISTSIZE_007d_002c-environment-variable-1554"></a><br><dt><code>set history size </code><var>size</var><dd>Set the number of commands which <span class="sc">gdb</span> keeps in its history list.
This defaults to the value of the environment variable
<code>HISTSIZE</code>, or to 256 if this variable is not set.
</dl>
<p>History expansion assigns special meaning to the character <kbd>!</kbd>.
See <a href="Event-Designators.html#Event-Designators">Event Designators</a>,
for more details.
<p><a name="index-history-expansion_002c-turn-on_002foff-1555"></a>Since <kbd>!</kbd> is also the logical not operator in C, history expansion
is off by default. If you decide to enable history expansion with the
<code>set history expansion on</code> command, you may sometimes need to
follow <kbd>!</kbd> (when it is used as logical not, in an expression) with
a space or a tab to prevent it from being expanded. The readline
history facilities do not attempt substitution on the strings
<kbd>!=</kbd> and <kbd>!(</kbd>, even when history expansion is enabled.
<p>The commands to control history expansion are:
<dl>
<dt><code>set history expansion on</code><dt><code>set history expansion</code><dd><a name="index-set-history-expansion-1556"></a>Enable history expansion. History expansion is off by default.
<br><dt><code>set history expansion off</code><dd>Disable history expansion.
<!-- @group -->
<p><a name="index-show-history-1557"></a><br><dt><code>show history</code><dt><code>show history filename</code><dt><code>show history save</code><dt><code>show history size</code><dt><code>show history expansion</code><dd>These commands display the state of the <span class="sc">gdb</span> history parameters.
<code>show history</code> by itself displays all four states.
<!-- @end group -->
</dl>
<a name="index-show-commands-1558"></a>
<a name="index-show-last-commands-1559"></a>
<a name="index-display-command-history-1560"></a>
<dl><dt><code>show commands</code><dd>Display the last ten commands in the command history.
<br><dt><code>show commands </code><var>n</var><dd>Print ten commands centered on command number <var>n</var>.
<br><dt><code>show commands +</code><dd>Print ten commands just after the commands last printed.
</dl>
</body></html>

View file

@ -0,0 +1,63 @@
<html lang="en">
<head>
<title>Command Line Editing - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="GDB-Bugs.html#GDB-Bugs" title="GDB Bugs">
<link rel="next" href="Using-History-Interactively.html#Using-History-Interactively" title="Using History Interactively">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Command-Line-Editing"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Using-History-Interactively.html#Using-History-Interactively">Using History Interactively</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="GDB-Bugs.html#GDB-Bugs">GDB Bugs</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>
<h2 class="chapter">32 Command Line Editing</h2>
<p>This chapter describes the basic features of the <span class="sc">gnu</span>
command line editing interface.
<ul class="menu">
<li><a accesskey="1" href="Introduction-and-Notation.html#Introduction-and-Notation">Introduction and Notation</a>: Notation used in this text.
<li><a accesskey="2" href="Readline-Interaction.html#Readline-Interaction">Readline Interaction</a>: The minimum set of commands for editing a line.
<li><a accesskey="3" href="Readline-Init-File.html#Readline-Init-File">Readline Init File</a>: Customizing Readline from a user's view.
<li><a accesskey="4" href="Bindable-Readline-Commands.html#Bindable-Readline-Commands">Bindable Readline Commands</a>: A description of most of the Readline commands
available for binding
<li><a accesskey="5" href="Readline-vi-Mode.html#Readline-vi-Mode">Readline vi Mode</a>: A short description of how to make Readline
behave like the vi editor.
</ul>
</body></html>

View file

@ -0,0 +1,89 @@
<html lang="en">
<head>
<title>Command Syntax - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Commands.html#Commands" title="Commands">
<link rel="next" href="Completion.html#Completion" title="Completion">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Command-Syntax"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Completion.html#Completion">Completion</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Commands.html#Commands">Commands</a>
<hr>
</div>
<h3 class="section">3.1 Command Syntax</h3>
<p>A <span class="sc">gdb</span> 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 &lsquo;<samp><span class="samp">step 5</span></samp>&rsquo;. You can also use the <code>step</code> command
with no arguments. Some commands do not allow any arguments.
<p><a name="index-abbreviation-74"></a><span class="sc">gdb</span> 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><a name="index-repeating-commands-75"></a><a name="index-RET-_0040r_007b_0028repeat-last-command_0029_007d-76"></a>A blank line as input to <span class="sc">gdb</span> (typing just &lt;RET&gt;) 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="Define.html#Define">dont-repeat</a>.
<p>The <code>list</code> and <code>x</code> commands, when you repeat them with
&lt;RET&gt;, construct new arguments rather than repeating
exactly as typed. This permits easy scanning of source or memory.
<p><span class="sc">gdb</span> can also use &lt;RET&gt; in another way: to partition lengthy
output, in a way similar to the common utility <code>more</code>
(see <a href="Screen-Size.html#Screen-Size">Screen Size</a>). Since it is easy to press one
&lt;RET&gt; too many in this situation, <span class="sc">gdb</span> disables command
repetition after any command that generates this sort of display.
<p><a name="index-g_t_0023-_0040r_007b_0028a-comment_0029_007d-77"></a><a name="index-comment-78"></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 <a href="Command-Files.html#Command-Files">Command Files</a>).
<p><a name="index-repeating-command-sequences-79"></a><a name="index-Ctrl_002do-_0040r_007b_0028operate_002dand_002dget_002dnext_0029_007d-80"></a>The <kbd>Ctrl-o</kbd> binding is useful for repeating a complex sequence of
commands. This command accepts the current line, like &lt;RET&gt;, and
then fetches the next line relative to the current line from the history
for editing.
</body></html>

View file

@ -0,0 +1,89 @@
<html lang="en">
<head>
<title>Commands For Completion - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Bindable-Readline-Commands.html#Bindable-Readline-Commands" title="Bindable Readline Commands">
<link rel="prev" href="Numeric-Arguments.html#Numeric-Arguments" title="Numeric Arguments">
<link rel="next" href="Keyboard-Macros.html#Keyboard-Macros" title="Keyboard Macros">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Commands-For-Completion"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Keyboard-Macros.html#Keyboard-Macros">Keyboard Macros</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Numeric-Arguments.html#Numeric-Arguments">Numeric Arguments</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Bindable-Readline-Commands.html#Bindable-Readline-Commands">Bindable Readline Commands</a>
<hr>
</div>
<h4 class="subsection">32.4.6 Letting Readline Type For You</h4>
<dl>
<dt><code>complete (&lt;TAB&gt;)</code><a name="index-complete-_0028_0040key_007bTAB_007d_0029-2527"></a><dd>Attempt to perform completion on the text before point.
The actual completion performed is application-specific.
The default is filename completion.
<br><dt><code>possible-completions (M-?)</code><a name="index-possible_002dcompletions-_0028M_002d_003f_0029-2528"></a><dd>List the possible completions of the text before point.
When displaying completions, Readline sets the number of columns used
for display to the value of <code>completion-display-width</code>, the value of
the environment variable <samp><span class="env">COLUMNS</span></samp>, or the screen width, in that order.
<br><dt><code>insert-completions (M-*)</code><a name="index-insert_002dcompletions-_0028M_002d_002a_0029-2529"></a><dd>Insert all completions of the text before point that would have
been generated by <code>possible-completions</code>.
<br><dt><code>menu-complete ()</code><a name="index-menu_002dcomplete-_0028_0029-2530"></a><dd>Similar to <code>complete</code>, but replaces the word to be completed
with a single match from the list of possible completions.
Repeated execution of <code>menu-complete</code> steps through the list
of possible completions, inserting each match in turn.
At the end of the list of completions, the bell is rung
(subject to the setting of <code>bell-style</code>)
and the original text is restored.
An argument of <var>n</var> moves <var>n</var> positions forward in the list
of matches; a negative argument may be used to move backward
through the list.
This command is intended to be bound to &lt;TAB&gt;, but is unbound
by default.
<br><dt><code>menu-complete-backward ()</code><a name="index-menu_002dcomplete_002dbackward-_0028_0029-2531"></a><dd>Identical to <code>menu-complete</code>, but moves backward through the list
of possible completions, as if <code>menu-complete</code> had been given a
negative argument.
<br><dt><code>delete-char-or-list ()</code><a name="index-delete_002dchar_002dor_002dlist-_0028_0029-2532"></a><dd>Deletes the character under the cursor if not at the beginning or
end of the line (like <code>delete-char</code>).
If at the end of the line, behaves identically to
<code>possible-completions</code>.
This command is unbound by default.
</dl>
</body></html>

View file

@ -0,0 +1,114 @@
<html lang="en">
<head>
<title>Commands For History - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Bindable-Readline-Commands.html#Bindable-Readline-Commands" title="Bindable Readline Commands">
<link rel="prev" href="Commands-For-Moving.html#Commands-For-Moving" title="Commands For Moving">
<link rel="next" href="Commands-For-Text.html#Commands-For-Text" title="Commands For Text">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Commands-For-History"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Commands-For-Text.html#Commands-For-Text">Commands For Text</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Commands-For-Moving.html#Commands-For-Moving">Commands For Moving</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Bindable-Readline-Commands.html#Bindable-Readline-Commands">Bindable Readline Commands</a>
<hr>
</div>
<h4 class="subsection">32.4.2 Commands For Manipulating The History</h4>
<dl>
<dt><code>accept-line (Newline or Return)</code><a name="index-accept_002dline-_0028Newline-or-Return_0029-2486"></a><dd>Accept the line regardless of where the cursor is.
If this line is
non-empty, it may be added to the history list for future recall with
<code>add_history()</code>.
If this line is a modified history line, the history line is restored
to its original state.
<br><dt><code>previous-history (C-p)</code><a name="index-previous_002dhistory-_0028C_002dp_0029-2487"></a><dd>Move `back' through the history list, fetching the previous command.
<br><dt><code>next-history (C-n)</code><a name="index-next_002dhistory-_0028C_002dn_0029-2488"></a><dd>Move `forward' through the history list, fetching the next command.
<br><dt><code>beginning-of-history (M-&lt;)</code><a name="index-beginning_002dof_002dhistory-_0028M_002d_003c_0029-2489"></a><dd>Move to the first line in the history.
<br><dt><code>end-of-history (M-&gt;)</code><a name="index-end_002dof_002dhistory-_0028M_002d_003e_0029-2490"></a><dd>Move to the end of the input history, i.e., the line currently
being entered.
<br><dt><code>reverse-search-history (C-r)</code><a name="index-reverse_002dsearch_002dhistory-_0028C_002dr_0029-2491"></a><dd>Search backward starting at the current line and moving `up' through
the history as necessary. This is an incremental search.
<br><dt><code>forward-search-history (C-s)</code><a name="index-forward_002dsearch_002dhistory-_0028C_002ds_0029-2492"></a><dd>Search forward starting at the current line and moving `down' through
the the history as necessary. This is an incremental search.
<br><dt><code>non-incremental-reverse-search-history (M-p)</code><a name="index-non_002dincremental_002dreverse_002dsearch_002dhistory-_0028M_002dp_0029-2493"></a><dd>Search backward starting at the current line and moving `up'
through the history as necessary using a non-incremental search
for a string supplied by the user.
<br><dt><code>non-incremental-forward-search-history (M-n)</code><a name="index-non_002dincremental_002dforward_002dsearch_002dhistory-_0028M_002dn_0029-2494"></a><dd>Search forward starting at the current line and moving `down'
through the the history as necessary using a non-incremental search
for a string supplied by the user.
<br><dt><code>history-search-forward ()</code><a name="index-history_002dsearch_002dforward-_0028_0029-2495"></a><dd>Search forward through the history for the string of characters
between the start of the current line and the point.
This is a non-incremental search.
By default, this command is unbound.
<br><dt><code>history-search-backward ()</code><a name="index-history_002dsearch_002dbackward-_0028_0029-2496"></a><dd>Search backward through the history for the string of characters
between the start of the current line and the point. This
is a non-incremental search. By default, this command is unbound.
<br><dt><code>yank-nth-arg (M-C-y)</code><a name="index-yank_002dnth_002darg-_0028M_002dC_002dy_0029-2497"></a><dd>Insert the first argument to the previous command (usually
the second word on the previous line) at point.
With an argument <var>n</var>,
insert the <var>n</var>th word from the previous command (the words
in the previous command begin with word 0). A negative argument
inserts the <var>n</var>th word from the end of the previous command.
Once the argument <var>n</var> is computed, the argument is extracted
as if the &lsquo;<samp><span class="samp">!</span><var>n</var></samp>&rsquo; history expansion had been specified.
<br><dt><code>yank-last-arg (M-. or M-_)</code><a name="index-yank_002dlast_002darg-_0028M_002d_002e-or-M_002d_005f_0029-2498"></a><dd>Insert last argument to the previous command (the last word of the
previous history entry).
With a numeric argument, behave exactly like <code>yank-nth-arg</code>.
Successive calls to <code>yank-last-arg</code> move back through the history
list, inserting the last word (or the word specified by the argument to
the first call) of each line in turn.
Any numeric argument supplied to these successive calls determines
the direction to move through the history. A negative argument switches
the direction through the history (back or forward).
The history expansion facilities are used to extract the last argument,
as if the &lsquo;<samp><span class="samp">!$</span></samp>&rsquo; history expansion had been specified.
</dl>
</body></html>

View file

@ -0,0 +1,97 @@
<html lang="en">
<head>
<title>Commands For Killing - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Bindable-Readline-Commands.html#Bindable-Readline-Commands" title="Bindable Readline Commands">
<link rel="prev" href="Commands-For-Text.html#Commands-For-Text" title="Commands For Text">
<link rel="next" href="Numeric-Arguments.html#Numeric-Arguments" title="Numeric Arguments">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Commands-For-Killing"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Numeric-Arguments.html#Numeric-Arguments">Numeric Arguments</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Commands-For-Text.html#Commands-For-Text">Commands For Text</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Bindable-Readline-Commands.html#Bindable-Readline-Commands">Bindable Readline Commands</a>
<hr>
</div>
<h4 class="subsection">32.4.4 Killing And Yanking</h4>
<dl>
<dt><code>kill-line (C-k)</code><a name="index-kill_002dline-_0028C_002dk_0029-2510"></a><dd>Kill the text from point to the end of the line.
<br><dt><code>backward-kill-line (C-x Rubout)</code><a name="index-backward_002dkill_002dline-_0028C_002dx-Rubout_0029-2511"></a><dd>Kill backward to the beginning of the line.
<br><dt><code>unix-line-discard (C-u)</code><a name="index-unix_002dline_002ddiscard-_0028C_002du_0029-2512"></a><dd>Kill backward from the cursor to the beginning of the current line.
<br><dt><code>kill-whole-line ()</code><a name="index-kill_002dwhole_002dline-_0028_0029-2513"></a><dd>Kill all characters on the current line, no matter where point is.
By default, this is unbound.
<br><dt><code>kill-word (M-d)</code><a name="index-kill_002dword-_0028M_002dd_0029-2514"></a><dd>Kill from point to the end of the current word, or if between
words, to the end of the next word.
Word boundaries are the same as <code>forward-word</code>.
<br><dt><code>backward-kill-word (M-&lt;DEL&gt;)</code><a name="index-backward_002dkill_002dword-_0028M_002d_0040key_007bDEL_007d_0029-2515"></a><dd>Kill the word behind point.
Word boundaries are the same as <code>backward-word</code>.
<br><dt><code>unix-word-rubout (C-w)</code><a name="index-unix_002dword_002drubout-_0028C_002dw_0029-2516"></a><dd>Kill the word behind point, using white space as a word boundary.
The killed text is saved on the kill-ring.
<br><dt><code>unix-filename-rubout ()</code><a name="index-unix_002dfilename_002drubout-_0028_0029-2517"></a><dd>Kill the word behind point, using white space and the slash character
as the word boundaries.
The killed text is saved on the kill-ring.
<br><dt><code>delete-horizontal-space ()</code><a name="index-delete_002dhorizontal_002dspace-_0028_0029-2518"></a><dd>Delete all spaces and tabs around point. By default, this is unbound.
<br><dt><code>kill-region ()</code><a name="index-kill_002dregion-_0028_0029-2519"></a><dd>Kill the text in the current region.
By default, this command is unbound.
<br><dt><code>copy-region-as-kill ()</code><a name="index-copy_002dregion_002das_002dkill-_0028_0029-2520"></a><dd>Copy the text in the region to the kill buffer, so it can be yanked
right away. By default, this command is unbound.
<br><dt><code>copy-backward-word ()</code><a name="index-copy_002dbackward_002dword-_0028_0029-2521"></a><dd>Copy the word before point to the kill buffer.
The word boundaries are the same as <code>backward-word</code>.
By default, this command is unbound.
<br><dt><code>copy-forward-word ()</code><a name="index-copy_002dforward_002dword-_0028_0029-2522"></a><dd>Copy the word following point to the kill buffer.
The word boundaries are the same as <code>forward-word</code>.
By default, this command is unbound.
<br><dt><code>yank (C-y)</code><a name="index-yank-_0028C_002dy_0029-2523"></a><dd>Yank the top of the kill ring into the buffer at point.
<br><dt><code>yank-pop (M-y)</code><a name="index-yank_002dpop-_0028M_002dy_0029-2524"></a><dd>Rotate the kill-ring, and yank the new top. You can only do this if
the prior command is <code>yank</code> or <code>yank-pop</code>.
</dl>
</body></html>

View file

@ -0,0 +1,71 @@
<html lang="en">
<head>
<title>Commands For Moving - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Bindable-Readline-Commands.html#Bindable-Readline-Commands" title="Bindable Readline Commands">
<link rel="next" href="Commands-For-History.html#Commands-For-History" title="Commands For History">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Commands-For-Moving"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Commands-For-History.html#Commands-For-History">Commands For History</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Bindable-Readline-Commands.html#Bindable-Readline-Commands">Bindable Readline Commands</a>
<hr>
</div>
<h4 class="subsection">32.4.1 Commands For Moving</h4>
<dl>
<dt><code>beginning-of-line (C-a)</code><a name="index-beginning_002dof_002dline-_0028C_002da_0029-2478"></a><dd>Move to the start of the current line.
<br><dt><code>end-of-line (C-e)</code><a name="index-end_002dof_002dline-_0028C_002de_0029-2479"></a><dd>Move to the end of the line.
<br><dt><code>forward-char (C-f)</code><a name="index-forward_002dchar-_0028C_002df_0029-2480"></a><dd>Move forward a character.
<br><dt><code>backward-char (C-b)</code><a name="index-backward_002dchar-_0028C_002db_0029-2481"></a><dd>Move back a character.
<br><dt><code>forward-word (M-f)</code><a name="index-forward_002dword-_0028M_002df_0029-2482"></a><dd>Move forward to the end of the next word.
Words are composed of letters and digits.
<br><dt><code>backward-word (M-b)</code><a name="index-backward_002dword-_0028M_002db_0029-2483"></a><dd>Move back to the start of the current or previous word.
Words are composed of letters and digits.
<br><dt><code>clear-screen (C-l)</code><a name="index-clear_002dscreen-_0028C_002dl_0029-2484"></a><dd>Clear the screen and redraw the current line,
leaving the current line at the top of the screen.
<br><dt><code>redraw-current-line ()</code><a name="index-redraw_002dcurrent_002dline-_0028_0029-2485"></a><dd>Refresh the current line. By default, this is unbound.
</dl>
</body></html>

View file

@ -0,0 +1,107 @@
<html lang="en">
<head>
<title>Commands For Text - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Bindable-Readline-Commands.html#Bindable-Readline-Commands" title="Bindable Readline Commands">
<link rel="prev" href="Commands-For-History.html#Commands-For-History" title="Commands For History">
<link rel="next" href="Commands-For-Killing.html#Commands-For-Killing" title="Commands For Killing">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Commands-For-Text"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Commands-For-Killing.html#Commands-For-Killing">Commands For Killing</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Commands-For-History.html#Commands-For-History">Commands For History</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Bindable-Readline-Commands.html#Bindable-Readline-Commands">Bindable Readline Commands</a>
<hr>
</div>
<h4 class="subsection">32.4.3 Commands For Changing Text</h4>
<dl>
<dt><code>delete-char (C-d)</code><a name="index-delete_002dchar-_0028C_002dd_0029-2499"></a><dd>Delete the character at point. If point is at the
beginning of the line, there are no characters in the line, and
the last character typed was not bound to <code>delete-char</code>, then
return <span class="sc">eof</span>.
<br><dt><code>backward-delete-char (Rubout)</code><a name="index-backward_002ddelete_002dchar-_0028Rubout_0029-2500"></a><dd>Delete the character behind the cursor. A numeric argument means
to kill the characters instead of deleting them.
<br><dt><code>forward-backward-delete-char ()</code><a name="index-forward_002dbackward_002ddelete_002dchar-_0028_0029-2501"></a><dd>Delete the character under the cursor, unless the cursor is at the
end of the line, in which case the character behind the cursor is
deleted. By default, this is not bound to a key.
<br><dt><code>quoted-insert (C-q or C-v)</code><a name="index-quoted_002dinsert-_0028C_002dq-or-C_002dv_0029-2502"></a><dd>Add the next character typed to the line verbatim. This is
how to insert key sequences like <kbd>C-q</kbd>, for example.
<br><dt><code>tab-insert (M-&lt;TAB&gt;)</code><dd>Insert a tab character.
<br><dt><code>self-insert (a, b, A, 1, !, ...)</code><a name="index-self_002dinsert-_0028a_002c-b_002c-A_002c-1_002c-_0021_002c-_0040dots_007b_007d_0029-2503"></a><dd>Insert yourself.
<br><dt><code>transpose-chars (C-t)</code><a name="index-transpose_002dchars-_0028C_002dt_0029-2504"></a><dd>Drag the character before the cursor forward over
the character at the cursor, moving the
cursor forward as well. If the insertion point
is at the end of the line, then this
transposes the last two characters of the line.
Negative arguments have no effect.
<br><dt><code>transpose-words (M-t)</code><a name="index-transpose_002dwords-_0028M_002dt_0029-2505"></a><dd>Drag the word before point past the word after point,
moving point past that word as well.
If the insertion point is at the end of the line, this transposes
the last two words on the line.
<br><dt><code>upcase-word (M-u)</code><a name="index-upcase_002dword-_0028M_002du_0029-2506"></a><dd>Uppercase the current (or following) word. With a negative argument,
uppercase the previous word, but do not move the cursor.
<br><dt><code>downcase-word (M-l)</code><a name="index-downcase_002dword-_0028M_002dl_0029-2507"></a><dd>Lowercase the current (or following) word. With a negative argument,
lowercase the previous word, but do not move the cursor.
<br><dt><code>capitalize-word (M-c)</code><a name="index-capitalize_002dword-_0028M_002dc_0029-2508"></a><dd>Capitalize the current (or following) word. With a negative argument,
capitalize the previous word, but do not move the cursor.
<br><dt><code>overwrite-mode ()</code><a name="index-overwrite_002dmode-_0028_0029-2509"></a><dd>Toggle overwrite mode. With an explicit positive numeric argument,
switches to overwrite mode. With an explicit non-positive numeric
argument, switches to insert mode. This command affects only
<code>emacs</code> mode; <code>vi</code> mode does overwrite differently.
Each call to <code>readline()</code> starts in insert mode.
<p>In overwrite mode, characters bound to <code>self-insert</code> replace
the text at point rather than pushing the text to the right.
Characters bound to <code>backward-delete-char</code> replace the character
before point with a space.
<p>By default, this command is unbound.
</dl>
</body></html>

View file

@ -0,0 +1,271 @@
<html lang="en">
<head>
<title>Commands In Python - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Python-API.html#Python-API" title="Python API">
<link rel="prev" href="Threads-In-Python.html#Threads-In-Python" title="Threads In Python">
<link rel="next" href="Parameters-In-Python.html#Parameters-In-Python" title="Parameters In Python">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Commands-In-Python"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Parameters-In-Python.html#Parameters-In-Python">Parameters In Python</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Threads-In-Python.html#Threads-In-Python">Threads In Python</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Python-API.html#Python-API">Python API</a>
<hr>
</div>
<h5 class="subsubsection">23.2.2.12 Commands In Python</h5>
<p><a name="index-commands-in-python-1907"></a><a name="index-python-commands-1908"></a>You can implement new <span class="sc">gdb</span> CLI commands in Python. A CLI
command is implemented using an instance of the <code>gdb.Command</code>
class, most commonly using a subclass.
<div class="defun">
&mdash; Function: <b>Command.__init__</b> (<var>name, command_class </var><span class="roman">[</span><var>, completer_class </var><span class="roman">[</span><var>, prefix</var><span class="roman">]]</span>)<var><a name="index-Command_002e_005f_005finit_005f_005f-1909"></a></var><br>
<blockquote><p>The object initializer for <code>Command</code> registers the new command
with <span class="sc">gdb</span>. This initializer is normally invoked from the
subclass' own <code>__init__</code> method.
<p><var>name</var> is the name of the command. If <var>name</var> consists of
multiple words, then the initial words are looked for as prefix
commands. In this case, if one of the prefix commands does not exist,
an exception is raised.
<p>There is no support for multi-line commands.
<p><var>command_class</var> should be one of the &lsquo;<samp><span class="samp">COMMAND_</span></samp>&rsquo; constants
defined below. This argument tells <span class="sc">gdb</span> how to categorize the
new command in the help system.
<p><var>completer_class</var> is an optional argument. If given, it should be
one of the &lsquo;<samp><span class="samp">COMPLETE_</span></samp>&rsquo; constants defined below. This argument
tells <span class="sc">gdb</span> how to perform completion for this command. If not
given, <span class="sc">gdb</span> will attempt to complete using the object's
<code>complete</code> method (see below); if no such method is found, an
error will occur when completion is attempted.
<p><var>prefix</var> is an optional argument. If <code>True</code>, then the new
command is a prefix command; sub-commands of this command may be
registered.
<p>The help text for the new command is taken from the Python
documentation string for the command's class, if there is one. If no
documentation string is provided, the default value &ldquo;This command is
not documented.&rdquo; is used.
</p></blockquote></div>
<p><a name="index-don_0027t-repeat-Python-command-1910"></a>
<div class="defun">
&mdash; Function: <b>Command.dont_repeat</b> ()<var><a name="index-Command_002edont_005frepeat-1911"></a></var><br>
<blockquote><p>By default, a <span class="sc">gdb</span> command is repeated when the user enters a
blank line at the command prompt. A command can suppress this
behavior by invoking the <code>dont_repeat</code> method. This is similar
to the user command <code>dont-repeat</code>, see <a href="Define.html#Define">dont-repeat</a>.
</p></blockquote></div>
<div class="defun">
&mdash; Function: <b>Command.invoke</b> (<var>argument, from_tty</var>)<var><a name="index-Command_002einvoke-1912"></a></var><br>
<blockquote><p>This method is called by <span class="sc">gdb</span> when this command is invoked.
<p><var>argument</var> is a string. It is the argument to the command, after
leading and trailing whitespace has been stripped.
<p><var>from_tty</var> is a boolean argument. When true, this means that the
command was entered by the user at the terminal; when false it means
that the command came from elsewhere.
<p>If this method throws an exception, it is turned into a <span class="sc">gdb</span>
<code>error</code> call. Otherwise, the return value is ignored.
<p><a name="index-gdb_002estring_005fto_005fargv-1913"></a>To break <var>argument</var> up into an argv-like string use
<code>gdb.string_to_argv</code>. This function behaves identically to
<span class="sc">gdb</span>'s internal argument lexer <code>buildargv</code>.
It is recommended to use this for consistency.
Arguments are separated by spaces and may be quoted.
Example:
<pre class="smallexample"> print gdb.string_to_argv ("1 2\ \\\"3 '4 \"5' \"6 '7\"")
['1', '2 "3', '4 "5', "6 '7"]
</pre>
</blockquote></div>
<p><a name="index-completion-of-Python-commands-1914"></a>
<div class="defun">
&mdash; Function: <b>Command.complete</b> (<var>text, word</var>)<var><a name="index-Command_002ecomplete-1915"></a></var><br>
<blockquote><p>This method is called by <span class="sc">gdb</span> when the user attempts
completion on this command. All forms of completion are handled by
this method, that is, the &lt;TAB&gt; and &lt;M-?&gt; key bindings
(see <a href="Completion.html#Completion">Completion</a>), and the <code>complete</code> command (see <a href="Help.html#Help">complete</a>).
<p>The arguments <var>text</var> and <var>word</var> are both strings. <var>text</var>
holds the complete command line up to the cursor's location.
<var>word</var> holds the last word of the command line; this is computed
using a word-breaking heuristic.
<p>The <code>complete</code> method can return several values:
<ul>
<li>If the return value is a sequence, the contents of the sequence are
used as the completions. It is up to <code>complete</code> to ensure that the
contents actually do complete the word. A zero-length sequence is
allowed, it means that there were no completions available. Only
string elements of the sequence are used; other elements in the
sequence are ignored.
<li>If the return value is one of the &lsquo;<samp><span class="samp">COMPLETE_</span></samp>&rsquo; constants defined
below, then the corresponding <span class="sc">gdb</span>-internal completion
function is invoked, and its result is used.
<li>All other results are treated as though there were no available
completions.
</ul>
</p></blockquote></div>
<p>When a new command is registered, it must be declared as a member of
some general class of commands. This is used to classify top-level
commands in the on-line help system; note that prefix commands are not
listed under their own category but rather that of their top-level
command. The available classifications are represented by constants
defined in the <code>gdb</code> module:
<a name="index-COMMAND_005fNONE-1916"></a>
<a name="index-gdb_002eCOMMAND_005fNONE-1917"></a>
<dl><dt><code>gdb.COMMAND_NONE</code><dd>The command does not belong to any particular class. A command in
this category will not be displayed in any of the help categories.
<p><a name="index-COMMAND_005fRUNNING-1918"></a><a name="index-gdb_002eCOMMAND_005fRUNNING-1919"></a><br><dt><code>gdb.COMMAND_RUNNING</code><dd>The command is related to running the inferior. For example,
<code>start</code>, <code>step</code>, and <code>continue</code> are in this category.
Type <kbd>help running</kbd> at the <span class="sc">gdb</span> prompt to see a list of
commands in this category.
<p><a name="index-COMMAND_005fDATA-1920"></a><a name="index-gdb_002eCOMMAND_005fDATA-1921"></a><br><dt><code>gdb.COMMAND_DATA</code><dd>The command is related to data or variables. For example,
<code>call</code>, <code>find</code>, and <code>print</code> are in this category. Type
<kbd>help data</kbd> at the <span class="sc">gdb</span> prompt to see a list of commands
in this category.
<p><a name="index-COMMAND_005fSTACK-1922"></a><a name="index-gdb_002eCOMMAND_005fSTACK-1923"></a><br><dt><code>gdb.COMMAND_STACK</code><dd>The command has to do with manipulation of the stack. For example,
<code>backtrace</code>, <code>frame</code>, and <code>return</code> are in this
category. Type <kbd>help stack</kbd> at the <span class="sc">gdb</span> prompt to see a
list of commands in this category.
<p><a name="index-COMMAND_005fFILES-1924"></a><a name="index-gdb_002eCOMMAND_005fFILES-1925"></a><br><dt><code>gdb.COMMAND_FILES</code><dd>This class is used for file-related commands. For example,
<code>file</code>, <code>list</code> and <code>section</code> are in this category.
Type <kbd>help files</kbd> at the <span class="sc">gdb</span> prompt to see a list of
commands in this category.
<p><a name="index-COMMAND_005fSUPPORT-1926"></a><a name="index-gdb_002eCOMMAND_005fSUPPORT-1927"></a><br><dt><code>gdb.COMMAND_SUPPORT</code><dd>This should be used for &ldquo;support facilities&rdquo;, generally meaning
things that are useful to the user when interacting with <span class="sc">gdb</span>,
but not related to the state of the inferior. For example,
<code>help</code>, <code>make</code>, and <code>shell</code> are in this category. Type
<kbd>help support</kbd> at the <span class="sc">gdb</span> prompt to see a list of
commands in this category.
<p><a name="index-COMMAND_005fSTATUS-1928"></a><a name="index-gdb_002eCOMMAND_005fSTATUS-1929"></a><br><dt><code>gdb.COMMAND_STATUS</code><dd>The command is an &lsquo;<samp><span class="samp">info</span></samp>&rsquo;-related command, that is, related to the
state of <span class="sc">gdb</span> itself. For example, <code>info</code>, <code>macro</code>,
and <code>show</code> are in this category. Type <kbd>help status</kbd> at the
<span class="sc">gdb</span> prompt to see a list of commands in this category.
<p><a name="index-COMMAND_005fBREAKPOINTS-1930"></a><a name="index-gdb_002eCOMMAND_005fBREAKPOINTS-1931"></a><br><dt><code>gdb.COMMAND_BREAKPOINTS</code><dd>The command has to do with breakpoints. For example, <code>break</code>,
<code>clear</code>, and <code>delete</code> are in this category. Type <kbd>help
breakpoints</kbd> at the <span class="sc">gdb</span> prompt to see a list of commands in
this category.
<p><a name="index-COMMAND_005fTRACEPOINTS-1932"></a><a name="index-gdb_002eCOMMAND_005fTRACEPOINTS-1933"></a><br><dt><code>gdb.COMMAND_TRACEPOINTS</code><dd>The command has to do with tracepoints. For example, <code>trace</code>,
<code>actions</code>, and <code>tfind</code> are in this category. Type
<kbd>help tracepoints</kbd> at the <span class="sc">gdb</span> prompt to see a list of
commands in this category.
<p><a name="index-COMMAND_005fUSER-1934"></a><a name="index-gdb_002eCOMMAND_005fUSER-1935"></a><br><dt><code>gdb.COMMAND_USER</code><dd>The command is a general purpose command for the user, and typically
does not fit in one of the other categories.
Type <kbd>help user-defined</kbd> at the <span class="sc">gdb</span> prompt to see
a list of commands in this category, as well as the list of gdb macros
(see <a href="Sequences.html#Sequences">Sequences</a>).
<p><a name="index-COMMAND_005fOBSCURE-1936"></a><a name="index-gdb_002eCOMMAND_005fOBSCURE-1937"></a><br><dt><code>gdb.COMMAND_OBSCURE</code><dd>The command is only used in unusual circumstances, or is not of
general interest to users. For example, <code>checkpoint</code>,
<code>fork</code>, and <code>stop</code> are in this category. Type <kbd>help
obscure</kbd> at the <span class="sc">gdb</span> prompt to see a list of commands in this
category.
<p><a name="index-COMMAND_005fMAINTENANCE-1938"></a><a name="index-gdb_002eCOMMAND_005fMAINTENANCE-1939"></a><br><dt><code>gdb.COMMAND_MAINTENANCE</code><dd>The command is only useful to <span class="sc">gdb</span> maintainers. The
<code>maintenance</code> and <code>flushregs</code> commands are in this category.
Type <kbd>help internals</kbd> at the <span class="sc">gdb</span> prompt to see a list of
commands in this category.
</dl>
<p>A new command can use a predefined completion function, either by
specifying it via an argument at initialization, or by returning it
from the <code>complete</code> method. These predefined completion
constants are all defined in the <code>gdb</code> module:
<a name="index-COMPLETE_005fNONE-1940"></a>
<a name="index-gdb_002eCOMPLETE_005fNONE-1941"></a>
<dl><dt><code>gdb.COMPLETE_NONE</code><dd>This constant means that no completion should be done.
<p><a name="index-COMPLETE_005fFILENAME-1942"></a><a name="index-gdb_002eCOMPLETE_005fFILENAME-1943"></a><br><dt><code>gdb.COMPLETE_FILENAME</code><dd>This constant means that filename completion should be performed.
<p><a name="index-COMPLETE_005fLOCATION-1944"></a><a name="index-gdb_002eCOMPLETE_005fLOCATION-1945"></a><br><dt><code>gdb.COMPLETE_LOCATION</code><dd>This constant means that location completion should be done.
See <a href="Specify-Location.html#Specify-Location">Specify Location</a>.
<p><a name="index-COMPLETE_005fCOMMAND-1946"></a><a name="index-gdb_002eCOMPLETE_005fCOMMAND-1947"></a><br><dt><code>gdb.COMPLETE_COMMAND</code><dd>This constant means that completion should examine <span class="sc">gdb</span>
command names.
<p><a name="index-COMPLETE_005fSYMBOL-1948"></a><a name="index-gdb_002eCOMPLETE_005fSYMBOL-1949"></a><br><dt><code>gdb.COMPLETE_SYMBOL</code><dd>This constant means that completion should be done using symbol names
as the source.
</dl>
<p>The following code snippet shows how a trivial CLI command can be
implemented in Python:
<pre class="smallexample"> class HelloWorld (gdb.Command):
"""Greet the whole world."""
def __init__ (self):
super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
def invoke (self, arg, from_tty):
print "Hello, World!"
HelloWorld ()
</pre>
<p>The last line instantiates the class, and is necessary to trigger the
registration of the command with <span class="sc">gdb</span>. Depending on how the
Python code is read into <span class="sc">gdb</span>, you may need to import the
<code>gdb</code> module explicitly.
</body></html>

View file

@ -0,0 +1,62 @@
<html lang="en">
<head>
<title>Commands - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="Invocation.html#Invocation" title="Invocation">
<link rel="next" href="Running.html#Running" title="Running">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Commands"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Running.html#Running">Running</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Invocation.html#Invocation">Invocation</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>
<h2 class="chapter">3 <span class="sc">gdb</span> Commands</h2>
<p>You can abbreviate a <span class="sc">gdb</span> command to the first few letters of the command
name, if that abbreviation is unambiguous; and you can repeat certain
<span class="sc">gdb</span> commands by typing just &lt;RET&gt;. You can also use the &lt;TAB&gt;
key to get <span class="sc">gdb</span> 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).
<ul class="menu">
<li><a accesskey="1" href="Command-Syntax.html#Command-Syntax">Command Syntax</a>: How to give commands to <span class="sc">gdb</span>
<li><a accesskey="2" href="Completion.html#Completion">Completion</a>: Command completion
<li><a accesskey="3" href="Help.html#Help">Help</a>: How to ask <span class="sc">gdb</span> for help
</ul>
</body></html>

View file

@ -0,0 +1,89 @@
<html lang="en">
<head>
<title>Compilation - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Running.html#Running" title="Running">
<link rel="next" href="Starting.html#Starting" title="Starting">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Compilation"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Starting.html#Starting">Starting</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Running.html#Running">Running</a>
<hr>
</div>
<h3 class="section">4.1 Compiling for Debugging</h3>
<p>In order to debug a program effectively, you need to generate
debugging information when you compile it. This debugging information
is stored in the object file; it describes the data type of each
variable or function and the correspondence between source line numbers
and addresses in the executable code.
<p>To request debugging information, specify the &lsquo;<samp><span class="samp">-g</span></samp>&rsquo; option when you run
the compiler.
<p>Programs that are to be shipped to your customers are compiled with
optimizations, using the &lsquo;<samp><span class="samp">-O</span></samp>&rsquo; compiler option. However, some
compilers are unable to handle the &lsquo;<samp><span class="samp">-g</span></samp>&rsquo; and &lsquo;<samp><span class="samp">-O</span></samp>&rsquo; options
together. Using those compilers, you cannot generate optimized
executables containing debugging information.
<p><span class="sc">gcc</span>, the <span class="sc">gnu</span> C/C<tt>++</tt> compiler, supports &lsquo;<samp><span class="samp">-g</span></samp>&rsquo; with or
without &lsquo;<samp><span class="samp">-O</span></samp>&rsquo;, making it possible to debug optimized code. We
recommend that you <em>always</em> use &lsquo;<samp><span class="samp">-g</span></samp>&rsquo; whenever you compile a
program. You may think your program is correct, but there is no sense
in pushing your luck. For more information, see <a href="Optimized-Code.html#Optimized-Code">Optimized Code</a>.
<p>Older versions of the <span class="sc">gnu</span> C compiler permitted a variant option
&lsquo;<samp><span class="samp">-gg</span></samp>&rsquo;<!-- /@w --> for debugging information. <span class="sc">gdb</span> no longer supports this
format; if your <span class="sc">gnu</span> C compiler has this option, do not use it.
<p><span class="sc">gdb</span> knows about preprocessor macros and can show you their
expansion (see <a href="Macros.html#Macros">Macros</a>). Most compilers do not include information
about preprocessor macros in the debugging information if you specify
the <samp><span class="option">-g</span></samp> flag alone. Version 3.1 and later of <span class="sc">gcc</span>,
the <span class="sc">gnu</span> C compiler, provides macro information if you are using
the DWARF debugging format, and specify the option <samp><span class="option">-g3</span></samp>.
<p>See <a href="../gcc/Debugging-Options.html#Debugging-Options">Options for Debugging Your Program or GCC</a>, for more
information on <span class="sc">gcc</span> options affecting debug information.
<p>You will have the best debugging experience if you use the latest
version of the DWARF debugging format that your compiler supports.
DWARF is currently the most expressive and best supported debugging
format in <span class="sc">gdb</span>.
</body></html>

View file

@ -0,0 +1,185 @@
<html lang="en">
<head>
<title>Completion - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Commands.html#Commands" title="Commands">
<link rel="prev" href="Command-Syntax.html#Command-Syntax" title="Command Syntax">
<link rel="next" href="Help.html#Help" title="Help">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Completion"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Help.html#Help">Help</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Command-Syntax.html#Command-Syntax">Command Syntax</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Commands.html#Commands">Commands</a>
<hr>
</div>
<h3 class="section">3.2 Command Completion</h3>
<p><a name="index-completion-81"></a><a name="index-word-completion-82"></a><span class="sc">gdb</span> 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 <span class="sc">gdb</span>
commands, <span class="sc">gdb</span> subcommands, and the names of symbols in your program.
<p>Press the &lt;TAB&gt; key whenever you want <span class="sc">gdb</span> to fill out the rest
of a word. If there is only one possibility, <span class="sc">gdb</span> fills in the
word, and waits for you to finish the command (or press &lt;RET&gt; to
enter it). For example, if you type
<!-- FIXME "@key" does not distinguish its argument sufficiently to permit -->
<!-- complete accuracy in these examples; space introduced for clarity. -->
<!-- If texinfo enhancements make it unnecessary, it would be nice to -->
<!-- replace " @key" by "@key" in the following... -->
<pre class="smallexample"> (gdb) info bre &lt;TAB&gt;
</pre>
<p class="noindent"><span class="sc">gdb</span> fills in the rest of the word &lsquo;<samp><span class="samp">breakpoints</span></samp>&rsquo;, since that is
the only <code>info</code> subcommand beginning with &lsquo;<samp><span class="samp">bre</span></samp>&rsquo;:
<pre class="smallexample"> (gdb) info breakpoints
</pre>
<p class="noindent">You can either press &lt;RET&gt; at this point, to run the <code>info
breakpoints</code> command, or backspace and enter something else, if
&lsquo;<samp><span class="samp">breakpoints</span></samp>&rsquo; 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 &lt;RET&gt; immediately after &lsquo;<samp><span class="samp">info bre</span></samp>&rsquo;,
to exploit command abbreviations rather than command completion).
<p>If there is more than one possibility for the next word when you press
&lt;TAB&gt;, <span class="sc">gdb</span> sounds a bell. You can either supply more
characters and try again, or just press &lt;TAB&gt; a second time;
<span class="sc">gdb</span> displays all the possible completions for that word. For
example, you might want to set a breakpoint on a subroutine whose name
begins with &lsquo;<samp><span class="samp">make_</span></samp>&rsquo;, but when you type <kbd>b make_&lt;TAB&gt;</kbd> <span class="sc">gdb</span>
just sounds the bell. Typing &lt;TAB&gt; again displays all the
function names in your program that begin with those characters, for
example:
<pre class="smallexample"> (gdb) b make_ &lt;TAB&gt;
<br><span class="sc">gdb</span> sounds bell; press &lt;TAB&gt; again, to see:<br>
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_
</pre>
<p class="noindent">After displaying the available possibilities, <span class="sc">gdb</span> copies your
partial input (&lsquo;<samp><span class="samp">b make_</span></samp>&rsquo; in the example) so you can finish the
command.
<p>If you just want to see the list of alternatives in the first place, you
can press <kbd>M-?</kbd> rather than pressing &lt;TAB&gt; twice. <kbd>M-?</kbd>
means <kbd>&lt;META&gt; ?</kbd>. You can type this either by holding down a
key designated as the &lt;META&gt; shift on your keyboard (if there is
one) while typing <kbd>?</kbd>, or as &lt;ESC&gt; followed by <kbd>?</kbd>.
<p><a name="index-quotes-in-commands-83"></a><a name="index-completion-of-quoted-strings-84"></a>Sometimes the string you need, while logically a &ldquo;word&rdquo;, may contain
parentheses or other characters that <span class="sc">gdb</span> 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
<span class="sc">gdb</span> commands.
<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
<span class="sc">gdb</span> that it may need to consider more information than usual
when you press &lt;TAB&gt; or <kbd>M-?</kbd> to request word completion:
<pre class="smallexample"> (gdb) b 'bubble( <kbd>M-?</kbd>
bubble(double,double) bubble(int,int)
(gdb) b 'bubble(
</pre>
<p>In some cases, <span class="sc">gdb</span> can tell that completing a name requires using
quotes. When this happens, <span class="sc">gdb</span> inserts the quote for you (while
completing as much as it can) if you do not type the quote in the first
place:
<pre class="smallexample"> (gdb) b bub &lt;TAB&gt;
<br><span class="sc">gdb</span> alters your input line to the following, and rings a bell:<br>
(gdb) b 'bubble(
</pre>
<p class="noindent">In general, <span class="sc">gdb</span> 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>For more information about overloaded functions, see <a href="C-Plus-Plus-Expressions.html#C-Plus-Plus-Expressions">C<tt>++</tt> Expressions</a>. You can use the command <code>set
overload-resolution off</code> to disable overload resolution;
see <a href="Debugging-C-Plus-Plus.html#Debugging-C-Plus-Plus"><span class="sc">gdb</span> Features for C<tt>++</tt></a>.
<p><a name="index-completion-of-structure-field-names-85"></a><a name="index-structure-field-name-completion-86"></a><a name="index-completion-of-union-field-names-87"></a><a name="index-union-field-name-completion-88"></a>When completing in an expression which looks up a field in a
structure, <span class="sc">gdb</span> also tries<a rel="footnote" href="#fn-1" name="fnd-1"><sup>1</sup></a> to
limit completions to the field names available in the type of the
left-hand-side:
<pre class="smallexample"> (gdb) p gdb_stdout.<kbd>M-?</kbd>
magic to_fputs to_rewind
to_data to_isatty to_write
to_delete to_put to_write_async_safe
to_flush to_read
</pre>
<p class="noindent">This is because the <code>gdb_stdout</code> is a variable of the type
<code>struct ui_file</code> that is defined in <span class="sc">gdb</span> sources as
follows:
<pre class="smallexample"> struct ui_file
{
int *magic;
ui_file_flush_ftype *to_flush;
ui_file_write_ftype *to_write;
ui_file_write_async_safe_ftype *to_write_async_safe;
ui_file_fputs_ftype *to_fputs;
ui_file_read_ftype *to_read;
ui_file_delete_ftype *to_delete;
ui_file_isatty_ftype *to_isatty;
ui_file_rewind_ftype *to_rewind;
ui_file_put_ftype *to_put;
void *to_data;
}
</pre>
<div class="footnote">
<hr>
<h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small> The completer can be
confused by certain kinds of invalid expressions. Also, it only
examines the static type of the expression, not the dynamic type.</p>
<hr></div>
</body></html>

View file

@ -0,0 +1,105 @@
<html lang="en">
<head>
<title>Conditional Init Constructs - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Readline-Init-File.html#Readline-Init-File" title="Readline Init File">
<link rel="prev" href="Readline-Init-File-Syntax.html#Readline-Init-File-Syntax" title="Readline Init File Syntax">
<link rel="next" href="Sample-Init-File.html#Sample-Init-File" title="Sample Init File">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Conditional-Init-Constructs"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Sample-Init-File.html#Sample-Init-File">Sample Init File</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Readline-Init-File-Syntax.html#Readline-Init-File-Syntax">Readline Init File Syntax</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Readline-Init-File.html#Readline-Init-File">Readline Init File</a>
<hr>
</div>
<h4 class="subsection">32.3.2 Conditional Init Constructs</h4>
<p>Readline implements a facility similar in spirit to the conditional
compilation features of the C preprocessor which allows key
bindings and variable settings to be performed as the result
of tests. There are four parser directives used.
<dl>
<dt><code>$if</code><dd>The <code>$if</code> construct allows bindings to be made based on the
editing mode, the terminal being used, or the application using
Readline. The text of the test extends to the end of the line;
no characters are required to isolate it.
<dl>
<dt><code>mode</code><dd>The <code>mode=</code> form of the <code>$if</code> directive is used to test
whether Readline is in <code>emacs</code> or <code>vi</code> mode.
This may be used in conjunction
with the &lsquo;<samp><span class="samp">set keymap</span></samp>&rsquo; command, for instance, to set bindings in
the <code>emacs-standard</code> and <code>emacs-ctlx</code> keymaps only if
Readline is starting out in <code>emacs</code> mode.
<br><dt><code>term</code><dd>The <code>term=</code> form may be used to include terminal-specific
key bindings, perhaps to bind the key sequences output by the
terminal's function keys. The word on the right side of the
&lsquo;<samp><span class="samp">=</span></samp>&rsquo; is tested against both the full name of the terminal and
the portion of the terminal name before the first &lsquo;<samp><span class="samp">-</span></samp>&rsquo;. This
allows <code>sun</code> to match both <code>sun</code> and <code>sun-cmd</code>,
for instance.
<br><dt><code>application</code><dd>The <var>application</var> construct is used to include
application-specific settings. Each program using the Readline
library sets the <var>application name</var>, and you can test for
a particular value.
This could be used to bind key sequences to functions useful for
a specific program. For instance, the following command adds a
key sequence that quotes the current or previous word in Bash:
<pre class="example"> $if Bash
# Quote the current or previous word
"\C-xq": "\eb\"\ef\""
$endif
</pre>
</dl>
<br><dt><code>$endif</code><dd>This command, as seen in the previous example, terminates an
<code>$if</code> command.
<br><dt><code>$else</code><dd>Commands in this branch of the <code>$if</code> directive are executed if
the test fails.
<br><dt><code>$include</code><dd>This directive takes a single filename as an argument and reads commands
and bindings from that file.
For example, the following directive reads from <samp><span class="file">/etc/inputrc</span></samp>:
<pre class="example"> $include /etc/inputrc
</pre>
</dl>
</body></html>

View file

@ -0,0 +1,166 @@
<html lang="en">
<head>
<title>Conditions - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Breakpoints.html#Breakpoints" title="Breakpoints">
<link rel="prev" href="Disabling.html#Disabling" title="Disabling">
<link rel="next" href="Break-Commands.html#Break-Commands" title="Break Commands">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Conditions"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Break-Commands.html#Break-Commands">Break Commands</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Disabling.html#Disabling">Disabling</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Breakpoints.html#Breakpoints">Breakpoints</a>
<hr>
</div>
<h4 class="subsection">5.1.6 Break Conditions</h4>
<p><a name="index-conditional-breakpoints-279"></a><a name="index-breakpoint-conditions-280"></a>
<!-- FIXME what is scope of break condition expr? Context where wanted? -->
<!-- in particular for a watchpoint? -->
The simplest sort of breakpoint breaks every time your program reaches a
specified place. You can also specify a <dfn>condition</dfn> for a
breakpoint. A condition is just a Boolean expression in your
programming language (see <a href="Expressions.html#Expressions">Expressions</a>). A breakpoint with
a condition evaluates the expression each time your program reaches it,
and your program stops only if the condition is <em>true</em>.
<p>This is the converse of using assertions for program validation; in that
situation, you want to stop when the assertion is violated&mdash;that is,
when the condition is false. In C, if you want to test an assertion expressed
by the condition <var>assert</var>, you should set the condition
&lsquo;<samp><span class="samp">! </span><var>assert</var></samp>&rsquo; on the appropriate breakpoint.
<p>Conditions are also accepted for watchpoints; you may not need them,
since a watchpoint is inspecting the value of an expression anyhow&mdash;but
it might be simpler, say, to just set a watchpoint on a variable name,
and specify a condition that tests whether the new value is an interesting
one.
<p>Break conditions can have side effects, and may even call functions in
your program. This can be useful, for example, to activate functions
that log program progress, or to use your own print functions to
format special data structures. The effects are completely predictable
unless there is another enabled breakpoint at the same address. (In
that case, <span class="sc">gdb</span> might see the other breakpoint first and stop your
program without checking the condition of this one.) Note that
breakpoint commands are usually more convenient and flexible than break
conditions for the
purpose of performing side effects when a breakpoint is reached
(see <a href="Break-Commands.html#Break-Commands">Breakpoint Command Lists</a>).
<p>Breakpoint conditions can also be evaluated on the target's side if
the target supports it. Instead of evaluating the conditions locally,
<span class="sc">gdb</span> encodes the expression into an agent expression
(see <a href="Agent-Expressions.html#Agent-Expressions">Agent Expressions</a>) suitable for execution on the target,
independently of <span class="sc">gdb</span>. Global variables become raw memory
locations, locals become stack accesses, and so forth.
<p>In this case, <span class="sc">gdb</span> will only be notified of a breakpoint trigger
when its condition evaluates to true. This mechanism may provide faster
response times depending on the performance characteristics of the target
since it does not need to keep <span class="sc">gdb</span> informed about
every breakpoint trigger, even those with false conditions.
<p>Break conditions can be specified when a breakpoint is set, by using
&lsquo;<samp><span class="samp">if</span></samp>&rsquo; in the arguments to the <code>break</code> command. See <a href="Set-Breaks.html#Set-Breaks">Setting Breakpoints</a>. They can also be changed at any time
with the <code>condition</code> command.
<p>You can also use the <code>if</code> keyword with the <code>watch</code> command.
The <code>catch</code> command does not recognize the <code>if</code> keyword;
<code>condition</code> is the only way to impose a further condition on a
catchpoint.
<a name="index-condition-281"></a>
<dl><dt><code>condition </code><var>bnum</var> <var>expression</var><dd>Specify <var>expression</var> as the break condition for breakpoint,
watchpoint, or catchpoint number <var>bnum</var>. After you set a condition,
breakpoint <var>bnum</var> stops your program only if the value of
<var>expression</var> is true (nonzero, in C). When you use
<code>condition</code>, <span class="sc">gdb</span> checks <var>expression</var> immediately for
syntactic correctness, and to determine whether symbols in it have
referents in the context of your breakpoint. If <var>expression</var> uses
symbols not referenced in the context of the breakpoint, <span class="sc">gdb</span>
prints an error message:
<pre class="smallexample"> No symbol "foo" in current context.
</pre>
<p class="noindent"><span class="sc">gdb</span> does
not actually evaluate <var>expression</var> at the time the <code>condition</code>
command (or a command that sets a breakpoint with a condition, like
<code>break if ...</code>) is given, however. See <a href="Expressions.html#Expressions">Expressions</a>.
<br><dt><code>condition </code><var>bnum</var><dd>Remove the condition from breakpoint number <var>bnum</var>. It becomes
an ordinary unconditional breakpoint.
</dl>
<p><a name="index-ignore-count-_0028of-breakpoint_0029-282"></a>A special case of a breakpoint condition is to stop only when the
breakpoint has been reached a certain number of times. This is so
useful that there is a special way to do it, using the <dfn>ignore
count</dfn> of the breakpoint. Every breakpoint has an ignore count, which
is an integer. Most of the time, the ignore count is zero, and
therefore has no effect. But if your program reaches a breakpoint whose
ignore count is positive, then instead of stopping, it just decrements
the ignore count by one and continues. As a result, if the ignore count
value is <var>n</var>, the breakpoint does not stop the next <var>n</var> times
your program reaches it.
<a name="index-ignore-283"></a>
<dl><dt><code>ignore </code><var>bnum</var> <var>count</var><dd>Set the ignore count of breakpoint number <var>bnum</var> to <var>count</var>.
The next <var>count</var> times the breakpoint is reached, your program's
execution does not stop; other than to decrement the ignore count, <span class="sc">gdb</span>
takes no action.
<p>To make the breakpoint stop the next time it is reached, specify
a count of zero.
<p>When you use <code>continue</code> to resume execution of your program from a
breakpoint, you can specify an ignore count directly as an argument to
<code>continue</code>, rather than using <code>ignore</code>. See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">Continuing and Stepping</a>.
<p>If a breakpoint has a positive ignore count and a condition, the
condition is not checked. Once the ignore count reaches zero,
<span class="sc">gdb</span> resumes checking the condition.
<p>You could achieve the effect of the ignore count with a condition such
as &lsquo;<samp><span class="samp">$foo--&nbsp;&lt;=&nbsp;0</span></samp>&rsquo;<!-- /@w --> using a debugger convenience variable that
is decremented each time. See <a href="Convenience-Vars.html#Convenience-Vars">Convenience Variables</a>.
</dl>
<p>Ignore counts apply to breakpoints, watchpoints, and catchpoints.
</body></html>

View file

@ -0,0 +1,85 @@
<html lang="en">
<head>
<title>Config Names - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Installing-GDB.html#Installing-GDB" title="Installing GDB">
<link rel="prev" href="Separate-Objdir.html#Separate-Objdir" title="Separate Objdir">
<link rel="next" href="Configure-Options.html#Configure-Options" title="Configure Options">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Config-Names"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Configure-Options.html#Configure-Options">Configure Options</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Separate-Objdir.html#Separate-Objdir">Separate Objdir</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Installing-GDB.html#Installing-GDB">Installing GDB</a>
<hr>
</div>
<h3 class="section">C.4 Specifying Names for Hosts and Targets</h3>
<p>The specifications used for hosts and targets in the <samp><span class="file">configure</span></samp>
script are based on a three-part naming scheme, but some short predefined
aliases are also supported. The full naming scheme encodes three pieces
of information in the following pattern:
<pre class="smallexample"> <var>architecture</var>-<var>vendor</var>-<var>os</var>
</pre>
<p>For example, you can use the alias <code>sun4</code> as a <var>host</var> argument,
or as the value for <var>target</var> in a <code>--target=</code><var>target</var>
option. The equivalent full name is &lsquo;<samp><span class="samp">sparc-sun-sunos4</span></samp>&rsquo;.
<p>The <samp><span class="file">configure</span></samp> script accompanying <span class="sc">gdb</span> does not provide
any query facility to list all supported host and target names or
aliases. <samp><span class="file">configure</span></samp> calls the Bourne shell script
<code>config.sub</code> to map abbreviations to full names; you can read the
script, if you wish, or you can use it to test your guesses on
abbreviations&mdash;for example:
<pre class="smallexample"> % sh config.sub i386-linux
i386-pc-linux-gnu
% sh config.sub alpha-linux
alpha-unknown-linux-gnu
% sh config.sub hp9k700
hppa1.1-hp-hpux
% sh config.sub sun4
sparc-sun-sunos4.1.1
% sh config.sub sun3
m68k-sun-sunos4.1.1
% sh config.sub i986v
Invalid configuration `i986v': machine `i986v' not recognized
</pre>
<p class="noindent"><code>config.sub</code> is also distributed in the <span class="sc">gdb</span> source
directory (<samp><span class="file">gdb-7.6.0.20140228-cvs</span></samp>, for version 7.6.0.20140228-cvs).
</body></html>

View file

@ -0,0 +1,67 @@
<html lang="en">
<head>
<title>Configurations - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="Remote-Debugging.html#Remote-Debugging" title="Remote Debugging">
<link rel="next" href="Controlling-GDB.html#Controlling-GDB" title="Controlling GDB">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Configurations"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Controlling-GDB.html#Controlling-GDB">Controlling GDB</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Remote-Debugging.html#Remote-Debugging">Remote Debugging</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>
<h2 class="chapter">21 Configuration-Specific Information</h2>
<p>While nearly all <span class="sc">gdb</span> commands are available for all native and
cross versions of the debugger, there are some exceptions. This chapter
describes things that are only available in certain configurations.
<p>There are three major categories of configurations: native
configurations, where the host and target are the same, embedded
operating system configurations, which are usually the same for several
different processor architectures, and bare embedded processors, which
are quite different from each other.
<ul class="menu">
<li><a accesskey="1" href="Native.html#Native">Native</a>
<li><a accesskey="2" href="Embedded-OS.html#Embedded-OS">Embedded OS</a>
<li><a accesskey="3" href="Embedded-Processors.html#Embedded-Processors">Embedded Processors</a>
<li><a accesskey="4" href="Architectures.html#Architectures">Architectures</a>
</ul>
</body></html>

View file

@ -0,0 +1,105 @@
<html lang="en">
<head>
<title>Configure Options - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Installing-GDB.html#Installing-GDB" title="Installing GDB">
<link rel="prev" href="Config-Names.html#Config-Names" title="Config Names">
<link rel="next" href="System_002dwide-configuration.html#System_002dwide-configuration" title="System-wide configuration">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Configure-Options"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="System_002dwide-configuration.html#System_002dwide-configuration">System-wide configuration</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Config-Names.html#Config-Names">Config Names</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Installing-GDB.html#Installing-GDB">Installing GDB</a>
<hr>
</div>
<h3 class="section">C.5 <samp><span class="file">configure</span></samp> Options</h3>
<p>Here is a summary of the <samp><span class="file">configure</span></samp> options and arguments that
are most often useful for building <span class="sc">gdb</span>. <samp><span class="file">configure</span></samp> also has
several other options not listed here. see <a href="../configure.info/What-Configure-Does.html#What-Configure-Does">What Configure Does</a>, for a full explanation of <samp><span class="file">configure</span></samp>.
<pre class="smallexample"> configure <span class="roman">[</span>--help<span class="roman">]</span>
<span class="roman">[</span>--prefix=<var>dir</var><span class="roman">]</span>
<span class="roman">[</span>--exec-prefix=<var>dir</var><span class="roman">]</span>
<span class="roman">[</span>--srcdir=<var>dirname</var><span class="roman">]</span>
<span class="roman">[</span>--norecursion<span class="roman">]</span> <span class="roman">[</span>--rm<span class="roman">]</span>
<span class="roman">[</span>--target=<var>target</var><span class="roman">]</span>
<var>host</var>
</pre>
<p class="noindent">You may introduce options with a single &lsquo;<samp><span class="samp">-</span></samp>&rsquo; rather than
&lsquo;<samp><span class="samp">--</span></samp>&rsquo; if you prefer; but you may abbreviate option names if you use
&lsquo;<samp><span class="samp">--</span></samp>&rsquo;.
<dl>
<dt><code>--help</code><dd>Display a quick summary of how to invoke <samp><span class="file">configure</span></samp>.
<br><dt><code>--prefix=</code><var>dir</var><dd>Configure the source to install programs and files under directory
<samp><var>dir</var></samp>.
<br><dt><code>--exec-prefix=</code><var>dir</var><dd>Configure the source to install programs under directory
<samp><var>dir</var></samp>.
<!-- avoid splitting the warning from the explanation: -->
<br><dt><code>--srcdir=</code><var>dirname</var><dd><strong>Warning: using this option requires </strong><span class="sc">gnu</span> <code>make</code><strong>, or another
</strong><code>make</code><strong> that implements the </strong><code>VPATH</code><strong> feature.</strong><br>
Use this option to make configurations in directories separate from the
<span class="sc">gdb</span> source directories. Among other things, you can use this to
build (or maintain) several configurations simultaneously, in separate
directories. <samp><span class="file">configure</span></samp> writes configuration-specific files in
the current directory, but arranges for them to use the source in the
directory <var>dirname</var>. <samp><span class="file">configure</span></samp> creates directories under
the working directory in parallel to the source directories below
<var>dirname</var>.
<br><dt><code>--norecursion</code><dd>Configure only the directory level where <samp><span class="file">configure</span></samp> is executed; do not
propagate configuration to subdirectories.
<br><dt><code>--target=</code><var>target</var><dd>Configure <span class="sc">gdb</span> for cross-debugging programs running on the specified
<var>target</var>. Without this option, <span class="sc">gdb</span> is configured to debug
programs that run on the same machine (<var>host</var>) as <span class="sc">gdb</span> itself.
<p>There is no convenient way to generate a list of all available targets.
<br><dt><var>host</var><code> ...</code><dd>Configure <span class="sc">gdb</span> to run on the specified <var>host</var>.
<p>There is no convenient way to generate a list of all available hosts.
</dl>
<p>There are many other options available as well, but they are generally
needed for special purposes only.
</body></html>

View file

@ -0,0 +1,157 @@
<html lang="en">
<head>
<title>Connecting - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Remote-Debugging.html#Remote-Debugging" title="Remote Debugging">
<link rel="next" href="File-Transfer.html#File-Transfer" title="File Transfer">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Connecting"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="File-Transfer.html#File-Transfer">File Transfer</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Remote-Debugging.html#Remote-Debugging">Remote Debugging</a>
<hr>
</div>
<h3 class="section">20.1 Connecting to a Remote Target</h3>
<p>On the <span class="sc">gdb</span> host machine, you will need an unstripped copy of
your program, since <span class="sc">gdb</span> needs symbol and debugging information.
Start up <span class="sc">gdb</span> as usual, using the name of the local copy of your
program as the first argument.
<p><a name="index-g_t_0040code_007btarget-remote_007d-1157"></a><span class="sc">gdb</span> can communicate with the target over a serial line, or
over an <acronym>IP</acronym> network using <acronym>TCP</acronym> or <acronym>UDP</acronym>. In
each case, <span class="sc">gdb</span> uses the same protocol for debugging your
program; only the medium carrying the debugging packets varies. The
<code>target remote</code> command establishes a connection to the target.
Its arguments indicate which medium to use:
<dl>
<dt><code>target remote </code><var>serial-device</var><dd><a name="index-serial-line_002c-_0040code_007btarget-remote_007d-1158"></a>Use <var>serial-device</var> to communicate with the target. For example,
to use a serial line connected to the device named <samp><span class="file">/dev/ttyb</span></samp>:
<pre class="smallexample"> target remote /dev/ttyb
</pre>
<p>If you're using a serial line, you may want to give <span class="sc">gdb</span> the
&lsquo;<samp><span class="samp">--baud</span></samp>&rsquo;<!-- /@w --> option, or use the <code>set remotebaud</code> command
(see <a href="Remote-Configuration.html#Remote-Configuration">set remotebaud</a>) before the
<code>target</code> command.
<br><dt><code>target remote </code><var>host</var><code>:</code><var>port</var><dt><code>target remote tcp:</code><var>host</var><code>:</code><var>port</var><dd><a name="index-g_t_0040acronym_007bTCP_007d-port_002c-_0040code_007btarget-remote_007d-1159"></a>Debug using a <acronym>TCP</acronym> connection to <var>port</var> on <var>host</var>.
The <var>host</var> may be either a host name or a numeric <acronym>IP</acronym>
address; <var>port</var> must be a decimal number. The <var>host</var> could be
the target machine itself, if it is directly connected to the net, or
it might be a terminal server which in turn has a serial line to the
target.
<p>For example, to connect to port 2828 on a terminal server named
<code>manyfarms</code>:
<pre class="smallexample"> target remote manyfarms:2828
</pre>
<p>If your remote target is actually running on the same machine as your
debugger session (e.g. a simulator for your target running on the
same host), you can omit the hostname. For example, to connect to
port 1234 on your local machine:
<pre class="smallexample"> target remote :1234
</pre>
<p class="noindent">Note that the colon is still required here.
<br><dt><code>target remote udp:</code><var>host</var><code>:</code><var>port</var><dd><a name="index-g_t_0040acronym_007bUDP_007d-port_002c-_0040code_007btarget-remote_007d-1160"></a>Debug using <acronym>UDP</acronym> packets to <var>port</var> on <var>host</var>. For example, to
connect to <acronym>UDP</acronym> port 2828 on a terminal server named <code>manyfarms</code>:
<pre class="smallexample"> target remote udp:manyfarms:2828
</pre>
<p>When using a <acronym>UDP</acronym> connection for remote debugging, you should
keep in mind that the `U' stands for &ldquo;Unreliable&rdquo;. <acronym>UDP</acronym>
can silently drop packets on busy or unreliable networks, which will
cause havoc with your debugging session.
<br><dt><code>target remote | </code><var>command</var><dd><a name="index-pipe_002c-_0040code_007btarget-remote_007d-to-1161"></a>Run <var>command</var> in the background and communicate with it using a
pipe. The <var>command</var> is a shell command, to be parsed and expanded
by the system's command shell, <code>/bin/sh</code>; it should expect remote
protocol packets on its standard input, and send replies on its
standard output. You could use this to run a stand-alone simulator
that speaks the remote debugging protocol, to make net connections
using programs like <code>ssh</code>, or for other similar tricks.
<p>If <var>command</var> closes its standard output (perhaps by exiting),
<span class="sc">gdb</span> will try to send it a <code>SIGTERM</code> signal. (If the
program has already exited, this will have no effect.)
</dl>
<p>Once the connection has been established, you can use all the usual
commands to examine and change data. The remote program is already
running; you can use <kbd>step</kbd> and <kbd>continue</kbd>, and you do not
need to use <kbd>run</kbd>.
<p><a name="index-interrupting-remote-programs-1162"></a><a name="index-remote-programs_002c-interrupting-1163"></a>Whenever <span class="sc">gdb</span> is waiting for the remote program, if you type the
interrupt character (often <kbd>Ctrl-c</kbd>), <span class="sc">gdb</span> attempts to stop the
program. This may or may not succeed, depending in part on the hardware
and the serial drivers the remote system uses. If you type the
interrupt character once again, <span class="sc">gdb</span> displays this prompt:
<pre class="smallexample"> Interrupted while waiting for the program.
Give up (and stop debugging it)? (y or n)
</pre>
<p>If you type <kbd>y</kbd>, <span class="sc">gdb</span> abandons the remote debugging session.
(If you decide you want to try again later, you can use &lsquo;<samp><span class="samp">target
remote</span></samp>&rsquo; again to connect once more.) If you type <kbd>n</kbd>, <span class="sc">gdb</span>
goes back to waiting.
<a name="index-detach-_0028remote_0029-1164"></a>
<dl><dt><code>detach</code><dd>When you have finished debugging the remote program, you can use the
<code>detach</code> command to release it from <span class="sc">gdb</span> control.
Detaching from the target normally resumes its execution, but the results
will depend on your particular remote stub. After the <code>detach</code>
command, <span class="sc">gdb</span> is free to connect to another target.
<p><a name="index-disconnect-1165"></a><br><dt><code>disconnect</code><dd>The <code>disconnect</code> command behaves like <code>detach</code>, except that
the target is generally not resumed. It will wait for <span class="sc">gdb</span>
(this instance or another one) to connect and continue debugging. After
the <code>disconnect</code> command, <span class="sc">gdb</span> is again free to connect to
another target.
<p><a name="index-send-command-to-remote-monitor-1166"></a><a name="index-extend-_0040value_007bGDBN_007d-for-remote-targets-1167"></a><a name="index-add-new-commands-for-external-monitor-1168"></a><a name="index-monitor-1169"></a><br><dt><code>monitor </code><var>cmd</var><dd>This command allows you to send arbitrary commands directly to the
remote monitor. Since <span class="sc">gdb</span> doesn't care about the commands it
sends like this, this command is the way to extend <span class="sc">gdb</span>&mdash;you
can add new commands that only the external monitor will understand
and implement.
</dl>
</body></html>

View file

@ -0,0 +1,79 @@
<html lang="en">
<head>
<title>Console I/O - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="File_002dI_002fO-Remote-Protocol-Extension.html#File_002dI_002fO-Remote-Protocol-Extension" title="File-I/O Remote Protocol Extension">
<link rel="prev" href="The-Ctrl_002dC-Message.html#The-Ctrl_002dC-Message" title="The Ctrl-C Message">
<link rel="next" href="List-of-Supported-Calls.html#List-of-Supported-Calls" title="List of Supported Calls">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Console-I%2fO"></a>
<a name="Console-I_002fO"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="List-of-Supported-Calls.html#List-of-Supported-Calls">List of Supported Calls</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="The-Ctrl_002dC-Message.html#The-Ctrl_002dC-Message">The Ctrl-C Message</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="File_002dI_002fO-Remote-Protocol-Extension.html#File_002dI_002fO-Remote-Protocol-Extension">File-I/O Remote Protocol Extension</a>
<hr>
</div>
<h4 class="subsection">E.13.6 Console I/O</h4>
<p><a name="index-console-i_002fo-as-part-of-file_002di_002fo-2799"></a>
By default and if not explicitly closed by the target system, the file
descriptors 0, 1 and 2 are connected to the <span class="sc">gdb</span> console. Output
on the <span class="sc">gdb</span> console is handled as any other file output operation
(<code>write(1, ...)</code> or <code>write(2, ...)</code>). Console input is handled
by <span class="sc">gdb</span> so that after the target read request from file descriptor
0 all following typing is buffered until either one of the following
conditions is met:
<ul>
<li>The user types <kbd>Ctrl-c</kbd>. The behaviour is as explained above, and the
<code>read</code>
system call is treated as finished.
<li>The user presses &lt;RET&gt;. This is treated as end of input with a trailing
newline.
<li>The user types <kbd>Ctrl-d</kbd>. This is treated as end of input. No trailing
character (neither newline nor &lsquo;<samp><span class="samp">Ctrl-D</span></samp>&rsquo;) is appended to the input.
</ul>
<p>If the user has typed more characters than fit in the buffer given to
the <code>read</code> call, the trailing characters are buffered in <span class="sc">gdb</span> until
either another <code>read(0, ...)</code> is requested by the target, or debugging
is stopped at the user's request.
</body></html>

View file

@ -0,0 +1,64 @@
<html lang="en">
<head>
<title>Constants - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="File_002dI_002fO-Remote-Protocol-Extension.html#File_002dI_002fO-Remote-Protocol-Extension" title="File-I/O Remote Protocol Extension">
<link rel="prev" href="Protocol_002dspecific-Representation-of-Datatypes.html#Protocol_002dspecific-Representation-of-Datatypes" title="Protocol-specific Representation of Datatypes">
<link rel="next" href="File_002dI_002fO-Examples.html#File_002dI_002fO-Examples" title="File-I/O Examples">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Constants"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="File_002dI_002fO-Examples.html#File_002dI_002fO-Examples">File-I/O Examples</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Protocol_002dspecific-Representation-of-Datatypes.html#Protocol_002dspecific-Representation-of-Datatypes">Protocol-specific Representation of Datatypes</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="File_002dI_002fO-Remote-Protocol-Extension.html#File_002dI_002fO-Remote-Protocol-Extension">File-I/O Remote Protocol Extension</a>
<hr>
</div>
<h4 class="subsection">E.13.9 Constants</h4>
<p><a name="index-constants_002c-in-file_002di_002fo-protocol-2821"></a>
The following values are used for the constants inside of the
protocol. <span class="sc">gdb</span> and target are responsible for translating these
values before and after the call as needed.
<ul class="menu">
<li><a accesskey="1" href="Open-Flags.html#Open-Flags">Open Flags</a>
<li><a accesskey="2" href="mode_005ft-Values.html#mode_005ft-Values">mode_t Values</a>
<li><a accesskey="3" href="Errno-Values.html#Errno-Values">Errno Values</a>
<li><a accesskey="4" href="Lseek-Flags.html#Lseek-Flags">Lseek Flags</a>
<li><a accesskey="5" href="Limits.html#Limits">Limits</a>
</ul>
</body></html>

View file

@ -0,0 +1,99 @@
<html lang="en">
<head>
<title>Context management - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="GDB_002fMI-General-Design.html#GDB_002fMI-General-Design" title="GDB/MI General Design">
<link rel="next" href="Asynchronous-and-non_002dstop-modes.html#Asynchronous-and-non_002dstop-modes" title="Asynchronous and non-stop modes">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Context-management"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Asynchronous-and-non_002dstop-modes.html#Asynchronous-and-non_002dstop-modes">Asynchronous and non-stop modes</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="GDB_002fMI-General-Design.html#GDB_002fMI-General-Design">GDB/MI General Design</a>
<hr>
</div>
<h4 class="subsection">27.1.1 Context management</h4>
<p>In most cases when <span class="sc">gdb</span> accesses the target, this access is
done in context of a specific thread and frame (see <a href="Frames.html#Frames">Frames</a>).
Often, even when accessing global data, the target requires that a thread
be specified. The CLI interface maintains the selected thread and frame,
and supplies them to target on each command. This is convenient,
because a command line user would not want to specify that information
explicitly on each command, and because user interacts with
<span class="sc">gdb</span> via a single terminal, so no confusion is possible as
to what thread and frame are the current ones.
<p>In the case of MI, the concept of selected thread and frame is less
useful. First, a frontend can easily remember this information
itself. Second, a graphical frontend can have more than one window,
each one used for debugging a different thread, and the frontend might
want to access additional threads for internal purposes. This
increases the risk that by relying on implicitly selected thread, the
frontend may be operating on a wrong one. Therefore, each MI command
should explicitly specify which thread and frame to operate on. To
make it possible, each MI command accepts the &lsquo;<samp><span class="samp">--thread</span></samp>&rsquo; and
&lsquo;<samp><span class="samp">--frame</span></samp>&rsquo; options, the value to each is <span class="sc">gdb</span> identifier
for thread and frame to operate on.
<p>Usually, each top-level window in a frontend allows the user to select
a thread and a frame, and remembers the user selection for further
operations. However, in some cases <span class="sc">gdb</span> may suggest that the
current thread be changed. For example, when stopping on a breakpoint
it is reasonable to switch to the thread where breakpoint is hit. For
another example, if the user issues the CLI &lsquo;<samp><span class="samp">thread</span></samp>&rsquo; command via
the frontend, it is desirable to change the frontend's selected thread to the
one specified by user. <span class="sc">gdb</span> communicates the suggestion to
change current thread using the &lsquo;<samp><span class="samp">=thread-selected</span></samp>&rsquo; notification.
No such notification is available for the selected frame at the moment.
<p>Note that historically, MI shares the selected thread with CLI, so
frontends used the <code>-thread-select</code> to execute commands in the
right context. However, getting this to work right is cumbersome. The
simplest way is for frontend to emit <code>-thread-select</code> command
before every command. This doubles the number of commands that need
to be sent. The alternative approach is to suppress <code>-thread-select</code>
if the selected thread in <span class="sc">gdb</span> is supposed to be identical to the
thread the frontend wants to operate on. However, getting this
optimization right can be tricky. In particular, if the frontend
sends several commands to <span class="sc">gdb</span>, and one of the commands changes the
selected thread, then the behaviour of subsequent commands will
change. So, a frontend should either wait for response from such
problematic commands, or explicitly add <code>-thread-select</code> for
all subsequent commands. No frontend is known to do this exactly
right, so it is suggested to just always pass the &lsquo;<samp><span class="samp">--thread</span></samp>&rsquo; and
&lsquo;<samp><span class="samp">--frame</span></samp>&rsquo; options.
</body></html>

View file

@ -0,0 +1,249 @@
<html lang="en">
<head>
<title>Continuing and Stepping - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Stopping.html#Stopping" title="Stopping">
<link rel="prev" href="Breakpoints.html#Breakpoints" title="Breakpoints">
<link rel="next" href="Skipping-Over-Functions-and-Files.html#Skipping-Over-Functions-and-Files" title="Skipping Over Functions and Files">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Continuing-and-Stepping"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Skipping-Over-Functions-and-Files.html#Skipping-Over-Functions-and-Files">Skipping Over Functions and Files</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Breakpoints.html#Breakpoints">Breakpoints</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Stopping.html#Stopping">Stopping</a>
<hr>
</div>
<h3 class="section">5.2 Continuing and Stepping</h3>
<p><a name="index-stepping-303"></a><a name="index-continuing-304"></a><a name="index-resuming-execution-305"></a><dfn>Continuing</dfn> means resuming program execution until your program
completes normally. In contrast, <dfn>stepping</dfn> means executing just
one more &ldquo;step&rdquo; of your program, where &ldquo;step&rdquo; may mean either one
line of source code, or one machine instruction (depending on what
particular command you use). Either when continuing or when stepping,
your program may stop even sooner, due to a breakpoint or a signal. (If
it stops due to a signal, you may want to use <code>handle</code>, or use
&lsquo;<samp><span class="samp">signal 0</span></samp>&rsquo; to resume execution. See <a href="Signals.html#Signals">Signals</a>.)
<a name="index-continue-306"></a>
<a name="index-c-_0040r_007b_0028_0040code_007bcontinue_007d_0029_007d-307"></a>
<a name="index-fg-_0040r_007b_0028resume-foreground-execution_0029_007d-308"></a>
<dl><dt><code>continue </code><span class="roman">[</span><var>ignore-count</var><span class="roman">]</span><dt><code>c </code><span class="roman">[</span><var>ignore-count</var><span class="roman">]</span><dt><code>fg </code><span class="roman">[</span><var>ignore-count</var><span class="roman">]</span><dd>Resume program execution, at the address where your program last stopped;
any breakpoints set at that address are bypassed. The optional argument
<var>ignore-count</var> allows you to specify a further number of times to
ignore a breakpoint at this location; its effect is like that of
<code>ignore</code> (see <a href="Conditions.html#Conditions">Break Conditions</a>).
<p>The argument <var>ignore-count</var> is meaningful only when your program
stopped due to a breakpoint. At other times, the argument to
<code>continue</code> is ignored.
<p>The synonyms <code>c</code> and <code>fg</code> (for <dfn>foreground</dfn>, as the
debugged program is deemed to be the foreground program) are provided
purely for convenience, and have exactly the same behavior as
<code>continue</code>.
</dl>
<p>To resume execution at a different place, you can use <code>return</code>
(see <a href="Returning.html#Returning">Returning from a Function</a>) to go back to the
calling function; or <code>jump</code> (see <a href="Jumping.html#Jumping">Continuing at a Different Address</a>) to go to an arbitrary location in your program.
<p>A typical technique for using stepping is to set a breakpoint
(see <a href="Breakpoints.html#Breakpoints">Breakpoints; Watchpoints; and Catchpoints</a>) at the
beginning of the function or the section of your program where a problem
is believed to lie, run your program until it stops at that breakpoint,
and then step through the suspect area, examining the variables that are
interesting, until you see the problem happen.
<a name="index-step-309"></a>
<a name="index-s-_0040r_007b_0028_0040code_007bstep_007d_0029_007d-310"></a>
<dl><dt><code>step</code><dd>Continue running your program until control reaches a different source
line, then stop it and return control to <span class="sc">gdb</span>. This command is
abbreviated <code>s</code>.
<blockquote>
<!-- "without debugging information" is imprecise; actually "without line -->
<!-- numbers in the debugging information". (gcc -g1 has debugging info but -->
<!-- not line numbers). But it seems complex to try to make that -->
<!-- distinction here. -->
<em>Warning:</em> If you use the <code>step</code> command while control is
within a function that was compiled without debugging information,
execution proceeds until control reaches a function that does have
debugging information. Likewise, it will not step into a function which
is compiled without debugging information. To step through functions
without debugging information, use the <code>stepi</code> command, described
below.
</blockquote>
<p>The <code>step</code> command only stops at the first instruction of a source
line. This prevents the multiple stops that could otherwise occur in
<code>switch</code> statements, <code>for</code> loops, etc. <code>step</code> continues
to stop if a function that has debugging information is called within
the line. In other words, <code>step</code> <em>steps inside</em> any functions
called within the line.
<p>Also, the <code>step</code> command only enters a function if there is line
number information for the function. Otherwise it acts like the
<code>next</code> command. This avoids problems when using <code>cc -gl</code>
on <acronym>MIPS</acronym> machines. Previously, <code>step</code> entered subroutines if there
was any debugging information about the routine.
<br><dt><code>step </code><var>count</var><dd>Continue running as in <code>step</code>, but do so <var>count</var> times. If a
breakpoint is reached, or a signal not related to stepping occurs before
<var>count</var> steps, stepping stops right away.
<p><a name="index-next-311"></a><a name="index-n-_0040r_007b_0028_0040code_007bnext_007d_0029_007d-312"></a><br><dt><code>next </code><span class="roman">[</span><var>count</var><span class="roman">]</span><dd>Continue to the next source line in the current (innermost) stack frame.
This is similar to <code>step</code>, but function calls that appear within
the line of code are executed without stopping. Execution stops when
control reaches a different line of code at the original stack level
that was executing when you gave the <code>next</code> command. This command
is abbreviated <code>n</code>.
<p>An argument <var>count</var> is a repeat count, as for <code>step</code>.
<!-- FIX ME!! Do we delete this, or is there a way it fits in with -->
<!-- the following paragraph? - Vctoria -->
<!-- @code{next} within a function that lacks debugging information acts like -->
<!-- @code{step}, but any function calls appearing within the code of the -->
<!-- function are executed without stopping. -->
<p>The <code>next</code> command only stops at the first instruction of a
source line. This prevents multiple stops that could otherwise occur in
<code>switch</code> statements, <code>for</code> loops, etc.
<p><a name="index-set-step_002dmode-313"></a><br><dt><code>set step-mode</code><dd><a name="index-functions-without-line-info_002c-and-stepping-314"></a><a name="index-stepping-into-functions-with-no-line-info-315"></a><dt><code>set step-mode on</code><dd>The <code>set step-mode on</code> command causes the <code>step</code> command to
stop at the first instruction of a function which contains no debug line
information rather than stepping over it.
<p>This is useful in cases where you may be interested in inspecting the
machine instructions of a function which has no symbolic info and do not
want <span class="sc">gdb</span> to automatically skip over this function.
<br><dt><code>set step-mode off</code><dd>Causes the <code>step</code> command to step over any functions which contains no
debug information. This is the default.
<br><dt><code>show step-mode</code><dd>Show whether <span class="sc">gdb</span> will stop in or step over functions without
source line debug information.
<p><a name="index-finish-316"></a><a name="index-fin-_0040r_007b_0028_0040code_007bfinish_007d_0029_007d-317"></a><br><dt><code>finish</code><dd>Continue running until just after function in the selected stack frame
returns. Print the returned value (if any). This command can be
abbreviated as <code>fin</code>.
<p>Contrast this with the <code>return</code> command (see <a href="Returning.html#Returning">Returning from a Function</a>).
<p><a name="index-until-318"></a><a name="index-u-_0040r_007b_0028_0040code_007buntil_007d_0029_007d-319"></a><a name="index-run-until-specified-location-320"></a><br><dt><code>until</code><dt><code>u</code><dd>Continue running until a source line past the current line, in the
current stack frame, is reached. This command is used to avoid single
stepping through a loop more than once. It is like the <code>next</code>
command, except that when <code>until</code> encounters a jump, it
automatically continues execution until the program counter is greater
than the address of the jump.
<p>This means that when you reach the end of a loop after single stepping
though it, <code>until</code> makes your program continue execution until it
exits the loop. In contrast, a <code>next</code> command at the end of a loop
simply steps back to the beginning of the loop, which forces you to step
through the next iteration.
<p><code>until</code> always stops your program if it attempts to exit the current
stack frame.
<p><code>until</code> may produce somewhat counterintuitive results if the order
of machine code does not match the order of the source lines. For
example, in the following excerpt from a debugging session, the <code>f</code>
(<code>frame</code>) command shows that execution is stopped at line
<code>206</code>; yet when we use <code>until</code>, we get to line <code>195</code>:
<pre class="smallexample"> (gdb) f
#0 main (argc=4, argv=0xf7fffae8) at m4.c:206
206 expand_input();
(gdb) until
195 for ( ; argc &gt; 0; NEXTARG) {
</pre>
<p>This happened because, for execution efficiency, the compiler had
generated code for the loop closure test at the end, rather than the
start, of the loop&mdash;even though the test in a C <code>for</code>-loop is
written before the body of the loop. The <code>until</code> command appeared
to step back to the beginning of the loop when it advanced to this
expression; however, it has not really gone to an earlier
statement&mdash;not in terms of the actual machine code.
<p><code>until</code> with no argument works by means of single
instruction stepping, and hence is slower than <code>until</code> with an
argument.
<br><dt><code>until </code><var>location</var><dt><code>u </code><var>location</var><dd>Continue running your program until either the specified location is
reached, or the current stack frame returns. <var>location</var> is any of
the forms described in <a href="Specify-Location.html#Specify-Location">Specify Location</a>.
This form of the command uses temporary breakpoints, and
hence is quicker than <code>until</code> without an argument. The specified
location is actually reached only if it is in the current frame. This
implies that <code>until</code> can be used to skip over recursive function
invocations. For instance in the code below, if the current location is
line <code>96</code>, issuing <code>until 99</code> will execute the program up to
line <code>99</code> in the same invocation of factorial, i.e., after the inner
invocations have returned.
<pre class="smallexample"> 94 int factorial (int value)
95 {
96 if (value &gt; 1) {
97 value *= factorial (value - 1);
98 }
99 return (value);
100 }
</pre>
<p><a name="index-advance-_0040var_007blocation_007d-321"></a><br><dt><code>advance </code><var>location</var><dd>Continue running the program up to the given <var>location</var>. An argument is
required, which should be of one of the forms described in
<a href="Specify-Location.html#Specify-Location">Specify Location</a>.
Execution will also stop upon exit from the current stack
frame. This command is similar to <code>until</code>, but <code>advance</code> will
not skip over recursive function calls, and the target location doesn't
have to be in the same frame as the current one.
<p><a name="index-stepi-322"></a><a name="index-si-_0040r_007b_0028_0040code_007bstepi_007d_0029_007d-323"></a><br><dt><code>stepi</code><dt><code>stepi </code><var>arg</var><dt><code>si</code><dd>Execute one machine instruction, then stop and return to the debugger.
<p>It is often useful to do &lsquo;<samp><span class="samp">display/i $pc</span></samp>&rsquo; when stepping by machine
instructions. This makes <span class="sc">gdb</span> automatically display the next
instruction to be executed, each time your program stops. See <a href="Auto-Display.html#Auto-Display">Automatic Display</a>.
<p>An argument is a repeat count, as in <code>step</code>.
<p><a name="index-nexti-324"></a><a name="index-ni-_0040r_007b_0028_0040code_007bnexti_007d_0029_007d-325"></a><br><dt><code>nexti</code><dt><code>nexti </code><var>arg</var><dt><code>ni</code><dd>Execute one machine instruction, but if it is a function call,
proceed until the function returns.
<p>An argument is a repeat count, as in <code>next</code>.
</dl>
</body></html>

View file

@ -0,0 +1,224 @@
<html lang="en">
<head>
<title>Contributors - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Summary.html#Summary" title="Summary">
<link rel="prev" href="Free-Documentation.html#Free-Documentation" title="Free Documentation">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Contributors"></a>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Free-Documentation.html#Free-Documentation">Free Documentation</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Summary.html#Summary">Summary</a>
<hr>
</div>
<h3 class="unnumberedsec">Contributors to <span class="sc">gdb</span></h3>
<p>Richard Stallman was the original author of <span class="sc">gdb</span>, and of many
other <span class="sc">gnu</span> programs. Many others have contributed to its
development. This section attempts to credit major contributors. One
of the virtues of free software is that everyone is free to contribute
to it; with regret, we cannot actually acknowledge everyone here. The
file <samp><span class="file">ChangeLog</span></samp> in the <span class="sc">gdb</span> distribution approximates a
blow-by-blow account.
<p>Changes much prior to version 2.0 are lost in the mists of time.
<blockquote>
<em>Plea:</em> Additions to this section are particularly welcome. If you
or your friends (or enemies, to be evenhanded) have been unfairly
omitted from this list, we would like to add your names!
</blockquote>
<p>So that they may not regard their many labors as thankless, we
particularly thank those who shepherded <span class="sc">gdb</span> through major
releases:
Andrew Cagney (releases 6.3, 6.2, 6.1, 6.0, 5.3, 5.2, 5.1 and 5.0);
Jim Blandy (release 4.18);
Jason Molenda (release 4.17);
Stan Shebs (release 4.14);
Fred Fish (releases 4.16, 4.15, 4.13, 4.12, 4.11, 4.10, and 4.9);
Stu Grossman and John Gilmore (releases 4.8, 4.7, 4.6, 4.5, and 4.4);
John Gilmore (releases 4.3, 4.2, 4.1, 4.0, and 3.9);
Jim Kingdon (releases 3.5, 3.4, and 3.3);
and Randy Smith (releases 3.2, 3.1, and 3.0).
<p>Richard Stallman, assisted at various times by Peter TerMaat, Chris
Hanson, and Richard Mlynarik, handled releases through 2.8.
<p>Michael Tiemann is the author of most of the <span class="sc">gnu</span> C<tt>++</tt> support
in <span class="sc">gdb</span>, with significant additional contributions from Per
Bothner and Daniel Berlin. James Clark wrote the <span class="sc">gnu</span> C<tt>++</tt>
demangler. Early work on C<tt>++</tt> was by Peter TerMaat (who also did
much general update work leading to release 3.0).
<p><span class="sc">gdb</span> uses the BFD subroutine library to examine multiple
object-file formats; BFD was a joint project of David V.
Henkel-Wallace, Rich Pixley, Steve Chamberlain, and John Gilmore.
<p>David Johnson wrote the original COFF support; Pace Willison did
the original support for encapsulated COFF.
<p>Brent Benson of Harris Computer Systems contributed DWARF 2 support.
<p>Adam de Boor and Bradley Davis contributed the ISI Optimum V support.
Per Bothner, Noboyuki Hikichi, and Alessandro Forin contributed MIPS
support.
Jean-Daniel Fekete contributed Sun 386i support.
Chris Hanson improved the HP9000 support.
Noboyuki Hikichi and Tomoyuki Hasei contributed Sony/News OS 3 support.
David Johnson contributed Encore Umax support.
Jyrki Kuoppala contributed Altos 3068 support.
Jeff Law contributed HP PA and SOM support.
Keith Packard contributed NS32K support.
Doug Rabson contributed Acorn Risc Machine support.
Bob Rusk contributed Harris Nighthawk CX-UX support.
Chris Smith contributed Convex support (and Fortran debugging).
Jonathan Stone contributed Pyramid support.
Michael Tiemann contributed SPARC support.
Tim Tucker contributed support for the Gould NP1 and Gould Powernode.
Pace Willison contributed Intel 386 support.
Jay Vosburgh contributed Symmetry support.
Marko Mlinar contributed OpenRISC 1000 support.
<p>Andreas Schwab contributed M68K <span class="sc">gnu</span>/Linux support.
<p>Rich Schaefer and Peter Schauer helped with support of SunOS shared
libraries.
<p>Jay Fenlason and Roland McGrath ensured that <span class="sc">gdb</span> and GAS agree
about several machine instruction sets.
<p>Patrick Duval, Ted Goldstein, Vikram Koka and Glenn Engel helped develop
remote debugging. Intel Corporation, Wind River Systems, AMD, and ARM
contributed remote debugging modules for the i960, VxWorks, A29K UDI,
and RDI targets, respectively.
<p>Brian Fox is the author of the readline libraries providing
command-line editing and command history.
<p>Andrew Beers of SUNY Buffalo wrote the language-switching code, the
Modula-2 support, and contributed the Languages chapter of this manual.
<p>Fred Fish wrote most of the support for Unix System Vr4.
He also enhanced the command-completion support to cover C<tt>++</tt> overloaded
symbols.
<p>Hitachi America (now Renesas America), Ltd. sponsored the support for
H8/300, H8/500, and Super-H processors.
<p>NEC sponsored the support for the v850, Vr4xxx, and Vr5xxx processors.
<p>Mitsubishi (now Renesas) sponsored the support for D10V, D30V, and M32R/D
processors.
<p>Toshiba sponsored the support for the TX39 Mips processor.
<p>Matsushita sponsored the support for the MN10200 and MN10300 processors.
<p>Fujitsu sponsored the support for SPARClite and FR30 processors.
<p>Kung Hsu, Jeff Law, and Rick Sladkey added support for hardware
watchpoints.
<p>Michael Snyder added support for tracepoints.
<p>Stu Grossman wrote gdbserver.
<p>Jim Kingdon, Peter Schauer, Ian Taylor, and Stu Grossman made
nearly innumerable bug fixes and cleanups throughout <span class="sc">gdb</span>.
<p>The following people at the Hewlett-Packard Company contributed
support for the PA-RISC 2.0 architecture, HP-UX 10.20, 10.30, and 11.0
(narrow mode), HP's implementation of kernel threads, HP's aC<tt>++</tt>
compiler, and the Text User Interface (nee Terminal User Interface):
Ben Krepp, Richard Title, John Bishop, Susan Macchia, Kathy Mann,
Satish Pai, India Paul, Steve Rehrauer, and Elena Zannoni. Kim Haase
provided HP-specific information in this manual.
<p>DJ Delorie ported <span class="sc">gdb</span> to MS-DOS, for the DJGPP project.
Robert Hoehne made significant contributions to the DJGPP port.
<p>Cygnus Solutions has sponsored <span class="sc">gdb</span> maintenance and much of its
development since 1991. Cygnus engineers who have worked on <span class="sc">gdb</span>
fulltime include Mark Alexander, Jim Blandy, Per Bothner, Kevin
Buettner, Edith Epstein, Chris Faylor, Fred Fish, Martin Hunt, Jim
Ingham, John Gilmore, Stu Grossman, Kung Hsu, Jim Kingdon, John Metzler,
Fernando Nasser, Geoffrey Noer, Dawn Perchik, Rich Pixley, Zdenek
Radouch, Keith Seitz, Stan Shebs, David Taylor, and Elena Zannoni. In
addition, Dave Brolley, Ian Carmichael, Steve Chamberlain, Nick Clifton,
JT Conklin, Stan Cox, DJ Delorie, Ulrich Drepper, Frank Eigler, Doug
Evans, Sean Fagan, David Henkel-Wallace, Richard Henderson, Jeff
Holcomb, Jeff Law, Jim Lemke, Tom Lord, Bob Manson, Michael Meissner,
Jason Merrill, Catherine Moore, Drew Moseley, Ken Raeburn, Gavin
Romig-Koch, Rob Savoye, Jamie Smith, Mike Stump, Ian Taylor, Angela
Thomas, Michael Tiemann, Tom Tromey, Ron Unrau, Jim Wilson, and David
Zuhn have made contributions both large and small.
<p>Andrew Cagney, Fernando Nasser, and Elena Zannoni, while working for
Cygnus Solutions, implemented the original <span class="sc">gdb/mi</span> interface.
<p>Jim Blandy added support for preprocessor macros, while working for Red
Hat.
<p>Andrew Cagney designed <span class="sc">gdb</span>'s architecture vector. Many
people including Andrew Cagney, Stephane Carrez, Randolph Chung, Nick
Duffek, Richard Henderson, Mark Kettenis, Grace Sainsbury, Kei
Sakamoto, Yoshinori Sato, Michael Snyder, Andreas Schwab, Jason
Thorpe, Corinna Vinschen, Ulrich Weigand, and Elena Zannoni, helped
with the migration of old architectures to this new framework.
<p>Andrew Cagney completely re-designed and re-implemented <span class="sc">gdb</span>'s
unwinder framework, this consisting of a fresh new design featuring
frame IDs, independent frame sniffers, and the sentinel frame. Mark
Kettenis implemented the <span class="sc">dwarf 2</span> unwinder, Jeff Johnston the
libunwind unwinder, and Andrew Cagney the dummy, sentinel, tramp, and
trad unwinders. The architecture-specific changes, each involving a
complete rewrite of the architecture's frame code, were carried out by
Jim Blandy, Joel Brobecker, Kevin Buettner, Andrew Cagney, Stephane
Carrez, Randolph Chung, Orjan Friberg, Richard Henderson, Daniel
Jacobowitz, Jeff Johnston, Mark Kettenis, Theodore A. Roth, Kei
Sakamoto, Yoshinori Sato, Michael Snyder, Corinna Vinschen, and Ulrich
Weigand.
<p>Christian Zankel, Ross Morley, Bob Wilson, and Maxim Grigoriev from
Tensilica, Inc. contributed support for Xtensa processors. Others
who have worked on the Xtensa port of <span class="sc">gdb</span> in the past include
Steve Tjiang, John Newlin, and Scott Foehner.
<p>Michael Eager and staff of Xilinx, Inc., contributed support for the
Xilinx MicroBlaze architecture.
</body></html>

View file

@ -0,0 +1 @@
<meta http-equiv="refresh" content="0; url=In_002dProcess-Agent.html#Control%20Agent">

View file

@ -0,0 +1,68 @@
<html lang="en">
<head>
<title>Controlling GDB - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="Configurations.html#Configurations" title="Configurations">
<link rel="next" href="Extending-GDB.html#Extending-GDB" title="Extending GDB">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Controlling-GDB"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Extending-GDB.html#Extending-GDB">Extending GDB</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Configurations.html#Configurations">Configurations</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>
<h2 class="chapter">22 Controlling <span class="sc">gdb</span></h2>
<p>You can alter the way <span class="sc">gdb</span> interacts with you by using the
<code>set</code> command. For commands controlling how <span class="sc">gdb</span> displays
data, see <a href="Print-Settings.html#Print-Settings">Print Settings</a>. Other settings are
described here.
<ul class="menu">
<li><a accesskey="1" href="Prompt.html#Prompt">Prompt</a>: Prompt
<li><a accesskey="2" href="Editing.html#Editing">Editing</a>: Command editing
<li><a accesskey="3" href="Command-History.html#Command-History">Command History</a>: Command history
<li><a accesskey="4" href="Screen-Size.html#Screen-Size">Screen Size</a>: Screen size
<li><a accesskey="5" href="Numbers.html#Numbers">Numbers</a>: Numbers
<li><a accesskey="6" href="ABI.html#ABI">ABI</a>: Configuring the current ABI
<li><a accesskey="7" href="Auto_002dloading.html#Auto_002dloading">Auto-loading</a>: Automatically loading associated files
<li><a accesskey="8" href="Messages_002fWarnings.html#Messages_002fWarnings">Messages/Warnings</a>: Optional warnings and messages
<li><a accesskey="9" href="Debugging-Output.html#Debugging-Output">Debugging Output</a>: Optional messages about internal happenings
<li><a href="Other-Misc-Settings.html#Other-Misc-Settings">Other Misc Settings</a>: Other Miscellaneous Settings
</ul>
</body></html>

View file

@ -0,0 +1,84 @@
<html lang="en">
<head>
<title>Convenience Funs - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Data.html#Data" title="Data">
<link rel="prev" href="Convenience-Vars.html#Convenience-Vars" title="Convenience Vars">
<link rel="next" href="Registers.html#Registers" title="Registers">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Convenience-Funs"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Registers.html#Registers">Registers</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Convenience-Vars.html#Convenience-Vars">Convenience Vars</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Data.html#Data">Data</a>
<hr>
</div>
<h3 class="section">10.12 Convenience Functions</h3>
<p><a name="index-convenience-functions-639"></a><span class="sc">gdb</span> also supplies some <dfn>convenience functions</dfn>. These
have a syntax similar to convenience variables. A convenience
function can be used in an expression just like an ordinary function;
however, a convenience function is implemented internally to
<span class="sc">gdb</span>.
<p>These functions require <span class="sc">gdb</span> to be configured with
<code>Python</code> support.
<dl>
<dt><code>$_memeq(</code><var>buf1</var><code>, </code><var>buf2</var><code>, </code><var>length</var><code>)</code><dd><a name="index-g_t_0024_005fmemeq_0040r_007b_002c-convenience-function_007d-640"></a>Returns one if the <var>length</var> bytes at the addresses given by
<var>buf1</var> and <var>buf2</var> are equal.
Otherwise it returns zero.
<br><dt><code>$_regex(</code><var>str</var><code>, </code><var>regex</var><code>)</code><dd><a name="index-g_t_0024_005fregex_0040r_007b_002c-convenience-function_007d-641"></a>Returns one if the string <var>str</var> matches the regular expression
<var>regex</var>. Otherwise it returns zero.
The syntax of the regular expression is that specified by <code>Python</code>'s
regular expression support.
<br><dt><code>$_streq(</code><var>str1</var><code>, </code><var>str2</var><code>)</code><dd><a name="index-g_t_0024_005fstreq_0040r_007b_002c-convenience-function_007d-642"></a>Returns one if the strings <var>str1</var> and <var>str2</var> are equal.
Otherwise it returns zero.
<br><dt><code>$_strlen(</code><var>str</var><code>)</code><dd><a name="index-g_t_0024_005fstrlen_0040r_007b_002c-convenience-function_007d-643"></a>Returns the length of string <var>str</var>.
</dl>
<p><span class="sc">gdb</span> provides the ability to list and get help on
convenience functions.
<dl>
<dt><code>help function</code><dd><a name="index-help-function-644"></a><a name="index-show-all-convenience-functions-645"></a>Print a list of all convenience functions.
</dl>
</body></html>

View file

@ -0,0 +1,151 @@
<html lang="en">
<head>
<title>Convenience Vars - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Data.html#Data" title="Data">
<link rel="prev" href="Value-History.html#Value-History" title="Value History">
<link rel="next" href="Convenience-Funs.html#Convenience-Funs" title="Convenience Funs">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Convenience-Vars"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Convenience-Funs.html#Convenience-Funs">Convenience Funs</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Value-History.html#Value-History">Value History</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Data.html#Data">Data</a>
<hr>
</div>
<h3 class="section">10.11 Convenience Variables</h3>
<p><a name="index-convenience-variables-627"></a><a name="index-user_002ddefined-variables-628"></a><span class="sc">gdb</span> provides <dfn>convenience variables</dfn> that you can use within
<span class="sc">gdb</span> to hold on to a value and refer to it later. These variables
exist entirely within <span class="sc">gdb</span>; they are not part of your program, and
setting a convenience variable has no direct effect on further execution
of your program. That is why you can use them freely.
<p>Convenience variables are prefixed with &lsquo;<samp><span class="samp">$</span></samp>&rsquo;. Any name preceded by
&lsquo;<samp><span class="samp">$</span></samp>&rsquo; can be used for a convenience variable, unless it is one of
the predefined machine-specific register names (see <a href="Registers.html#Registers">Registers</a>).
(Value history references, in contrast, are <em>numbers</em> preceded
by &lsquo;<samp><span class="samp">$</span></samp>&rsquo;. See <a href="Value-History.html#Value-History">Value History</a>.)
<p>You can save a value in a convenience variable with an assignment
expression, just as you would set a variable in your program.
For example:
<pre class="smallexample"> set $foo = *object_ptr
</pre>
<p class="noindent">would save in <code>$foo</code> the value contained in the object pointed to by
<code>object_ptr</code>.
<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>Convenience variables have no fixed types. You can assign a convenience
variable any type of value, including structures and arrays, even if
that variable already has a value of a different type. The convenience
variable, when used as an expression, has the type of its current value.
<a name="index-show-convenience-629"></a>
<a name="index-show-all-user-variables-and-functions-630"></a>
<dl><dt><code>show convenience</code><dd>Print a list of convenience variables used so far, and their values,
as well as a list of the convenience functions.
Abbreviated <code>show conv</code>.
<p><a name="index-init_002dif_002dundefined-631"></a><a name="index-convenience-variables_002c-initializing-632"></a><br><dt><code>init-if-undefined $</code><var>variable</var><code> = </code><var>expression</var><dd>Set a convenience variable if it has not already been set. This is useful
for user-defined commands that keep some state. It is similar, in concept,
to using local static variables with initializers in C (except that
convenience variables are global). It can also be used to allow users to
override default values used in a command script.
<p>If the variable is already defined then the expression is not evaluated so
any side-effects do not occur.
</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, to print
a field from successive elements of an array of structures:
<pre class="smallexample"> set $i = 0
print bar[$i++]-&gt;contents
</pre>
<p class="noindent">Repeat that command by typing &lt;RET&gt;.
<p>Some convenience variables are created automatically by <span class="sc">gdb</span> and given
values likely to be useful.
<a name="index-g_t_0024_005f_0040r_007b_002c-convenience-variable_007d-633"></a>
<dl><dt><code>$_</code><dd>The variable <code>$_</code> is automatically set by the <code>x</code> command to
the last address examined (see <a href="Memory.html#Memory">Examining Memory</a>). Other
commands which provide a default address for <code>x</code> to examine also
set <code>$_</code> to that address; these commands include <code>info line</code>
and <code>info breakpoint</code>. The type of <code>$_</code> is <code>void *</code>
except when set by the <code>x</code> command, in which case it is a pointer
to the type of <code>$__</code>.
<p><a name="index-g_t_0024_005f_005f_0040r_007b_002c-convenience-variable_007d-634"></a><br><dt><code>$__</code><dd>The variable <code>$__</code> is automatically set by the <code>x</code> command
to the value found in the last address examined. Its type is chosen
to match the format in which the data was printed.
<br><dt><code>$_exitcode</code><dd><a name="index-g_t_0024_005fexitcode_0040r_007b_002c-convenience-variable_007d-635"></a>The variable <code>$_exitcode</code> is automatically set to the exit code when
the program being debugged terminates.
<br><dt><code>$_probe_argc</code><dt><code>$_probe_arg0...$_probe_arg11</code><dd>Arguments to a static probe. See <a href="Static-Probe-Points.html#Static-Probe-Points">Static Probe Points</a>.
<br><dt><code>$_sdata</code><dd><a name="index-g_t_0024_005fsdata_0040r_007b_002c-inspect_002c-convenience-variable_007d-636"></a>The variable <code>$_sdata</code> contains extra collected static tracepoint
data. See <a href="Tracepoint-Actions.html#Tracepoint-Actions">Tracepoint Action Lists</a>. Note that
<code>$_sdata</code> could be empty, if not inspecting a trace buffer, or
if extra static tracepoint data has not been collected.
<br><dt><code>$_siginfo</code><dd><a name="index-g_t_0024_005fsiginfo_0040r_007b_002c-convenience-variable_007d-637"></a>The variable <code>$_siginfo</code> contains extra signal information
(see <a href="extra-signal-information.html#extra-signal-information">extra signal information</a>). Note that <code>$_siginfo</code>
could be empty, if the application has not yet received any signals.
For example, it will be empty before you execute the <code>run</code> command.
<br><dt><code>$_tlb</code><dd><a name="index-g_t_0024_005ftlb_0040r_007b_002c-convenience-variable_007d-638"></a>The variable <code>$_tlb</code> is automatically set when debugging
applications running on MS-Windows in native mode or connected to
gdbserver that supports the <code>qGetTIBAddr</code> request.
See <a href="General-Query-Packets.html#General-Query-Packets">General Query Packets</a>.
This variable contains the address of the thread information block.
</dl>
<p>On HP-UX systems, if you refer to a function or variable name that
begins with a dollar sign, <span class="sc">gdb</span> searches for a user or system
name first, before it searches for a convenience variable.
</body></html>

Some files were not shown because too many files have changed in this diff Show more