| <html lang="en"> |
| <head> |
| <title>Breakpoints - 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="Stopping.html#Stopping" title="Stopping"> |
| <link rel="next" href="Continuing-and-Stepping.html#Continuing-and-Stepping" title="Continuing and Stepping"> |
| <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| <!-- |
| Copyright (C) 1988-2019 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> |
| </head> |
| <body> |
| <div class="node"> |
| <a name="Breakpoints"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="Continuing-and-Stepping.html#Continuing-and-Stepping">Continuing and Stepping</a>, |
| Up: <a rel="up" accesskey="u" href="Stopping.html#Stopping">Stopping</a> |
| <hr> |
| </div> |
| |
| <h3 class="section">5.1 Breakpoints, Watchpoints, and Catchpoints</h3> |
| |
| <p><a name="index-breakpoints-228"></a>A <dfn>breakpoint</dfn> makes your program stop whenever a certain point in |
| the program is reached. For each breakpoint, you can add conditions to |
| control in finer detail whether your program stops. You can set |
| 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 |
| should stop by line number, function name or exact address in the |
| program. |
| |
| <p>On some systems, you can set breakpoints in shared libraries before |
| the executable is run. |
| |
| <p><a name="index-watchpoints-229"></a><a name="index-data-breakpoints-230"></a><a name="index-memory-tracing-231"></a><a name="index-breakpoint-on-memory-address-232"></a><a name="index-breakpoint-on-variable-modification-233"></a>A <dfn>watchpoint</dfn> is a special breakpoint that stops your program |
| when the value of an expression changes. The expression may be a value |
| of a variable, or it could involve values of one or more variables |
| combined by operators, such as ‘<samp><span class="samp">a + b</span></samp>’. This is sometimes called |
| <dfn>data breakpoints</dfn>. You must use a different command to set |
| watchpoints (see <a href="Set-Watchpoints.html#Set-Watchpoints">Setting Watchpoints</a>), but aside |
| from that, you can manage a watchpoint like any other breakpoint: you |
| enable, disable, and delete both breakpoints and watchpoints using the |
| same commands. |
| |
| <p>You can arrange to have values from your program displayed automatically |
| whenever <span class="sc">gdb</span> stops at a breakpoint. See <a href="Auto-Display.html#Auto-Display">Automatic Display</a>. |
| |
| <p><a name="index-catchpoints-234"></a><a name="index-breakpoint-on-events-235"></a>A <dfn>catchpoint</dfn> is another special breakpoint that stops your program |
| when a certain kind of event occurs, such as the throwing of a C<tt>++</tt> |
| exception or the loading of a library. As with watchpoints, you use a |
| different command to set a catchpoint (see <a href="Set-Catchpoints.html#Set-Catchpoints">Setting Catchpoints</a>), but aside from that, you can manage a catchpoint like any |
| other breakpoint. (To stop when your program receives a signal, use the |
| <code>handle</code> command; see <a href="Signals.html#Signals">Signals</a>.) |
| |
| <p><a name="index-breakpoint-numbers-236"></a><a name="index-numbers-for-breakpoints-237"></a><span class="sc">gdb</span> assigns a number to each breakpoint, watchpoint, or |
| catchpoint when you create it; these numbers are successive integers |
| starting with one. In many of the commands for controlling various |
| features of breakpoints you use the breakpoint number to say which |
| breakpoint you want to change. Each breakpoint may be <dfn>enabled</dfn> or |
| <dfn>disabled</dfn>; if disabled, it has no effect on your program until you |
| enable it again. |
| |
| <p><a name="index-breakpoint-ranges-238"></a><a name="index-breakpoint-lists-239"></a><a name="index-ranges-of-breakpoints-240"></a><a name="index-lists-of-breakpoints-241"></a>Some <span class="sc">gdb</span> commands accept a space-separated list of breakpoints |
| on which to operate. A list element can be either a single breakpoint number, |
| like ‘<samp><span class="samp">5</span></samp>’, or a range of such numbers, like ‘<samp><span class="samp">5-7</span></samp>’. |
| When a breakpoint list is given to a command, all breakpoints in that list |
| are operated on. |
| |
| <ul class="menu"> |
| <li><a accesskey="1" href="Set-Breaks.html#Set-Breaks">Set Breaks</a>: Setting breakpoints |
| <li><a accesskey="2" href="Set-Watchpoints.html#Set-Watchpoints">Set Watchpoints</a>: Setting watchpoints |
| <li><a accesskey="3" href="Set-Catchpoints.html#Set-Catchpoints">Set Catchpoints</a>: Setting catchpoints |
| <li><a accesskey="4" href="Delete-Breaks.html#Delete-Breaks">Delete Breaks</a>: Deleting breakpoints |
| <li><a accesskey="5" href="Disabling.html#Disabling">Disabling</a>: Disabling breakpoints |
| <li><a accesskey="6" href="Conditions.html#Conditions">Conditions</a>: Break conditions |
| <li><a accesskey="7" href="Break-Commands.html#Break-Commands">Break Commands</a>: Breakpoint command lists |
| <li><a accesskey="8" href="Dynamic-Printf.html#Dynamic-Printf">Dynamic Printf</a>: Dynamic printf |
| <li><a accesskey="9" href="Save-Breakpoints.html#Save-Breakpoints">Save Breakpoints</a>: How to save breakpoints in a file |
| <li><a href="Static-Probe-Points.html#Static-Probe-Points">Static Probe Points</a>: Listing static probe points |
| <li><a href="Error-in-Breakpoints.html#Error-in-Breakpoints">Error in Breakpoints</a>: ``Cannot insert breakpoints'' |
| <li><a href="Breakpoint_002drelated-Warnings.html#Breakpoint_002drelated-Warnings">Breakpoint-related Warnings</a>: ``Breakpoint address adjusted...'' |
| </ul> |
| |
| </body></html> |
| |