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.

Breakpoints.html 9.4KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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>Breakpoints (Debugging with GDB)</title>
  17. <meta name="description" content="Breakpoints (Debugging with GDB)">
  18. <meta name="keywords" content="Breakpoints (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="Stopping.html#Stopping" rel="up" title="Stopping">
  26. <link href="Set-Breaks.html#Set-Breaks" rel="next" title="Set Breaks">
  27. <link href="Stopping.html#Stopping" rel="prev" title="Stopping">
  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="Breakpoints"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="Continuing-and-Stepping.html#Continuing-and-Stepping" accesskey="n" rel="next">Continuing and Stepping</a>, Up: <a href="Stopping.html#Stopping" accesskey="u" rel="up">Stopping</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="Breakpoints_002c-Watchpoints_002c-and-Catchpoints"></a>
  64. <h3 class="section">5.1 Breakpoints, Watchpoints, and Catchpoints</h3>
  65. <a name="index-breakpoints"></a>
  66. <p>A <em>breakpoint</em> makes your program stop whenever a certain point in
  67. the program is reached. For each breakpoint, you can add conditions to
  68. control in finer detail whether your program stops. You can set
  69. breakpoints with the <code>break</code> command and its variants (see <a href="Set-Breaks.html#Set-Breaks">Setting Breakpoints</a>), to specify the place where your program
  70. should stop by line number, function name or exact address in the
  71. program.
  72. </p>
  73. <p>On some systems, you can set breakpoints in shared libraries before
  74. the executable is run.
  75. </p>
  76. <a name="index-watchpoints"></a>
  77. <a name="index-data-breakpoints"></a>
  78. <a name="index-memory-tracing"></a>
  79. <a name="index-breakpoint-on-memory-address"></a>
  80. <a name="index-breakpoint-on-variable-modification"></a>
  81. <p>A <em>watchpoint</em> is a special breakpoint that stops your program
  82. when the value of an expression changes. The expression may be a value
  83. of a variable, or it could involve values of one or more variables
  84. combined by operators, such as &lsquo;<samp>a + b</samp>&rsquo;. This is sometimes called
  85. <em>data breakpoints</em>. You must use a different command to set
  86. watchpoints (see <a href="Set-Watchpoints.html#Set-Watchpoints">Setting Watchpoints</a>), but aside
  87. from that, you can manage a watchpoint like any other breakpoint: you
  88. enable, disable, and delete both breakpoints and watchpoints using the
  89. same commands.
  90. </p>
  91. <p>You can arrange to have values from your program displayed automatically
  92. whenever <small>GDB</small> stops at a breakpoint. See <a href="Auto-Display.html#Auto-Display">Automatic Display</a>.
  93. </p>
  94. <a name="index-catchpoints"></a>
  95. <a name="index-breakpoint-on-events"></a>
  96. <p>A <em>catchpoint</em> is another special breakpoint that stops your program
  97. when a certain kind of event occurs, such as the throwing of a C<tt>++</tt>
  98. exception or the loading of a library. As with watchpoints, you use a
  99. different command to set a catchpoint (see <a href="Set-Catchpoints.html#Set-Catchpoints">Setting
  100. Catchpoints</a>), but aside from that, you can manage a catchpoint like any
  101. other breakpoint. (To stop when your program receives a signal, use the
  102. <code>handle</code> command; see <a href="Signals.html#Signals">Signals</a>.)
  103. </p>
  104. <a name="index-breakpoint-numbers"></a>
  105. <a name="index-numbers-for-breakpoints"></a>
  106. <p><small>GDB</small> assigns a number to each breakpoint, watchpoint, or
  107. catchpoint when you create it; these numbers are successive integers
  108. starting with one. In many of the commands for controlling various
  109. features of breakpoints you use the breakpoint number to say which
  110. breakpoint you want to change. Each breakpoint may be <em>enabled</em> or
  111. <em>disabled</em>; if disabled, it has no effect on your program until you
  112. enable it again.
  113. </p>
  114. <a name="index-breakpoint-ranges"></a>
  115. <a name="index-breakpoint-lists"></a>
  116. <a name="index-ranges-of-breakpoints"></a>
  117. <a name="index-lists-of-breakpoints"></a>
  118. <p>Some <small>GDB</small> commands accept a space-separated list of breakpoints
  119. on which to operate. A list element can be either a single breakpoint number,
  120. like &lsquo;<samp>5</samp>&rsquo;, or a range of such numbers, like &lsquo;<samp>5-7</samp>&rsquo;.
  121. When a breakpoint list is given to a command, all breakpoints in that list
  122. are operated on.
  123. </p>
  124. <table class="menu" border="0" cellspacing="0">
  125. <tr><td align="left" valign="top">&bull; <a href="Set-Breaks.html#Set-Breaks" accesskey="1">Set Breaks</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Setting breakpoints
  126. </td></tr>
  127. <tr><td align="left" valign="top">&bull; <a href="Set-Watchpoints.html#Set-Watchpoints" accesskey="2">Set Watchpoints</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Setting watchpoints
  128. </td></tr>
  129. <tr><td align="left" valign="top">&bull; <a href="Set-Catchpoints.html#Set-Catchpoints" accesskey="3">Set Catchpoints</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Setting catchpoints
  130. </td></tr>
  131. <tr><td align="left" valign="top">&bull; <a href="Delete-Breaks.html#Delete-Breaks" accesskey="4">Delete Breaks</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Deleting breakpoints
  132. </td></tr>
  133. <tr><td align="left" valign="top">&bull; <a href="Disabling.html#Disabling" accesskey="5">Disabling</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Disabling breakpoints
  134. </td></tr>
  135. <tr><td align="left" valign="top">&bull; <a href="Conditions.html#Conditions" accesskey="6">Conditions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Break conditions
  136. </td></tr>
  137. <tr><td align="left" valign="top">&bull; <a href="Break-Commands.html#Break-Commands" accesskey="7">Break Commands</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Breakpoint command lists
  138. </td></tr>
  139. <tr><td align="left" valign="top">&bull; <a href="Dynamic-Printf.html#Dynamic-Printf" accesskey="8">Dynamic Printf</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Dynamic printf
  140. </td></tr>
  141. <tr><td align="left" valign="top">&bull; <a href="Save-Breakpoints.html#Save-Breakpoints" accesskey="9">Save Breakpoints</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">How to save breakpoints in a file
  142. </td></tr>
  143. <tr><td align="left" valign="top">&bull; <a href="Static-Probe-Points.html#Static-Probe-Points">Static Probe Points</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Listing static probe points
  144. </td></tr>
  145. <tr><td align="left" valign="top">&bull; <a href="Error-in-Breakpoints.html#Error-in-Breakpoints">Error in Breakpoints</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">&ldquo;Cannot insert breakpoints&rdquo;
  146. </td></tr>
  147. <tr><td align="left" valign="top">&bull; <a href="Breakpoint_002drelated-Warnings.html#Breakpoint_002drelated-Warnings">Breakpoint-related Warnings</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">&ldquo;Breakpoint address adjusted...&rdquo;
  148. </td></tr>
  149. </table>
  150. <hr>
  151. <div class="header">
  152. <p>
  153. Next: <a href="Continuing-and-Stepping.html#Continuing-and-Stepping" accesskey="n" rel="next">Continuing and Stepping</a>, Up: <a href="Stopping.html#Stopping" accesskey="u" rel="up">Stopping</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>
  154. </div>
  155. </body>
  156. </html>