blob: 7ece9079d6d569aad727831a3f71445fcb81490a [file] [log] [blame]
<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.13">
<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-2019 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">
<a name="Background-Execution"></a>
<p>
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-413"></a><a name="index-background-execution-414"></a><a name="index-asynchronous-execution-415"></a><a name="index-execution_002c-foreground_002c-background-and-asynchronous-416"></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>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><a name="index-g_t_0040code_007b_0026_007d_002c-background-execution-of-commands-417"></a>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-418"></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-419"></a>See <a href="Attach.html#Attach">Debugging an Already-running Process</a>.
<br><dt><code>step</code><dd><a name="index-step_0026-420"></a>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">step</a>.
<br><dt><code>stepi</code><dd><a name="index-stepi_0026-421"></a>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">stepi</a>.
<br><dt><code>next</code><dd><a name="index-next_0026-422"></a>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">next</a>.
<br><dt><code>nexti</code><dd><a name="index-nexti_0026-423"></a>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">nexti</a>.
<br><dt><code>continue</code><dd><a name="index-continue_0026-424"></a>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">continue</a>.
<br><dt><code>finish</code><dd><a name="index-finish_0026-425"></a>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">finish</a>.
<br><dt><code>until</code><dd><a name="index-until_0026-426"></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-427"></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>