| <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, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, |
| 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 |
| 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> |
| <link rel="stylesheet" type="text/css" href="../cs.css"> |
| </head> |
| <body> |
| <div class="node"> |
| <a name="Background-Execution"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="Thread_002dSpecific-Breakpoints.html#Thread_002dSpecific-Breakpoints">Thread-Specific Breakpoints</a>, |
| Previous: <a rel="previous" accesskey="p" href="Non_002dStop-Mode.html#Non_002dStop-Mode">Non-Stop Mode</a>, |
| Up: <a rel="up" accesskey="u" href="Thread-Stops.html#Thread-Stops">Thread Stops</a> |
| <hr> |
| </div> |
| |
| <h4 class="subsection">5.4.3 Background Execution</h4> |
| |
| <p><a name="index-foreground-execution-329"></a><a name="index-background-execution-330"></a><a name="index-asynchronous-execution-331"></a><a name="index-execution_002c-foreground_002c-background-and-asynchronous-332"></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-333"></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-334"></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>&</code> to the command. For example, |
| the background form of the <code>continue</code> command is <code>continue&</code>, or |
| just <code>c&</code>. The execution commands that accept background execution |
| are: |
| |
| |
| <a name="index-run_0026-335"></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-336"></a>See <a href="Attach.html#Attach">Debugging an Already-running Process</a>. |
| |
| <br><dt><code>step</code><dd><a name="index-step_0026-337"></a>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">step</a>. |
| |
| <br><dt><code>stepi</code><dd><a name="index-stepi_0026-338"></a>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">stepi</a>. |
| |
| <br><dt><code>next</code><dd><a name="index-next_0026-339"></a>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">next</a>. |
| |
| <br><dt><code>nexti</code><dd><a name="index-nexti_0026-340"></a>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">nexti</a>. |
| |
| <br><dt><code>continue</code><dd><a name="index-continue_0026-341"></a>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">continue</a>. |
| |
| <br><dt><code>finish</code><dd><a name="index-finish_0026-342"></a>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">finish</a>. |
| |
| <br><dt><code>until</code><dd><a name="index-until_0026-343"></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-344"></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> |
| |