blob: e13b50a2871d98b0e2157d1c13b1346b3360ecae [file] [log] [blame]
<html lang="en">
<head>
<title>Breakpoints In Python - 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="Python-API.html#Python-API" title="Python API">
<link rel="prev" href="Lazy-Strings-In-Python.html#Lazy-Strings-In-Python" title="Lazy Strings In Python">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
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>
<link rel="stylesheet" type="text/css" href="../cs.css">
</head>
<body>
<div class="node">
<a name="Breakpoints-In-Python"></a>
<p>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Lazy-Strings-In-Python.html#Lazy-Strings-In-Python">Lazy Strings In Python</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Python-API.html#Python-API">Python API</a>
<hr>
</div>
<h5 class="subsubsection">23.2.2.19 Manipulating breakpoints using Python</h5>
<p><a name="index-breakpoints-in-python-1905"></a><a name="index-gdb_002eBreakpoint-1906"></a>
Python code can manipulate breakpoints via the <code>gdb.Breakpoint</code>
class.
<div class="defun">
&mdash; Method on Breakpoint: <b>__init__</b><var> spec </var><span class="roman">[</span><var>type</var><span class="roman">]</span> <span class="roman">[</span><var>wp_class</var><span class="roman">]</span><var><a name="index-g_t_005f_005finit_005f_005f-on-Breakpoint-1907"></a></var><br>
<blockquote><p>Create a new breakpoint. <var>spec</var> is a string naming the
location of the breakpoint, or an expression that defines a
watchpoint. The contents can be any location recognized by the
<code>break</code> command, or in the case of a watchpoint, by the <code>watch</code>
command. The optional <var>type</var> denotes the breakpoint to create
from the types defined later in this chapter. This argument can be
either: <code>BP_BREAKPOINT</code> or <code>BP_WATCHPOINT</code>. <var>type</var>
defaults to <code>BP_BREAKPOINT</code>. The optional <var>wp_class</var>
argument defines the class of watchpoint to create, if <var>type</var> is
defined as <code>BP_WATCHPOINT</code>. If a watchpoint class is not
provided, it is assumed to be a <var>WP_WRITE</var> class.
</p></blockquote></div>
<p>The available watchpoint types represented by constants are defined in the
<code>gdb</code> module:
<a name="index-WP_005fREAD-1908"></a>
<a name="index-gdb_002eWP_005fREAD-1909"></a>
<dl><dt><code>WP_READ</code><dd>Read only watchpoint.
<p><a name="index-WP_005fWRITE-1910"></a><a name="index-gdb_002eWP_005fWRITE-1911"></a><br><dt><code>WP_WRITE</code><dd>Write only watchpoint.
<p><a name="index-WP_005fACCESS-1912"></a><a name="index-gdb_002eWP_005fACCESS-1913"></a><br><dt><code>WP_ACCESS</code><dd>Read/Write watchpoint.
</dl>
<div class="defun">
&mdash; Method on Breakpoint: <b>is_valid</b><var><a name="index-is_005fvalid-on-Breakpoint-1914"></a></var><br>
<blockquote><p>Return <code>True</code> if this <code>Breakpoint</code> object is valid,
<code>False</code> otherwise. A <code>Breakpoint</code> object can become invalid
if the user deletes the breakpoint. In this case, the object still
exists, but the underlying breakpoint does not. In the cases of
watchpoint scope, the watchpoint remains valid even if execution of the
inferior leaves the scope of that watchpoint.
</p></blockquote></div>
<div class="defun">
&mdash; Instance Variable of Breakpoint: <b>enabled</b><var><a name="index-enabled-1915"></a></var><br>
<blockquote><p>This attribute is <code>True</code> if the breakpoint is enabled, and
<code>False</code> otherwise. This attribute is writable.
</p></blockquote></div>
<div class="defun">
&mdash; Instance Variable of Breakpoint: <b>silent</b><var><a name="index-silent-1916"></a></var><br>
<blockquote><p>This attribute is <code>True</code> if the breakpoint is silent, and
<code>False</code> otherwise. This attribute is writable.
<p>Note that a breakpoint can also be silent if it has commands and the
first command is <code>silent</code>. This is not reported by the
<code>silent</code> attribute.
</p></blockquote></div>
<div class="defun">
&mdash; Instance Variable of Breakpoint: <b>thread</b><var><a name="index-thread-1917"></a></var><br>
<blockquote><p>If the breakpoint is thread-specific, this attribute holds the thread
id. If the breakpoint is not thread-specific, this attribute is
<code>None</code>. This attribute is writable.
</p></blockquote></div>
<div class="defun">
&mdash; Instance Variable of Breakpoint: <b>task</b><var><a name="index-task-1918"></a></var><br>
<blockquote><p>If the breakpoint is Ada task-specific, this attribute holds the Ada task
id. If the breakpoint is not task-specific (or the underlying
language is not Ada), this attribute is <code>None</code>. This attribute
is writable.
</p></blockquote></div>
<div class="defun">
&mdash; Instance Variable of Breakpoint: <b>ignore_count</b><var><a name="index-ignore_005fcount-1919"></a></var><br>
<blockquote><p>This attribute holds the ignore count for the breakpoint, an integer.
This attribute is writable.
</p></blockquote></div>
<div class="defun">
&mdash; Instance Variable of Breakpoint: <b>number</b><var><a name="index-number-1920"></a></var><br>
<blockquote><p>This attribute holds the breakpoint's number &mdash; the identifier used by
the user to manipulate the breakpoint. This attribute is not writable.
</p></blockquote></div>
<div class="defun">
&mdash; Instance Variable of Breakpoint: <b>type</b><var><a name="index-type-1921"></a></var><br>
<blockquote><p>This attribute holds the breakpoint's type &mdash; the identifier used to
determine the actual breakpoint type or use-case. This attribute is not
writable.
</p></blockquote></div>
<p>The available types are represented by constants defined in the <code>gdb</code>
module:
<a name="index-BP_005fBREAKPOINT-1922"></a>
<a name="index-gdb_002eBP_005fBREAKPOINT-1923"></a>
<dl><dt><code>BP_BREAKPOINT</code><dd>Normal code breakpoint.
<p><a name="index-BP_005fWATCHPOINT-1924"></a><a name="index-gdb_002eBP_005fWATCHPOINT-1925"></a><br><dt><code>BP_WATCHPOINT</code><dd>Watchpoint breakpoint.
<p><a name="index-BP_005fHARDWARE_005fWATCHPOINT-1926"></a><a name="index-gdb_002eBP_005fHARDWARE_005fWATCHPOINT-1927"></a><br><dt><code>BP_HARDWARE_WATCHPOINT</code><dd>Hardware assisted watchpoint.
<p><a name="index-BP_005fREAD_005fWATCHPOINT-1928"></a><a name="index-gdb_002eBP_005fREAD_005fWATCHPOINT-1929"></a><br><dt><code>BP_READ_WATCHPOINT</code><dd>Hardware assisted read watchpoint.
<p><a name="index-BP_005fACCESS_005fWATCHPOINT-1930"></a><a name="index-gdb_002eBP_005fACCESS_005fWATCHPOINT-1931"></a><br><dt><code>BP_ACCESS_WATCHPOINT</code><dd>Hardware assisted access watchpoint.
</dl>
<div class="defun">
&mdash; Instance Variable of Breakpoint: <b>hit_count</b><var><a name="index-hit_005fcount-1932"></a></var><br>
<blockquote><p>This attribute holds the hit count for the breakpoint, an integer.
This attribute is writable, but currently it can only be set to zero.
</p></blockquote></div>
<div class="defun">
&mdash; Instance Variable of Breakpoint: <b>location</b><var><a name="index-location-1933"></a></var><br>
<blockquote><p>This attribute holds the location of the breakpoint, as specified by
the user. It is a string. If the breakpoint does not have a location
(that is, it is a watchpoint) the attribute's value is <code>None</code>. This
attribute is not writable.
</p></blockquote></div>
<div class="defun">
&mdash; Instance Variable of Breakpoint: <b>expression</b><var><a name="index-expression-1934"></a></var><br>
<blockquote><p>This attribute holds a breakpoint expression, as specified by
the user. It is a string. If the breakpoint does not have an
expression (the breakpoint is not a watchpoint) the attribute's value
is <code>None</code>. This attribute is not writable.
</p></blockquote></div>
<div class="defun">
&mdash; Instance Variable of Breakpoint: <b>condition</b><var><a name="index-condition-1935"></a></var><br>
<blockquote><p>This attribute holds the condition of the breakpoint, as specified by
the user. It is a string. If there is no condition, this attribute's
value is <code>None</code>. This attribute is writable.
</p></blockquote></div>
<div class="defun">
&mdash; Instance Variable of Breakpoint: <b>commands</b><var><a name="index-commands-1936"></a></var><br>
<blockquote><p>This attribute holds the commands attached to the breakpoint. If
there are commands, this attribute's value is a string holding all the
commands, separated by newlines. If there are no commands, this
attribute is <code>None</code>. This attribute is not writable.
</p></blockquote></div>
</body></html>