672 lines
31 KiB
HTML
672 lines
31 KiB
HTML
<html lang="en">
|
|
<head>
|
|
<title>GDB/MI Breakpoint Commands - 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="GDB_002fMI.html#GDB_002fMI" title="GDB/MI">
|
|
<link rel="prev" href="GDB_002fMI-Command-Description-Format.html#GDB_002fMI-Command-Description-Format" title="GDB/MI Command Description Format">
|
|
<link rel="next" href="GDB_002fMI-Catchpoint-Commands.html#GDB_002fMI-Catchpoint-Commands" title="GDB/MI Catchpoint Commands">
|
|
<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="GDB%2fMI-Breakpoint-Commands"></a>
|
|
<a name="GDB_002fMI-Breakpoint-Commands"></a>
|
|
<p>
|
|
Next: <a rel="next" accesskey="n" href="GDB_002fMI-Catchpoint-Commands.html#GDB_002fMI-Catchpoint-Commands">GDB/MI Catchpoint Commands</a>,
|
|
Previous: <a rel="previous" accesskey="p" href="GDB_002fMI-Command-Description-Format.html#GDB_002fMI-Command-Description-Format">GDB/MI Command Description Format</a>,
|
|
Up: <a rel="up" accesskey="u" href="GDB_002fMI.html#GDB_002fMI">GDB/MI</a>
|
|
<hr>
|
|
</div>
|
|
|
|
<h3 class="section">27.8 <span class="sc">gdb/mi</span> Breakpoint Commands</h3>
|
|
|
|
<p><a name="index-breakpoint-commands-for-_0040sc_007bgdb_002fmi_007d-2980"></a><a name="index-g_t_0040sc_007bgdb_002fmi_007d_002c-breakpoint-commands-2981"></a>This section documents <span class="sc">gdb/mi</span> commands for manipulating
|
|
breakpoints.
|
|
|
|
<h4 class="subheading">The <code>-break-after</code> Command</h4>
|
|
|
|
<p><a name="index-g_t_002dbreak_002dafter-2982"></a>
|
|
|
|
<h5 class="subsubheading">Synopsis</h5>
|
|
|
|
<pre class="smallexample"> -break-after <var>number</var> <var>count</var>
|
|
</pre>
|
|
<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><span class="samp">-break-list</span></samp>’ command, see the description of the
|
|
‘<samp><span class="samp">-break-list</span></samp>’ command below.
|
|
|
|
<h5 class="subsubheading"><span class="sc">gdb</span> Command</h5>
|
|
|
|
<p>The corresponding <span class="sc">gdb</span> command is ‘<samp><span class="samp">ignore</span></samp>’.
|
|
|
|
<h5 class="subsubheading">Example</h5>
|
|
|
|
<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>
|
|
<h4 class="subheading">The <code>-break-commands</code> Command</h4>
|
|
|
|
<p><a name="index-g_t_002dbreak_002dcommands-2983"></a>
|
|
|
|
<h5 class="subsubheading">Synopsis</h5>
|
|
|
|
<pre class="smallexample"> -break-commands <var>number</var> [ <var>command1</var> ... <var>commandN</var> ]
|
|
</pre>
|
|
<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.
|
|
|
|
<h5 class="subsubheading"><span class="sc">gdb</span> Command</h5>
|
|
|
|
<p>The corresponding <span class="sc">gdb</span> command is ‘<samp><span class="samp">commands</span></samp>’.
|
|
|
|
<h5 class="subsubheading">Example</h5>
|
|
|
|
<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>
|
|
<h4 class="subheading">The <code>-break-condition</code> Command</h4>
|
|
|
|
<p><a name="index-g_t_002dbreak_002dcondition-2984"></a>
|
|
|
|
<h5 class="subsubheading">Synopsis</h5>
|
|
|
|
<pre class="smallexample"> -break-condition <var>number</var> <var>expr</var>
|
|
</pre>
|
|
<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><span class="samp">-break-list</span></samp>’ output (see the description of the ‘<samp><span class="samp">-break-list</span></samp>’
|
|
command below).
|
|
|
|
<h5 class="subsubheading"><span class="sc">gdb</span> Command</h5>
|
|
|
|
<p>The corresponding <span class="sc">gdb</span> command is ‘<samp><span class="samp">condition</span></samp>’.
|
|
|
|
<h5 class="subsubheading">Example</h5>
|
|
|
|
<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>
|
|
<h4 class="subheading">The <code>-break-delete</code> Command</h4>
|
|
|
|
<p><a name="index-g_t_002dbreak_002ddelete-2985"></a>
|
|
|
|
<h5 class="subsubheading">Synopsis</h5>
|
|
|
|
<pre class="smallexample"> -break-delete ( <var>breakpoint</var> )+
|
|
</pre>
|
|
<p>Delete the breakpoint(s) whose number(s) are specified in the argument
|
|
list. This is obviously reflected in the breakpoint list.
|
|
|
|
<h5 class="subsubheading"><span class="sc">gdb</span> Command</h5>
|
|
|
|
<p>The corresponding <span class="sc">gdb</span> command is ‘<samp><span class="samp">delete</span></samp>’.
|
|
|
|
<h5 class="subsubheading">Example</h5>
|
|
|
|
<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>
|
|
<h4 class="subheading">The <code>-break-disable</code> Command</h4>
|
|
|
|
<p><a name="index-g_t_002dbreak_002ddisable-2986"></a>
|
|
|
|
<h5 class="subsubheading">Synopsis</h5>
|
|
|
|
<pre class="smallexample"> -break-disable ( <var>breakpoint</var> )+
|
|
</pre>
|
|
<p>Disable the named <var>breakpoint</var>(s). The field ‘<samp><span class="samp">enabled</span></samp>’ in the
|
|
break list is now set to ‘<samp><span class="samp">n</span></samp>’ for the named <var>breakpoint</var>(s).
|
|
|
|
<h5 class="subsubheading"><span class="sc">gdb</span> Command</h5>
|
|
|
|
<p>The corresponding <span class="sc">gdb</span> command is ‘<samp><span class="samp">disable</span></samp>’.
|
|
|
|
<h5 class="subsubheading">Example</h5>
|
|
|
|
<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>
|
|
<h4 class="subheading">The <code>-break-enable</code> Command</h4>
|
|
|
|
<p><a name="index-g_t_002dbreak_002denable-2987"></a>
|
|
|
|
<h5 class="subsubheading">Synopsis</h5>
|
|
|
|
<pre class="smallexample"> -break-enable ( <var>breakpoint</var> )+
|
|
</pre>
|
|
<p>Enable (previously disabled) <var>breakpoint</var>(s).
|
|
|
|
<h5 class="subsubheading"><span class="sc">gdb</span> Command</h5>
|
|
|
|
<p>The corresponding <span class="sc">gdb</span> command is ‘<samp><span class="samp">enable</span></samp>’.
|
|
|
|
<h5 class="subsubheading">Example</h5>
|
|
|
|
<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>
|
|
<h4 class="subheading">The <code>-break-info</code> Command</h4>
|
|
|
|
<p><a name="index-g_t_002dbreak_002dinfo-2988"></a>
|
|
|
|
<h5 class="subsubheading">Synopsis</h5>
|
|
|
|
<pre class="smallexample"> -break-info <var>breakpoint</var>
|
|
</pre>
|
|
<!-- REDUNDANT??? -->
|
|
<p>Get information about a single breakpoint.
|
|
|
|
<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.
|
|
|
|
<h5 class="subsubheading"><span class="sc">gdb</span> Command</h5>
|
|
|
|
<p>The corresponding <span class="sc">gdb</span> command is ‘<samp><span class="samp">info break </span><var>breakpoint</var></samp>’.
|
|
|
|
<h5 class="subsubheading">Example</h5>
|
|
|
|
<p>N.A.
|
|
|
|
<h4 class="subheading">The <code>-break-insert</code> Command</h4>
|
|
|
|
<p><a name="index-g_t_002dbreak_002dinsert-2989"></a><a name="g_t_002dbreak_002dinsert"></a>
|
|
|
|
<h5 class="subsubheading">Synopsis</h5>
|
|
|
|
<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>
|
|
<p class="noindent">If specified, <var>location</var>, can be one of:
|
|
|
|
<dl>
|
|
<dt><var>linespec location</var><dd>A linespec location. See <a href="Linespec-Locations.html#Linespec-Locations">Linespec Locations</a>.
|
|
|
|
<br><dt><var>explicit location</var><dd>An explicit location. <span class="sc">gdb/mi</span> 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>.
|
|
|
|
<dl>
|
|
<dt>‘<samp><span class="samp">--source </span><var>filename</var></samp>’<dd>The source file name of the location. This option requires the use
|
|
of either ‘<samp><span class="samp">--function</span></samp>’ or ‘<samp><span class="samp">--line</span></samp>’.
|
|
|
|
<br><dt>‘<samp><span class="samp">--function </span><var>function</var></samp>’<dd>The name of a function or method.
|
|
|
|
<br><dt>‘<samp><span class="samp">--label </span><var>label</var></samp>’<dd>The name of a label.
|
|
|
|
<br><dt>‘<samp><span class="samp">--line </span><var>lineoffset</var></samp>’<dd>An absolute or relative line offset from the start of the location.
|
|
</dl>
|
|
|
|
<br><dt><var>address location</var><dd>An address location, *<var>address</var>. See <a href="Address-Locations.html#Address-Locations">Address Locations</a>.
|
|
</dl>
|
|
|
|
<p class="noindent">The possible optional parameters of this command are:
|
|
|
|
<dl>
|
|
<dt>‘<samp><span class="samp">-t</span></samp>’<dd>Insert a temporary breakpoint.
|
|
<br><dt>‘<samp><span class="samp">-h</span></samp>’<dd>Insert a hardware breakpoint.
|
|
<br><dt>‘<samp><span class="samp">-f</span></samp>’<dd>If <var>location</var> cannot be parsed (for example if it
|
|
refers to unknown files or functions), create a pending
|
|
breakpoint. Without this flag, <span class="sc">gdb</span> will report
|
|
an error, and won't create a breakpoint, if <var>location</var>
|
|
cannot be parsed.
|
|
<br><dt>‘<samp><span class="samp">-d</span></samp>’<dd>Create a disabled breakpoint.
|
|
<br><dt>‘<samp><span class="samp">-a</span></samp>’<dd>Create a tracepoint. See <a href="Tracepoints.html#Tracepoints">Tracepoints</a>. When this parameter
|
|
is used together with ‘<samp><span class="samp">-h</span></samp>’, a fast tracepoint is created.
|
|
<br><dt>‘<samp><span class="samp">-c </span><var>condition</var></samp>’<dd>Make the breakpoint conditional on <var>condition</var>.
|
|
<br><dt>‘<samp><span class="samp">-i </span><var>ignore-count</var></samp>’<dd>Initialize the <var>ignore-count</var>.
|
|
<br><dt>‘<samp><span class="samp">-p </span><var>thread-id</var></samp>’<dd>Restrict the breakpoint to the thread with the specified global
|
|
<var>thread-id</var>.
|
|
</dl>
|
|
|
|
<h5 class="subsubheading">Result</h5>
|
|
|
|
<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>Note: this format is open to change.
|
|
<!-- An out-of-band breakpoint instead of part of the result? -->
|
|
|
|
<h5 class="subsubheading"><span class="sc">gdb</span> Command</h5>
|
|
|
|
<p>The corresponding <span class="sc">gdb</span> commands are ‘<samp><span class="samp">break</span></samp>’, ‘<samp><span class="samp">tbreak</span></samp>’,
|
|
‘<samp><span class="samp">hbreak</span></samp>’, and ‘<samp><span class="samp">thbreak</span></samp>’. <!-- and @samp{rbreak}. -->
|
|
|
|
<h5 class="subsubheading">Example</h5>
|
|
|
|
<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)
|
|
<!-- break-insert -r foo.* -->
|
|
<!-- ~int foo(int, int); -->
|
|
<!-- ^done,bkpt=@{number="3",addr="0x00010774",file="recursive2.c, -->
|
|
<!-- "fullname="/home/foo/recursive2.c",line="11",thread-groups=["i1"], -->
|
|
<!-- times="0"@} -->
|
|
<!-- (gdb) -->
|
|
</pre>
|
|
<h4 class="subheading">The <code>-dprintf-insert</code> Command</h4>
|
|
|
|
<p><a name="index-g_t_002ddprintf_002dinsert-2990"></a>
|
|
|
|
<h5 class="subsubheading">Synopsis</h5>
|
|
|
|
<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>
|
|
<p class="noindent">If supplied, <var>location</var> may be specified the same way as for
|
|
the <code>-break-insert</code> command. See <a href="_002dbreak_002dinsert.html#g_t_002dbreak_002dinsert">-break-insert</a>.
|
|
|
|
<p>The possible optional parameters of this command are:
|
|
|
|
<dl>
|
|
<dt>‘<samp><span class="samp">-t</span></samp>’<dd>Insert a temporary breakpoint.
|
|
<br><dt>‘<samp><span class="samp">-f</span></samp>’<dd>If <var>location</var> cannot be parsed (for example, if it
|
|
refers to unknown files or functions), create a pending
|
|
breakpoint. Without this flag, <span class="sc">gdb</span> will report
|
|
an error, and won't create a breakpoint, if <var>location</var>
|
|
cannot be parsed.
|
|
<br><dt>‘<samp><span class="samp">-d</span></samp>’<dd>Create a disabled breakpoint.
|
|
<br><dt>‘<samp><span class="samp">-c </span><var>condition</var></samp>’<dd>Make the breakpoint conditional on <var>condition</var>.
|
|
<br><dt>‘<samp><span class="samp">-i </span><var>ignore-count</var></samp>’<dd>Set the ignore count of the breakpoint (see <a href="Conditions.html#Conditions">ignore count</a>)
|
|
to <var>ignore-count</var>.
|
|
<br><dt>‘<samp><span class="samp">-p </span><var>thread-id</var></samp>’<dd>Restrict the breakpoint to the thread with the specified global
|
|
<var>thread-id</var>.
|
|
</dl>
|
|
|
|
<h5 class="subsubheading">Result</h5>
|
|
|
|
<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.
|
|
|
|
<!-- An out-of-band breakpoint instead of part of the result? -->
|
|
<h5 class="subsubheading"><span class="sc">gdb</span> Command</h5>
|
|
|
|
<p>The corresponding <span class="sc">gdb</span> command is ‘<samp><span class="samp">dprintf</span></samp>’.
|
|
|
|
<h5 class="subsubheading">Example</h5>
|
|
|
|
<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>
|
|
<h4 class="subheading">The <code>-break-list</code> Command</h4>
|
|
|
|
<p><a name="index-g_t_002dbreak_002dlist-2991"></a>
|
|
|
|
<h5 class="subsubheading">Synopsis</h5>
|
|
|
|
<pre class="smallexample"> -break-list
|
|
</pre>
|
|
<p>Displays the list of inserted breakpoints, showing the following fields:
|
|
|
|
<dl>
|
|
<dt>‘<samp><span class="samp">Number</span></samp>’<dd>number of the breakpoint
|
|
<br><dt>‘<samp><span class="samp">Type</span></samp>’<dd>type of the breakpoint: ‘<samp><span class="samp">breakpoint</span></samp>’ or ‘<samp><span class="samp">watchpoint</span></samp>’
|
|
<br><dt>‘<samp><span class="samp">Disposition</span></samp>’<dd>should the breakpoint be deleted or disabled when it is hit: ‘<samp><span class="samp">keep</span></samp>’
|
|
or ‘<samp><span class="samp">nokeep</span></samp>’
|
|
<br><dt>‘<samp><span class="samp">Enabled</span></samp>’<dd>is the breakpoint enabled or no: ‘<samp><span class="samp">y</span></samp>’ or ‘<samp><span class="samp">n</span></samp>’
|
|
<br><dt>‘<samp><span class="samp">Address</span></samp>’<dd>memory location at which the breakpoint is set
|
|
<br><dt>‘<samp><span class="samp">What</span></samp>’<dd>logical location of the breakpoint, expressed by function name, file
|
|
name, line number
|
|
<br><dt>‘<samp><span class="samp">Thread-groups</span></samp>’<dd>list of thread groups to which this breakpoint applies
|
|
<br><dt>‘<samp><span class="samp">Times</span></samp>’<dd>number of times the breakpoint has been hit
|
|
</dl>
|
|
|
|
<p>If there are no breakpoints or watchpoints, the <code>BreakpointTable</code>
|
|
<code>body</code> field is an empty list.
|
|
|
|
<h5 class="subsubheading"><span class="sc">gdb</span> Command</h5>
|
|
|
|
<p>The corresponding <span class="sc">gdb</span> command is ‘<samp><span class="samp">info break</span></samp>’.
|
|
|
|
<h5 class="subsubheading">Example</h5>
|
|
|
|
<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>
|
|
<p>Here's an example of the result when there are no breakpoints:
|
|
|
|
<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>
|
|
<h4 class="subheading">The <code>-break-passcount</code> Command</h4>
|
|
|
|
<p><a name="index-g_t_002dbreak_002dpasscount-2992"></a>
|
|
|
|
<h5 class="subsubheading">Synopsis</h5>
|
|
|
|
<pre class="smallexample"> -break-passcount <var>tracepoint-number</var> <var>passcount</var>
|
|
</pre>
|
|
<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><span class="samp">passcount</span></samp>’.
|
|
|
|
<h4 class="subheading">The <code>-break-watch</code> Command</h4>
|
|
|
|
<p><a name="index-g_t_002dbreak_002dwatch-2993"></a>
|
|
|
|
<h5 class="subsubheading">Synopsis</h5>
|
|
|
|
<pre class="smallexample"> -break-watch [ -a | -r ]
|
|
</pre>
|
|
<p>Create a watchpoint. With the ‘<samp><span class="samp">-a</span></samp>’ option it will create an
|
|
<dfn>access</dfn> watchpoint, i.e., a watchpoint that triggers either on a
|
|
read from or on a write to the memory location. With the ‘<samp><span class="samp">-r</span></samp>’
|
|
option, the watchpoint created is a <dfn>read</dfn> 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>Note that ‘<samp><span class="samp">-break-list</span></samp>’ will report a single list of watchpoints and
|
|
breakpoints inserted.
|
|
|
|
<h5 class="subsubheading"><span class="sc">gdb</span> Command</h5>
|
|
|
|
<p>The corresponding <span class="sc">gdb</span> commands are ‘<samp><span class="samp">watch</span></samp>’, ‘<samp><span class="samp">awatch</span></samp>’, and
|
|
‘<samp><span class="samp">rwatch</span></samp>’.
|
|
|
|
<h5 class="subsubheading">Example</h5>
|
|
|
|
<p>Setting a watchpoint on a variable in the <code>main</code> function:
|
|
|
|
<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>
|
|
<p>Setting a watchpoint on a variable local to a function. <span class="sc">gdb</span> will stop
|
|
the program execution twice: first for the variable changing value, then
|
|
for the watchpoint going out of scope.
|
|
|
|
<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>
|
|
<p>Listing breakpoints and watchpoints, at different points in the program
|
|
execution. Note that once the watchpoint goes out of scope, it is
|
|
deleted.
|
|
|
|
<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>
|
|
<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
|
|
</body></html>
|
|
|