Observer-Mode.html 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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: Observer Mode</title>
  16. <meta name="description" content="Debugging with GDB: Observer Mode">
  17. <meta name="keywords" content="Debugging with GDB: Observer Mode">
  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="Reverse-Execution.html#Reverse-Execution" rel="next" title="Reverse Execution">
  27. <link href="Interrupted-System-Calls.html#Interrupted-System-Calls" rel="previous" title="Interrupted System Calls">
  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="Observer-Mode"></a>
  59. <div class="header">
  60. <p>
  61. Previous: <a href="Interrupted-System-Calls.html#Interrupted-System-Calls" accesskey="p" rel="previous">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>
  62. </div>
  63. <hr>
  64. <a name="Observer-Mode-1"></a>
  65. <h4 class="subsection">5.5.6 Observer Mode</h4>
  66. <p>If you want to build on non-stop mode and observe program behavior
  67. without any chance of disruption by <small>GDB</small>, you can set
  68. variables to disable all of the debugger&rsquo;s attempts to modify state,
  69. whether by writing memory, inserting breakpoints, etc. These operate
  70. at a low level, intercepting operations from all commands.
  71. </p>
  72. <p>When all of these are set to <code>off</code>, then <small>GDB</small> is said to
  73. be <em>observer mode</em>. As a convenience, the variable
  74. <code>observer</code> can be set to disable these, plus enable non-stop
  75. mode.
  76. </p>
  77. <p>Note that <small>GDB</small> will not prevent you from making nonsensical
  78. combinations of these settings. For instance, if you have enabled
  79. <code>may-insert-breakpoints</code> but disabled <code>may-write-memory</code>,
  80. then breakpoints that work by writing trap instructions into the code
  81. stream will still not be able to be placed.
  82. </p>
  83. <dl compact="compact">
  84. <dd>
  85. <a name="index-observer"></a>
  86. </dd>
  87. <dt><code>set observer on</code></dt>
  88. <dt><code>set observer off</code></dt>
  89. <dd><p>When set to <code>on</code>, this disables all the permission variables
  90. below (except for <code>insert-fast-tracepoints</code>), plus enables
  91. non-stop debugging. Setting this to <code>off</code> switches back to
  92. normal debugging, though remaining in non-stop mode.
  93. </p>
  94. </dd>
  95. <dt><code>show observer</code></dt>
  96. <dd><p>Show whether observer mode is on or off.
  97. </p>
  98. <a name="index-may_002dwrite_002dregisters"></a>
  99. </dd>
  100. <dt><code>set may-write-registers on</code></dt>
  101. <dt><code>set may-write-registers off</code></dt>
  102. <dd><p>This controls whether <small>GDB</small> will attempt to alter the values of
  103. registers, such as with assignment expressions in <code>print</code>, or the
  104. <code>jump</code> command. It defaults to <code>on</code>.
  105. </p>
  106. </dd>
  107. <dt><code>show may-write-registers</code></dt>
  108. <dd><p>Show the current permission to write registers.
  109. </p>
  110. <a name="index-may_002dwrite_002dmemory"></a>
  111. </dd>
  112. <dt><code>set may-write-memory on</code></dt>
  113. <dt><code>set may-write-memory off</code></dt>
  114. <dd><p>This controls whether <small>GDB</small> will attempt to alter the contents
  115. of memory, such as with assignment expressions in <code>print</code>. It
  116. defaults to <code>on</code>.
  117. </p>
  118. </dd>
  119. <dt><code>show may-write-memory</code></dt>
  120. <dd><p>Show the current permission to write memory.
  121. </p>
  122. <a name="index-may_002dinsert_002dbreakpoints"></a>
  123. </dd>
  124. <dt><code>set may-insert-breakpoints on</code></dt>
  125. <dt><code>set may-insert-breakpoints off</code></dt>
  126. <dd><p>This controls whether <small>GDB</small> will attempt to insert breakpoints.
  127. This affects all breakpoints, including internal breakpoints defined
  128. by <small>GDB</small>. It defaults to <code>on</code>.
  129. </p>
  130. </dd>
  131. <dt><code>show may-insert-breakpoints</code></dt>
  132. <dd><p>Show the current permission to insert breakpoints.
  133. </p>
  134. <a name="index-may_002dinsert_002dtracepoints"></a>
  135. </dd>
  136. <dt><code>set may-insert-tracepoints on</code></dt>
  137. <dt><code>set may-insert-tracepoints off</code></dt>
  138. <dd><p>This controls whether <small>GDB</small> will attempt to insert (regular)
  139. tracepoints at the beginning of a tracing experiment. It affects only
  140. non-fast tracepoints, fast tracepoints being under the control of
  141. <code>may-insert-fast-tracepoints</code>. It defaults to <code>on</code>.
  142. </p>
  143. </dd>
  144. <dt><code>show may-insert-tracepoints</code></dt>
  145. <dd><p>Show the current permission to insert tracepoints.
  146. </p>
  147. <a name="index-may_002dinsert_002dfast_002dtracepoints"></a>
  148. </dd>
  149. <dt><code>set may-insert-fast-tracepoints on</code></dt>
  150. <dt><code>set may-insert-fast-tracepoints off</code></dt>
  151. <dd><p>This controls whether <small>GDB</small> will attempt to insert fast
  152. tracepoints at the beginning of a tracing experiment. It affects only
  153. fast tracepoints, regular (non-fast) tracepoints being under the
  154. control of <code>may-insert-tracepoints</code>. It defaults to <code>on</code>.
  155. </p>
  156. </dd>
  157. <dt><code>show may-insert-fast-tracepoints</code></dt>
  158. <dd><p>Show the current permission to insert fast tracepoints.
  159. </p>
  160. <a name="index-may_002dinterrupt"></a>
  161. </dd>
  162. <dt><code>set may-interrupt on</code></dt>
  163. <dt><code>set may-interrupt off</code></dt>
  164. <dd><p>This controls whether <small>GDB</small> will attempt to interrupt or stop
  165. program execution. When this variable is <code>off</code>, the
  166. <code>interrupt</code> command will have no effect, nor will
  167. <kbd>Ctrl-c</kbd>. It defaults to <code>on</code>.
  168. </p>
  169. </dd>
  170. <dt><code>show may-interrupt</code></dt>
  171. <dd><p>Show the current permission to interrupt or stop the program.
  172. </p>
  173. </dd>
  174. </dl>
  175. <hr>
  176. <div class="header">
  177. <p>
  178. Previous: <a href="Interrupted-System-Calls.html#Interrupted-System-Calls" accesskey="p" rel="previous">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>
  179. </div>
  180. </body>
  181. </html>