You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

192 lines
8.1KB

  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 6.5, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  16. <title>Observer Mode (Debugging with GDB)</title>
  17. <meta name="description" content="Observer Mode (Debugging with GDB)">
  18. <meta name="keywords" content="Observer Mode (Debugging with GDB)">
  19. <meta name="resource-type" content="document">
  20. <meta name="distribution" content="global">
  21. <meta name="Generator" content="makeinfo">
  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="Reverse-Execution.html#Reverse-Execution" rel="next" title="Reverse Execution">
  27. <link href="Interrupted-System-Calls.html#Interrupted-System-Calls" rel="prev" title="Interrupted System Calls">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.indentedblock {margin-right: 0em}
  32. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  33. blockquote.smallquotation {font-size: smaller}
  34. div.display {margin-left: 3.2em}
  35. div.example {margin-left: 3.2em}
  36. div.lisp {margin-left: 3.2em}
  37. div.smalldisplay {margin-left: 3.2em}
  38. div.smallexample {margin-left: 3.2em}
  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.nolinebreak {white-space: nowrap}
  50. span.roman {font-family: initial; font-weight: normal}
  51. span.sansserif {font-family: sans-serif; font-weight: normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en">
  57. <a name="Observer-Mode"></a>
  58. <div class="header">
  59. <p>
  60. Previous: <a href="Interrupted-System-Calls.html#Interrupted-System-Calls" accesskey="p" rel="prev">Interrupted System Calls</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>
  61. </div>
  62. <hr>
  63. <a name="Observer-Mode-1"></a>
  64. <h4 class="subsection">5.5.6 Observer Mode</h4>
  65. <p>If you want to build on non-stop mode and observe program behavior
  66. without any chance of disruption by <small>GDB</small>, you can set
  67. variables to disable all of the debugger&rsquo;s attempts to modify state,
  68. whether by writing memory, inserting breakpoints, etc. These operate
  69. at a low level, intercepting operations from all commands.
  70. </p>
  71. <p>When all of these are set to <code>off</code>, then <small>GDB</small> is said to
  72. be <em>observer mode</em>. As a convenience, the variable
  73. <code>observer</code> can be set to disable these, plus enable non-stop
  74. mode.
  75. </p>
  76. <p>Note that <small>GDB</small> will not prevent you from making nonsensical
  77. combinations of these settings. For instance, if you have enabled
  78. <code>may-insert-breakpoints</code> but disabled <code>may-write-memory</code>,
  79. then breakpoints that work by writing trap instructions into the code
  80. stream will still not be able to be placed.
  81. </p>
  82. <dl compact="compact">
  83. <dd>
  84. <a name="index-observer"></a>
  85. </dd>
  86. <dt><code>set observer on</code></dt>
  87. <dt><code>set observer off</code></dt>
  88. <dd><p>When set to <code>on</code>, this disables all the permission variables
  89. below (except for <code>insert-fast-tracepoints</code>), plus enables
  90. non-stop debugging. Setting this to <code>off</code> switches back to
  91. normal debugging, though remaining in non-stop mode.
  92. </p>
  93. </dd>
  94. <dt><code>show observer</code></dt>
  95. <dd><p>Show whether observer mode is on or off.
  96. </p>
  97. <a name="index-may_002dwrite_002dregisters"></a>
  98. </dd>
  99. <dt><code>set may-write-registers on</code></dt>
  100. <dt><code>set may-write-registers off</code></dt>
  101. <dd><p>This controls whether <small>GDB</small> will attempt to alter the values of
  102. registers, such as with assignment expressions in <code>print</code>, or the
  103. <code>jump</code> command. It defaults to <code>on</code>.
  104. </p>
  105. </dd>
  106. <dt><code>show may-write-registers</code></dt>
  107. <dd><p>Show the current permission to write registers.
  108. </p>
  109. <a name="index-may_002dwrite_002dmemory"></a>
  110. </dd>
  111. <dt><code>set may-write-memory on</code></dt>
  112. <dt><code>set may-write-memory off</code></dt>
  113. <dd><p>This controls whether <small>GDB</small> will attempt to alter the contents
  114. of memory, such as with assignment expressions in <code>print</code>. It
  115. defaults to <code>on</code>.
  116. </p>
  117. </dd>
  118. <dt><code>show may-write-memory</code></dt>
  119. <dd><p>Show the current permission to write memory.
  120. </p>
  121. <a name="index-may_002dinsert_002dbreakpoints"></a>
  122. </dd>
  123. <dt><code>set may-insert-breakpoints on</code></dt>
  124. <dt><code>set may-insert-breakpoints off</code></dt>
  125. <dd><p>This controls whether <small>GDB</small> will attempt to insert breakpoints.
  126. This affects all breakpoints, including internal breakpoints defined
  127. by <small>GDB</small>. It defaults to <code>on</code>.
  128. </p>
  129. </dd>
  130. <dt><code>show may-insert-breakpoints</code></dt>
  131. <dd><p>Show the current permission to insert breakpoints.
  132. </p>
  133. <a name="index-may_002dinsert_002dtracepoints"></a>
  134. </dd>
  135. <dt><code>set may-insert-tracepoints on</code></dt>
  136. <dt><code>set may-insert-tracepoints off</code></dt>
  137. <dd><p>This controls whether <small>GDB</small> will attempt to insert (regular)
  138. tracepoints at the beginning of a tracing experiment. It affects only
  139. non-fast tracepoints, fast tracepoints being under the control of
  140. <code>may-insert-fast-tracepoints</code>. It defaults to <code>on</code>.
  141. </p>
  142. </dd>
  143. <dt><code>show may-insert-tracepoints</code></dt>
  144. <dd><p>Show the current permission to insert tracepoints.
  145. </p>
  146. <a name="index-may_002dinsert_002dfast_002dtracepoints"></a>
  147. </dd>
  148. <dt><code>set may-insert-fast-tracepoints on</code></dt>
  149. <dt><code>set may-insert-fast-tracepoints off</code></dt>
  150. <dd><p>This controls whether <small>GDB</small> will attempt to insert fast
  151. tracepoints at the beginning of a tracing experiment. It affects only
  152. fast tracepoints, regular (non-fast) tracepoints being under the
  153. control of <code>may-insert-tracepoints</code>. It defaults to <code>on</code>.
  154. </p>
  155. </dd>
  156. <dt><code>show may-insert-fast-tracepoints</code></dt>
  157. <dd><p>Show the current permission to insert fast tracepoints.
  158. </p>
  159. <a name="index-may_002dinterrupt"></a>
  160. </dd>
  161. <dt><code>set may-interrupt on</code></dt>
  162. <dt><code>set may-interrupt off</code></dt>
  163. <dd><p>This controls whether <small>GDB</small> will attempt to interrupt or stop
  164. program execution. When this variable is <code>off</code>, the
  165. <code>interrupt</code> command will have no effect, nor will
  166. <kbd>Ctrl-c</kbd>. It defaults to <code>on</code>.
  167. </p>
  168. </dd>
  169. <dt><code>show may-interrupt</code></dt>
  170. <dd><p>Show the current permission to interrupt or stop the program.
  171. </p>
  172. </dd>
  173. </dl>
  174. <hr>
  175. <div class="header">
  176. <p>
  177. Previous: <a href="Interrupted-System-Calls.html#Interrupted-System-Calls" accesskey="p" rel="prev">Interrupted System Calls</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>
  178. </div>
  179. </body>
  180. </html>