Background-Execution.html 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Free Software" and "Free Software Needs
  8. Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
  9. and with the Back-Cover Texts as in (a) below.
  10. (a) The FSF's Back-Cover Text is: "You are free to copy and modify
  11. this GNU Manual. Buying copies from GNU Press supports the FSF in
  12. developing GNU and promoting software freedom." -->
  13. <!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <title>Debugging with GDB: Background Execution</title>
  16. <meta name="description" content="Debugging with GDB: Background Execution">
  17. <meta name="keywords" content="Debugging with GDB: Background Execution">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  22. <link href="index.html#Top" rel="start" title="Top">
  23. <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
  24. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  25. <link href="Thread-Stops.html#Thread-Stops" rel="up" title="Thread Stops">
  26. <link href="Thread_002dSpecific-Breakpoints.html#Thread_002dSpecific-Breakpoints" rel="next" title="Thread-Specific Breakpoints">
  27. <link href="Non_002dStop-Mode.html#Non_002dStop-Mode" rel="previous" title="Non-Stop Mode">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.smallquotation {font-size: smaller}
  32. div.display {margin-left: 3.2em}
  33. div.example {margin-left: 3.2em}
  34. div.indentedblock {margin-left: 3.2em}
  35. div.lisp {margin-left: 3.2em}
  36. div.smalldisplay {margin-left: 3.2em}
  37. div.smallexample {margin-left: 3.2em}
  38. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  39. div.smalllisp {margin-left: 3.2em}
  40. kbd {font-style:oblique}
  41. pre.display {font-family: inherit}
  42. pre.format {font-family: inherit}
  43. pre.menu-comment {font-family: serif}
  44. pre.menu-preformatted {font-family: serif}
  45. pre.smalldisplay {font-family: inherit; font-size: smaller}
  46. pre.smallexample {font-size: smaller}
  47. pre.smallformat {font-family: inherit; font-size: smaller}
  48. pre.smalllisp {font-size: smaller}
  49. span.nocodebreak {white-space:nowrap}
  50. span.nolinebreak {white-space:nowrap}
  51. span.roman {font-family:serif; font-weight:normal}
  52. span.sansserif {font-family:sans-serif; font-weight:normal}
  53. ul.no-bullet {list-style: none}
  54. -->
  55. </style>
  56. </head>
  57. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  58. <a name="Background-Execution"></a>
  59. <div class="header">
  60. <p>
  61. Next: <a href="Thread_002dSpecific-Breakpoints.html#Thread_002dSpecific-Breakpoints" accesskey="n" rel="next">Thread-Specific Breakpoints</a>, Previous: <a href="Non_002dStop-Mode.html#Non_002dStop-Mode" accesskey="p" rel="previous">Non-Stop Mode</a>, Up: <a href="Thread-Stops.html#Thread-Stops" accesskey="u" rel="up">Thread Stops</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  62. </div>
  63. <hr>
  64. <a name="Background-Execution-1"></a>
  65. <h4 class="subsection">5.5.3 Background Execution</h4>
  66. <a name="index-foreground-execution"></a>
  67. <a name="index-background-execution"></a>
  68. <a name="index-asynchronous-execution"></a>
  69. <a name="index-execution_002c-foreground_002c-background-and-asynchronous"></a>
  70. <p><small>GDB</small>&rsquo;s execution commands have two variants: the normal
  71. foreground (synchronous) behavior, and a background
  72. (asynchronous) behavior. In foreground execution, <small>GDB</small> waits for
  73. the program to report that some thread has stopped before prompting for
  74. another command. In background execution, <small>GDB</small> immediately gives
  75. a command prompt so that you can issue other commands while your program runs.
  76. </p>
  77. <p>If the target doesn&rsquo;t support async mode, <small>GDB</small> issues an error
  78. message if you attempt to use the background execution commands.
  79. </p>
  80. <a name="index-_0026_002c-background-execution-of-commands"></a>
  81. <p>To specify background execution, add a <code>&amp;</code> to the command. For example,
  82. the background form of the <code>continue</code> command is <code>continue&amp;</code>, or
  83. just <code>c&amp;</code>. The execution commands that accept background execution
  84. are:
  85. </p>
  86. <dl compact="compact">
  87. <dd><a name="index-run_0026"></a>
  88. </dd>
  89. <dt><code>run</code></dt>
  90. <dd><p>See <a href="Starting.html#Starting">Starting your Program</a>.
  91. </p>
  92. </dd>
  93. <dt><code>attach</code></dt>
  94. <dd><a name="index-attach_0026"></a>
  95. <p>See <a href="Attach.html#Attach">Debugging an Already-running Process</a>.
  96. </p>
  97. </dd>
  98. <dt><code>step</code></dt>
  99. <dd><a name="index-step_0026"></a>
  100. <p>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">step</a>.
  101. </p>
  102. </dd>
  103. <dt><code>stepi</code></dt>
  104. <dd><a name="index-stepi_0026"></a>
  105. <p>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">stepi</a>.
  106. </p>
  107. </dd>
  108. <dt><code>next</code></dt>
  109. <dd><a name="index-next_0026"></a>
  110. <p>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">next</a>.
  111. </p>
  112. </dd>
  113. <dt><code>nexti</code></dt>
  114. <dd><a name="index-nexti_0026"></a>
  115. <p>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">nexti</a>.
  116. </p>
  117. </dd>
  118. <dt><code>continue</code></dt>
  119. <dd><a name="index-continue_0026"></a>
  120. <p>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">continue</a>.
  121. </p>
  122. </dd>
  123. <dt><code>finish</code></dt>
  124. <dd><a name="index-finish_0026"></a>
  125. <p>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">finish</a>.
  126. </p>
  127. </dd>
  128. <dt><code>until</code></dt>
  129. <dd><a name="index-until_0026"></a>
  130. <p>See <a href="Continuing-and-Stepping.html#Continuing-and-Stepping">until</a>.
  131. </p>
  132. </dd>
  133. </dl>
  134. <p>Background execution is especially useful in conjunction with non-stop
  135. mode for debugging programs with multiple threads; see <a href="Non_002dStop-Mode.html#Non_002dStop-Mode">Non-Stop Mode</a>.
  136. However, you can also use these commands in the normal all-stop mode with
  137. the restriction that you cannot issue another execution command until the
  138. previous one finishes. Examples of commands that are valid in all-stop
  139. mode while the program is running include <code>help</code> and <code>info break</code>.
  140. </p>
  141. <p>You can interrupt your program while it is running in the background by
  142. using the <code>interrupt</code> command.
  143. </p>
  144. <dl compact="compact">
  145. <dd><a name="index-interrupt-1"></a>
  146. </dd>
  147. <dt><code>interrupt</code></dt>
  148. <dt><code>interrupt -a</code></dt>
  149. <dd>
  150. <p>Suspend execution of the running program. In all-stop mode,
  151. <code>interrupt</code> stops the whole process, but in non-stop mode, it stops
  152. only the current thread. To stop the whole program in non-stop mode,
  153. use <code>interrupt -a</code>.
  154. </p></dd>
  155. </dl>
  156. <hr>
  157. <div class="header">
  158. <p>
  159. Next: <a href="Thread_002dSpecific-Breakpoints.html#Thread_002dSpecific-Breakpoints" accesskey="n" rel="next">Thread-Specific Breakpoints</a>, Previous: <a href="Non_002dStop-Mode.html#Non_002dStop-Mode" accesskey="p" rel="previous">Non-Stop Mode</a>, Up: <a href="Thread-Stops.html#Thread-Stops" accesskey="u" rel="up">Thread Stops</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  160. </div>
  161. </body>
  162. </html>