<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <!-- Copyright (C) 1988-2020 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." --> <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>GDB/MI Breakpoint Commands (Debugging with GDB)</title> <meta name="description" content="GDB/MI Breakpoint Commands (Debugging with GDB)"> <meta name="keywords" content="GDB/MI Breakpoint Commands (Debugging with GDB)"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="makeinfo"> <link href="index.html#Top" rel="start" title="Top"> <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index"> <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> <link href="GDB_002fMI.html#GDB_002fMI" rel="up" title="GDB/MI"> <link href="GDB_002fMI-Catchpoint-Commands.html#GDB_002fMI-Catchpoint-Commands" rel="next" title="GDB/MI Catchpoint Commands"> <link href="GDB_002fMI-Command-Description-Format.html#GDB_002fMI-Command-Description-Format" rel="prev" title="GDB/MI Command Description Format"> <style type="text/css"> <!-- a.summary-letter {text-decoration: none} blockquote.indentedblock {margin-right: 0em} blockquote.smallindentedblock {margin-right: 0em; font-size: smaller} blockquote.smallquotation {font-size: smaller} div.display {margin-left: 3.2em} div.example {margin-left: 3.2em} div.lisp {margin-left: 3.2em} div.smalldisplay {margin-left: 3.2em} div.smallexample {margin-left: 3.2em} div.smalllisp {margin-left: 3.2em} kbd {font-style: oblique} pre.display {font-family: inherit} pre.format {font-family: inherit} pre.menu-comment {font-family: serif} pre.menu-preformatted {font-family: serif} pre.smalldisplay {font-family: inherit; font-size: smaller} pre.smallexample {font-size: smaller} pre.smallformat {font-family: inherit; font-size: smaller} pre.smalllisp {font-size: smaller} span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} --> </style> </head> <body lang="en"> <a name="GDB_002fMI-Breakpoint-Commands"></a> <div class="header"> <p> Next: <a href="GDB_002fMI-Catchpoint-Commands.html#GDB_002fMI-Catchpoint-Commands" accesskey="n" rel="next">GDB/MI Catchpoint Commands</a>, Previous: <a href="GDB_002fMI-Command-Description-Format.html#GDB_002fMI-Command-Description-Format" accesskey="p" rel="prev">GDB/MI Command Description Format</a>, Up: <a href="GDB_002fMI.html#GDB_002fMI" accesskey="u" rel="up">GDB/MI</a> [<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> </div> <hr> <a name="GDB_002fMI-Breakpoint-Commands-1"></a> <h3 class="section">27.8 <small>GDB/MI</small> Breakpoint Commands</h3> <a name="index-breakpoint-commands-for-GDB_002fMI"></a> <a name="index-GDB_002fMI_002c-breakpoint-commands"></a> <p>This section documents <small>GDB/MI</small> commands for manipulating breakpoints. </p> <a name="The-_002dbreak_002dafter-Command"></a> <h4 class="subheading">The <code>-break-after</code> Command</h4> <a name="index-_002dbreak_002dafter"></a> <a name="Synopsis-1"></a> <h4 class="subsubheading">Synopsis</h4> <div class="smallexample"> <pre class="smallexample"> -break-after <var>number</var> <var>count</var> </pre></div> <p>The breakpoint number <var>number</var> is not in effect until it has been hit <var>count</var> times. To see how this is reflected in the output of the ‘<samp>-break-list</samp>’ command, see the description of the ‘<samp>-break-list</samp>’ command below. </p> <a name="GDB-Command-1"></a> <h4 class="subsubheading"><small>GDB</small> Command</h4> <p>The corresponding <small>GDB</small> command is ‘<samp>ignore</samp>’. </p> <a name="Example-1"></a> <h4 class="subsubheading">Example</h4> <div class="smallexample"> <pre class="smallexample">(gdb) -break-insert main ^done,bkpt={number="1",type="breakpoint",disp="keep", enabled="y",addr="0x000100d0",func="main",file="hello.c", fullname="/home/foo/hello.c",line="5",thread-groups=["i1"], times="0"} (gdb) -break-after 1 3 ~ ^done (gdb) -break-list ^done,BreakpointTable={nr_rows="1",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c", line="5",thread-groups=["i1"],times="0",ignore="3"}]} (gdb) </pre></div> <a name="The-_002dbreak_002dcommands-Command"></a> <h4 class="subheading">The <code>-break-commands</code> Command</h4> <a name="index-_002dbreak_002dcommands"></a> <a name="Synopsis-2"></a> <h4 class="subsubheading">Synopsis</h4> <div class="smallexample"> <pre class="smallexample"> -break-commands <var>number</var> [ <var>command1</var> ... <var>commandN</var> ] </pre></div> <p>Specifies the CLI commands that should be executed when breakpoint <var>number</var> is hit. The parameters <var>command1</var> to <var>commandN</var> are the commands. If no command is specified, any previously-set commands are cleared. See <a href="Break-Commands.html#Break-Commands">Break Commands</a>. Typical use of this functionality is tracing a program, that is, printing of values of some variables whenever breakpoint is hit and then continuing. </p> <a name="GDB-Command-2"></a> <h4 class="subsubheading"><small>GDB</small> Command</h4> <p>The corresponding <small>GDB</small> command is ‘<samp>commands</samp>’. </p> <a name="Example-2"></a> <h4 class="subsubheading">Example</h4> <div class="smallexample"> <pre class="smallexample">(gdb) -break-insert main ^done,bkpt={number="1",type="breakpoint",disp="keep", enabled="y",addr="0x000100d0",func="main",file="hello.c", fullname="/home/foo/hello.c",line="5",thread-groups=["i1"], times="0"} (gdb) -break-commands 1 "print v" "continue" ^done (gdb) </pre></div> <a name="The-_002dbreak_002dcondition-Command"></a> <h4 class="subheading">The <code>-break-condition</code> Command</h4> <a name="index-_002dbreak_002dcondition"></a> <a name="Synopsis-3"></a> <h4 class="subsubheading">Synopsis</h4> <div class="smallexample"> <pre class="smallexample"> -break-condition <var>number</var> <var>expr</var> </pre></div> <p>Breakpoint <var>number</var> will stop the program only if the condition in <var>expr</var> is true. The condition becomes part of the ‘<samp>-break-list</samp>’ output (see the description of the ‘<samp>-break-list</samp>’ command below). </p> <a name="GDB-Command-3"></a> <h4 class="subsubheading"><small>GDB</small> Command</h4> <p>The corresponding <small>GDB</small> command is ‘<samp>condition</samp>’. </p> <a name="Example-3"></a> <h4 class="subsubheading">Example</h4> <div class="smallexample"> <pre class="smallexample">(gdb) -break-condition 1 1 ^done (gdb) -break-list ^done,BreakpointTable={nr_rows="1",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c", line="5",cond="1",thread-groups=["i1"],times="0",ignore="3"}]} (gdb) </pre></div> <a name="The-_002dbreak_002ddelete-Command"></a> <h4 class="subheading">The <code>-break-delete</code> Command</h4> <a name="index-_002dbreak_002ddelete"></a> <a name="Synopsis-4"></a> <h4 class="subsubheading">Synopsis</h4> <div class="smallexample"> <pre class="smallexample"> -break-delete ( <var>breakpoint</var> )+ </pre></div> <p>Delete the breakpoint(s) whose number(s) are specified in the argument list. This is obviously reflected in the breakpoint list. </p> <a name="GDB-Command-4"></a> <h4 class="subsubheading"><small>GDB</small> Command</h4> <p>The corresponding <small>GDB</small> command is ‘<samp>delete</samp>’. </p> <a name="Example-4"></a> <h4 class="subsubheading">Example</h4> <div class="smallexample"> <pre class="smallexample">(gdb) -break-delete 1 ^done (gdb) -break-list ^done,BreakpointTable={nr_rows="0",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[]} (gdb) </pre></div> <a name="The-_002dbreak_002ddisable-Command"></a> <h4 class="subheading">The <code>-break-disable</code> Command</h4> <a name="index-_002dbreak_002ddisable"></a> <a name="Synopsis-5"></a> <h4 class="subsubheading">Synopsis</h4> <div class="smallexample"> <pre class="smallexample"> -break-disable ( <var>breakpoint</var> )+ </pre></div> <p>Disable the named <var>breakpoint</var>(s). The field ‘<samp>enabled</samp>’ in the break list is now set to ‘<samp>n</samp>’ for the named <var>breakpoint</var>(s). </p> <a name="GDB-Command-5"></a> <h4 class="subsubheading"><small>GDB</small> Command</h4> <p>The corresponding <small>GDB</small> command is ‘<samp>disable</samp>’. </p> <a name="Example-5"></a> <h4 class="subsubheading">Example</h4> <div class="smallexample"> <pre class="smallexample">(gdb) -break-disable 2 ^done (gdb) -break-list ^done,BreakpointTable={nr_rows="1",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="n", addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c", line="5",thread-groups=["i1"],times="0"}]} (gdb) </pre></div> <a name="The-_002dbreak_002denable-Command"></a> <h4 class="subheading">The <code>-break-enable</code> Command</h4> <a name="index-_002dbreak_002denable"></a> <a name="Synopsis-6"></a> <h4 class="subsubheading">Synopsis</h4> <div class="smallexample"> <pre class="smallexample"> -break-enable ( <var>breakpoint</var> )+ </pre></div> <p>Enable (previously disabled) <var>breakpoint</var>(s). </p> <a name="GDB-Command-6"></a> <h4 class="subsubheading"><small>GDB</small> Command</h4> <p>The corresponding <small>GDB</small> command is ‘<samp>enable</samp>’. </p> <a name="Example-6"></a> <h4 class="subsubheading">Example</h4> <div class="smallexample"> <pre class="smallexample">(gdb) -break-enable 2 ^done (gdb) -break-list ^done,BreakpointTable={nr_rows="1",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="y", addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c", line="5",thread-groups=["i1"],times="0"}]} (gdb) </pre></div> <a name="The-_002dbreak_002dinfo-Command"></a> <h4 class="subheading">The <code>-break-info</code> Command</h4> <a name="index-_002dbreak_002dinfo"></a> <a name="Synopsis-7"></a> <h4 class="subsubheading">Synopsis</h4> <div class="smallexample"> <pre class="smallexample"> -break-info <var>breakpoint</var> </pre></div> <p>Get information about a single breakpoint. </p> <p>The result is a table of breakpoints. See <a href="GDB_002fMI-Breakpoint-Information.html#GDB_002fMI-Breakpoint-Information">GDB/MI Breakpoint Information</a>, for details on the format of each breakpoint in the table. </p> <a name="GDB-Command-7"></a> <h4 class="subsubheading"><small>GDB</small> Command</h4> <p>The corresponding <small>GDB</small> command is ‘<samp>info break <var>breakpoint</var></samp>’. </p> <a name="Example-7"></a> <h4 class="subsubheading">Example</h4> <p>N.A. </p> <a name="The-_002dbreak_002dinsert-Command"></a> <h4 class="subheading">The <code>-break-insert</code> Command</h4> <a name="index-_002dbreak_002dinsert"></a> <a name="g_t_002dbreak_002dinsert"></a> <a name="Synopsis-8"></a> <h4 class="subsubheading">Synopsis</h4> <div class="smallexample"> <pre class="smallexample"> -break-insert [ -t ] [ -h ] [ -f ] [ -d ] [ -a ] [ -c <var>condition</var> ] [ -i <var>ignore-count</var> ] [ -p <var>thread-id</var> ] [ <var>location</var> ] </pre></div> <p>If specified, <var>location</var>, can be one of: </p> <dl compact="compact"> <dt><var>linespec location</var></dt> <dd><p>A linespec location. See <a href="Linespec-Locations.html#Linespec-Locations">Linespec Locations</a>. </p> </dd> <dt><var>explicit location</var></dt> <dd><p>An explicit location. <small>GDB/MI</small> explicit locations are analogous to the CLI’s explicit locations using the option names listed below. See <a href="Explicit-Locations.html#Explicit-Locations">Explicit Locations</a>. </p> <dl compact="compact"> <dt>‘<samp>--source <var>filename</var></samp>’</dt> <dd><p>The source file name of the location. This option requires the use of either ‘<samp>--function</samp>’ or ‘<samp>--line</samp>’. </p> </dd> <dt>‘<samp>--function <var>function</var></samp>’</dt> <dd><p>The name of a function or method. </p> </dd> <dt>‘<samp>--label <var>label</var></samp>’</dt> <dd><p>The name of a label. </p> </dd> <dt>‘<samp>--line <var>lineoffset</var></samp>’</dt> <dd><p>An absolute or relative line offset from the start of the location. </p></dd> </dl> </dd> <dt><var>address location</var></dt> <dd><p>An address location, *<var>address</var>. See <a href="Address-Locations.html#Address-Locations">Address Locations</a>. </p></dd> </dl> <p>The possible optional parameters of this command are: </p> <dl compact="compact"> <dt>‘<samp>-t</samp>’</dt> <dd><p>Insert a temporary breakpoint. </p></dd> <dt>‘<samp>-h</samp>’</dt> <dd><p>Insert a hardware breakpoint. </p></dd> <dt>‘<samp>-f</samp>’</dt> <dd><p>If <var>location</var> cannot be parsed (for example if it refers to unknown files or functions), create a pending breakpoint. Without this flag, <small>GDB</small> will report an error, and won’t create a breakpoint, if <var>location</var> cannot be parsed. </p></dd> <dt>‘<samp>-d</samp>’</dt> <dd><p>Create a disabled breakpoint. </p></dd> <dt>‘<samp>-a</samp>’</dt> <dd><p>Create a tracepoint. See <a href="Tracepoints.html#Tracepoints">Tracepoints</a>. When this parameter is used together with ‘<samp>-h</samp>’, a fast tracepoint is created. </p></dd> <dt>‘<samp>-c <var>condition</var></samp>’</dt> <dd><p>Make the breakpoint conditional on <var>condition</var>. </p></dd> <dt>‘<samp>-i <var>ignore-count</var></samp>’</dt> <dd><p>Initialize the <var>ignore-count</var>. </p></dd> <dt>‘<samp>-p <var>thread-id</var></samp>’</dt> <dd><p>Restrict the breakpoint to the thread with the specified global <var>thread-id</var>. </p></dd> </dl> <a name="Result-1"></a> <h4 class="subsubheading">Result</h4> <p>See <a href="GDB_002fMI-Breakpoint-Information.html#GDB_002fMI-Breakpoint-Information">GDB/MI Breakpoint Information</a>, for details on the format of the resulting breakpoint. </p> <p>Note: this format is open to change. </p> <a name="GDB-Command-8"></a> <h4 class="subsubheading"><small>GDB</small> Command</h4> <p>The corresponding <small>GDB</small> commands are ‘<samp>break</samp>’, ‘<samp>tbreak</samp>’, ‘<samp>hbreak</samp>’, and ‘<samp>thbreak</samp>’. </p> <a name="Example-8"></a> <h4 class="subsubheading">Example</h4> <div class="smallexample"> <pre class="smallexample">(gdb) -break-insert main ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c", fullname="/home/foo/recursive2.c,line="4",thread-groups=["i1"], times="0"} (gdb) -break-insert -t foo ^done,bkpt={number="2",addr="0x00010774",file="recursive2.c", fullname="/home/foo/recursive2.c,line="11",thread-groups=["i1"], times="0"} (gdb) -break-list ^done,BreakpointTable={nr_rows="2",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", addr="0x0001072c", func="main",file="recursive2.c", fullname="/home/foo/recursive2.c,"line="4",thread-groups=["i1"], times="0"}, bkpt={number="2",type="breakpoint",disp="del",enabled="y", addr="0x00010774",func="foo",file="recursive2.c", fullname="/home/foo/recursive2.c",line="11",thread-groups=["i1"], times="0"}]} (gdb) </pre></div> <a name="The-_002ddprintf_002dinsert-Command"></a> <h4 class="subheading">The <code>-dprintf-insert</code> Command</h4> <a name="index-_002ddprintf_002dinsert"></a> <a name="Synopsis-9"></a> <h4 class="subsubheading">Synopsis</h4> <div class="smallexample"> <pre class="smallexample"> -dprintf-insert [ -t ] [ -f ] [ -d ] [ -c <var>condition</var> ] [ -i <var>ignore-count</var> ] [ -p <var>thread-id</var> ] [ <var>location</var> ] [ <var>format</var> ] [ <var>argument</var> ] </pre></div> <p>If supplied, <var>location</var> may be specified the same way as for the <code>-break-insert</code> command. See <a href="#g_t_002dbreak_002dinsert">-break-insert</a>. </p> <p>The possible optional parameters of this command are: </p> <dl compact="compact"> <dt>‘<samp>-t</samp>’</dt> <dd><p>Insert a temporary breakpoint. </p></dd> <dt>‘<samp>-f</samp>’</dt> <dd><p>If <var>location</var> cannot be parsed (for example, if it refers to unknown files or functions), create a pending breakpoint. Without this flag, <small>GDB</small> will report an error, and won’t create a breakpoint, if <var>location</var> cannot be parsed. </p></dd> <dt>‘<samp>-d</samp>’</dt> <dd><p>Create a disabled breakpoint. </p></dd> <dt>‘<samp>-c <var>condition</var></samp>’</dt> <dd><p>Make the breakpoint conditional on <var>condition</var>. </p></dd> <dt>‘<samp>-i <var>ignore-count</var></samp>’</dt> <dd><p>Set the ignore count of the breakpoint (see <a href="Conditions.html#Conditions">ignore count</a>) to <var>ignore-count</var>. </p></dd> <dt>‘<samp>-p <var>thread-id</var></samp>’</dt> <dd><p>Restrict the breakpoint to the thread with the specified global <var>thread-id</var>. </p></dd> </dl> <a name="Result-2"></a> <h4 class="subsubheading">Result</h4> <p>See <a href="GDB_002fMI-Breakpoint-Information.html#GDB_002fMI-Breakpoint-Information">GDB/MI Breakpoint Information</a>, for details on the format of the resulting breakpoint. </p> <a name="GDB-Command-9"></a> <h4 class="subsubheading"><small>GDB</small> Command</h4> <p>The corresponding <small>GDB</small> command is ‘<samp>dprintf</samp>’. </p> <a name="Example-9"></a> <h4 class="subsubheading">Example</h4> <div class="smallexample"> <pre class="smallexample">(gdb) 4-dprintf-insert foo "At foo entry\n" 4^done,bkpt={number="1",type="dprintf",disp="keep",enabled="y", addr="0x000000000040061b",func="foo",file="mi-dprintf.c", fullname="mi-dprintf.c",line="25",thread-groups=["i1"], times="0",script={"printf \"At foo entry\\n\"","continue"}, original-location="foo"} (gdb) 5-dprintf-insert 26 "arg=%d, g=%d\n" arg g 5^done,bkpt={number="2",type="dprintf",disp="keep",enabled="y", addr="0x000000000040062a",func="foo",file="mi-dprintf.c", fullname="mi-dprintf.c",line="26",thread-groups=["i1"], times="0",script={"printf \"arg=%d, g=%d\\n\", arg, g","continue"}, original-location="mi-dprintf.c:26"} (gdb) </pre></div> <a name="The-_002dbreak_002dlist-Command"></a> <h4 class="subheading">The <code>-break-list</code> Command</h4> <a name="index-_002dbreak_002dlist"></a> <a name="Synopsis-10"></a> <h4 class="subsubheading">Synopsis</h4> <div class="smallexample"> <pre class="smallexample"> -break-list </pre></div> <p>Displays the list of inserted breakpoints, showing the following fields: </p> <dl compact="compact"> <dt>‘<samp>Number</samp>’</dt> <dd><p>number of the breakpoint </p></dd> <dt>‘<samp>Type</samp>’</dt> <dd><p>type of the breakpoint: ‘<samp>breakpoint</samp>’ or ‘<samp>watchpoint</samp>’ </p></dd> <dt>‘<samp>Disposition</samp>’</dt> <dd><p>should the breakpoint be deleted or disabled when it is hit: ‘<samp>keep</samp>’ or ‘<samp>nokeep</samp>’ </p></dd> <dt>‘<samp>Enabled</samp>’</dt> <dd><p>is the breakpoint enabled or no: ‘<samp>y</samp>’ or ‘<samp>n</samp>’ </p></dd> <dt>‘<samp>Address</samp>’</dt> <dd><p>memory location at which the breakpoint is set </p></dd> <dt>‘<samp>What</samp>’</dt> <dd><p>logical location of the breakpoint, expressed by function name, file name, line number </p></dd> <dt>‘<samp>Thread-groups</samp>’</dt> <dd><p>list of thread groups to which this breakpoint applies </p></dd> <dt>‘<samp>Times</samp>’</dt> <dd><p>number of times the breakpoint has been hit </p></dd> </dl> <p>If there are no breakpoints or watchpoints, the <code>BreakpointTable</code> <code>body</code> field is an empty list. </p> <a name="GDB-Command-10"></a> <h4 class="subsubheading"><small>GDB</small> Command</h4> <p>The corresponding <small>GDB</small> command is ‘<samp>info break</samp>’. </p> <a name="Example-10"></a> <h4 class="subsubheading">Example</h4> <div class="smallexample"> <pre class="smallexample">(gdb) -break-list ^done,BreakpointTable={nr_rows="2",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", addr="0x000100d0",func="main",file="hello.c",line="5",thread-groups=["i1"], times="0"}, bkpt={number="2",type="breakpoint",disp="keep",enabled="y", addr="0x00010114",func="foo",file="hello.c",fullname="/home/foo/hello.c", line="13",thread-groups=["i1"],times="0"}]} (gdb) </pre></div> <p>Here’s an example of the result when there are no breakpoints: </p> <div class="smallexample"> <pre class="smallexample">(gdb) -break-list ^done,BreakpointTable={nr_rows="0",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[]} (gdb) </pre></div> <a name="The-_002dbreak_002dpasscount-Command"></a> <h4 class="subheading">The <code>-break-passcount</code> Command</h4> <a name="index-_002dbreak_002dpasscount"></a> <a name="Synopsis-11"></a> <h4 class="subsubheading">Synopsis</h4> <div class="smallexample"> <pre class="smallexample"> -break-passcount <var>tracepoint-number</var> <var>passcount</var> </pre></div> <p>Set the passcount for tracepoint <var>tracepoint-number</var> to <var>passcount</var>. If the breakpoint referred to by <var>tracepoint-number</var> is not a tracepoint, error is emitted. This corresponds to CLI command ‘<samp>passcount</samp>’. </p> <a name="The-_002dbreak_002dwatch-Command"></a> <h4 class="subheading">The <code>-break-watch</code> Command</h4> <a name="index-_002dbreak_002dwatch"></a> <a name="Synopsis-12"></a> <h4 class="subsubheading">Synopsis</h4> <div class="smallexample"> <pre class="smallexample"> -break-watch [ -a | -r ] </pre></div> <p>Create a watchpoint. With the ‘<samp>-a</samp>’ option it will create an <em>access</em> watchpoint, i.e., a watchpoint that triggers either on a read from or on a write to the memory location. With the ‘<samp>-r</samp>’ option, the watchpoint created is a <em>read</em> watchpoint, i.e., it will trigger only when the memory location is accessed for reading. Without either of the options, the watchpoint created is a regular watchpoint, i.e., it will trigger when the memory location is accessed for writing. See <a href="Set-Watchpoints.html#Set-Watchpoints">Setting Watchpoints</a>. </p> <p>Note that ‘<samp>-break-list</samp>’ will report a single list of watchpoints and breakpoints inserted. </p> <a name="GDB-Command-11"></a> <h4 class="subsubheading"><small>GDB</small> Command</h4> <p>The corresponding <small>GDB</small> commands are ‘<samp>watch</samp>’, ‘<samp>awatch</samp>’, and ‘<samp>rwatch</samp>’. </p> <a name="Example-11"></a> <h4 class="subsubheading">Example</h4> <p>Setting a watchpoint on a variable in the <code>main</code> function: </p> <div class="smallexample"> <pre class="smallexample">(gdb) -break-watch x ^done,wpt={number="2",exp="x"} (gdb) -exec-continue ^running (gdb) *stopped,reason="watchpoint-trigger",wpt={number="2",exp="x"}, value={old="-268439212",new="55"}, frame={func="main",args=[],file="recursive2.c", fullname="/home/foo/bar/recursive2.c",line="5",arch="i386:x86_64"} (gdb) </pre></div> <p>Setting a watchpoint on a variable local to a function. <small>GDB</small> will stop the program execution twice: first for the variable changing value, then for the watchpoint going out of scope. </p> <div class="smallexample"> <pre class="smallexample">(gdb) -break-watch C ^done,wpt={number="5",exp="C"} (gdb) -exec-continue ^running (gdb) *stopped,reason="watchpoint-trigger", wpt={number="5",exp="C"},value={old="-276895068",new="3"}, frame={func="callee4",args=[], file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13", arch="i386:x86_64"} (gdb) -exec-continue ^running (gdb) *stopped,reason="watchpoint-scope",wpnum="5", frame={func="callee3",args=[{name="strarg", value="0x11940 \"A string argument.\""}], file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18", arch="i386:x86_64"} (gdb) </pre></div> <p>Listing breakpoints and watchpoints, at different points in the program execution. Note that once the watchpoint goes out of scope, it is deleted. </p> <div class="smallexample"> <pre class="smallexample">(gdb) -break-watch C ^done,wpt={number="2",exp="C"} (gdb) -break-list ^done,BreakpointTable={nr_rows="2",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", addr="0x00010734",func="callee4", file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c"line="8",thread-groups=["i1"], times="1"}, bkpt={number="2",type="watchpoint",disp="keep", enabled="y",addr="",what="C",thread-groups=["i1"],times="0"}]} (gdb) -exec-continue ^running (gdb) *stopped,reason="watchpoint-trigger",wpt={number="2",exp="C"}, value={old="-276895068",new="3"}, frame={func="callee4",args=[], file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13", arch="i386:x86_64"} (gdb) -break-list ^done,BreakpointTable={nr_rows="2",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", addr="0x00010734",func="callee4", file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8",thread-groups=["i1"], times="1"}, bkpt={number="2",type="watchpoint",disp="keep", enabled="y",addr="",what="C",thread-groups=["i1"],times="-5"}]} (gdb) -exec-continue ^running ^done,reason="watchpoint-scope",wpnum="2", frame={func="callee3",args=[{name="strarg", value="0x11940 \"A string argument.\""}], file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18", arch="i386:x86_64"} (gdb) -break-list ^done,BreakpointTable={nr_rows="1",nr_cols="6", hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"}, {width="14",alignment="-1",col_name="type",colhdr="Type"}, {width="4",alignment="-1",col_name="disp",colhdr="Disp"}, {width="3",alignment="-1",col_name="enabled",colhdr="Enb"}, {width="10",alignment="-1",col_name="addr",colhdr="Address"}, {width="40",alignment="2",col_name="what",colhdr="What"}], body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y", addr="0x00010734",func="callee4", file="../../../devo/gdb/testsuite/gdb.mi/basics.c", fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8", thread-groups=["i1"],times="1"}]} (gdb) </pre></div> <hr> <div class="header"> <p> Next: <a href="GDB_002fMI-Catchpoint-Commands.html#GDB_002fMI-Catchpoint-Commands" accesskey="n" rel="next">GDB/MI Catchpoint Commands</a>, Previous: <a href="GDB_002fMI-Command-Description-Format.html#GDB_002fMI-Command-Description-Format" accesskey="p" rel="prev">GDB/MI Command Description Format</a>, Up: <a href="GDB_002fMI.html#GDB_002fMI" accesskey="u" rel="up">GDB/MI</a> [<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> </div> </body> </html>