1<html lang="en"> 2<head> 3<title>Breakpoints In Python - Debugging with GDB</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Debugging with GDB"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Python-API.html#Python-API" title="Python API"> 9<link rel="prev" href="Lazy-Strings-In-Python.html#Lazy-Strings-In-Python" title="Lazy Strings In Python"> 10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11<!-- 12Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 131998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 14Free Software Foundation, Inc. 15 16Permission is granted to copy, distribute and/or modify this document 17under the terms of the GNU Free Documentation License, Version 1.3 or 18any later version published by the Free Software Foundation; with the 19Invariant Sections being ``Free Software'' and ``Free Software Needs 20Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,'' 21and with the Back-Cover Texts as in (a) below. 22 23(a) The FSF's Back-Cover Text is: ``You are free to copy and modify 24this GNU Manual. Buying copies from GNU Press supports the FSF in 25developing GNU and promoting software freedom.''--> 26<meta http-equiv="Content-Style-Type" content="text/css"> 27<style type="text/css"><!-- 28 pre.display { font-family:inherit } 29 pre.format { font-family:inherit } 30 pre.smalldisplay { font-family:inherit; font-size:smaller } 31 pre.smallformat { font-family:inherit; font-size:smaller } 32 pre.smallexample { font-size:smaller } 33 pre.smalllisp { font-size:smaller } 34 span.sc { font-variant:small-caps } 35 span.roman { font-family:serif; font-weight:normal; } 36 span.sansserif { font-family:sans-serif; font-weight:normal; } 37--></style> 38<link rel="stylesheet" type="text/css" href="../cs.css"> 39</head> 40<body> 41<div class="node"> 42<a name="Breakpoints-In-Python"></a> 43<p> 44Previous: <a rel="previous" accesskey="p" href="Lazy-Strings-In-Python.html#Lazy-Strings-In-Python">Lazy Strings In Python</a>, 45Up: <a rel="up" accesskey="u" href="Python-API.html#Python-API">Python API</a> 46<hr> 47</div> 48 49<h5 class="subsubsection">23.2.2.19 Manipulating breakpoints using Python</h5> 50 51<p><a name="index-breakpoints-in-python-1905"></a><a name="index-gdb_002eBreakpoint-1906"></a> 52Python code can manipulate breakpoints via the <code>gdb.Breakpoint</code> 53class. 54 55<div class="defun"> 56— 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> 57<blockquote><p>Create a new breakpoint. <var>spec</var> is a string naming the 58location of the breakpoint, or an expression that defines a 59watchpoint. The contents can be any location recognized by the 60<code>break</code> command, or in the case of a watchpoint, by the <code>watch</code> 61command. The optional <var>type</var> denotes the breakpoint to create 62from the types defined later in this chapter. This argument can be 63either: <code>BP_BREAKPOINT</code> or <code>BP_WATCHPOINT</code>. <var>type</var> 64defaults to <code>BP_BREAKPOINT</code>. The optional <var>wp_class</var> 65argument defines the class of watchpoint to create, if <var>type</var> is 66defined as <code>BP_WATCHPOINT</code>. If a watchpoint class is not 67provided, it is assumed to be a <var>WP_WRITE</var> class. 68</p></blockquote></div> 69 70 <p>The available watchpoint types represented by constants are defined in the 71<code>gdb</code> module: 72 73 74<a name="index-WP_005fREAD-1908"></a> 75<a name="index-gdb_002eWP_005fREAD-1909"></a> 76<dl><dt><code>WP_READ</code><dd>Read only watchpoint. 77 78 <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. 79 80 <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. 81</dl> 82 83<div class="defun"> 84— Method on Breakpoint: <b>is_valid</b><var><a name="index-is_005fvalid-on-Breakpoint-1914"></a></var><br> 85<blockquote><p>Return <code>True</code> if this <code>Breakpoint</code> object is valid, 86<code>False</code> otherwise. A <code>Breakpoint</code> object can become invalid 87if the user deletes the breakpoint. In this case, the object still 88exists, but the underlying breakpoint does not. In the cases of 89watchpoint scope, the watchpoint remains valid even if execution of the 90inferior leaves the scope of that watchpoint. 91</p></blockquote></div> 92 93<div class="defun"> 94— Instance Variable of Breakpoint: <b>enabled</b><var><a name="index-enabled-1915"></a></var><br> 95<blockquote><p>This attribute is <code>True</code> if the breakpoint is enabled, and 96<code>False</code> otherwise. This attribute is writable. 97</p></blockquote></div> 98 99<div class="defun"> 100— Instance Variable of Breakpoint: <b>silent</b><var><a name="index-silent-1916"></a></var><br> 101<blockquote><p>This attribute is <code>True</code> if the breakpoint is silent, and 102<code>False</code> otherwise. This attribute is writable. 103 104 <p>Note that a breakpoint can also be silent if it has commands and the 105first command is <code>silent</code>. This is not reported by the 106<code>silent</code> attribute. 107</p></blockquote></div> 108 109<div class="defun"> 110— Instance Variable of Breakpoint: <b>thread</b><var><a name="index-thread-1917"></a></var><br> 111<blockquote><p>If the breakpoint is thread-specific, this attribute holds the thread 112id. If the breakpoint is not thread-specific, this attribute is 113<code>None</code>. This attribute is writable. 114</p></blockquote></div> 115 116<div class="defun"> 117— Instance Variable of Breakpoint: <b>task</b><var><a name="index-task-1918"></a></var><br> 118<blockquote><p>If the breakpoint is Ada task-specific, this attribute holds the Ada task 119id. If the breakpoint is not task-specific (or the underlying 120language is not Ada), this attribute is <code>None</code>. This attribute 121is writable. 122</p></blockquote></div> 123 124<div class="defun"> 125— Instance Variable of Breakpoint: <b>ignore_count</b><var><a name="index-ignore_005fcount-1919"></a></var><br> 126<blockquote><p>This attribute holds the ignore count for the breakpoint, an integer. 127This attribute is writable. 128</p></blockquote></div> 129 130<div class="defun"> 131— Instance Variable of Breakpoint: <b>number</b><var><a name="index-number-1920"></a></var><br> 132<blockquote><p>This attribute holds the breakpoint's number — the identifier used by 133the user to manipulate the breakpoint. This attribute is not writable. 134</p></blockquote></div> 135 136<div class="defun"> 137— Instance Variable of Breakpoint: <b>type</b><var><a name="index-type-1921"></a></var><br> 138<blockquote><p>This attribute holds the breakpoint's type — the identifier used to 139determine the actual breakpoint type or use-case. This attribute is not 140writable. 141</p></blockquote></div> 142 143 <p>The available types are represented by constants defined in the <code>gdb</code> 144module: 145 146 147<a name="index-BP_005fBREAKPOINT-1922"></a> 148<a name="index-gdb_002eBP_005fBREAKPOINT-1923"></a> 149<dl><dt><code>BP_BREAKPOINT</code><dd>Normal code breakpoint. 150 151 <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. 152 153 <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. 154 155 <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. 156 157 <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. 158</dl> 159 160<div class="defun"> 161— Instance Variable of Breakpoint: <b>hit_count</b><var><a name="index-hit_005fcount-1932"></a></var><br> 162<blockquote><p>This attribute holds the hit count for the breakpoint, an integer. 163This attribute is writable, but currently it can only be set to zero. 164</p></blockquote></div> 165 166<div class="defun"> 167— Instance Variable of Breakpoint: <b>location</b><var><a name="index-location-1933"></a></var><br> 168<blockquote><p>This attribute holds the location of the breakpoint, as specified by 169the user. It is a string. If the breakpoint does not have a location 170(that is, it is a watchpoint) the attribute's value is <code>None</code>. This 171attribute is not writable. 172</p></blockquote></div> 173 174<div class="defun"> 175— Instance Variable of Breakpoint: <b>expression</b><var><a name="index-expression-1934"></a></var><br> 176<blockquote><p>This attribute holds a breakpoint expression, as specified by 177the user. It is a string. If the breakpoint does not have an 178expression (the breakpoint is not a watchpoint) the attribute's value 179is <code>None</code>. This attribute is not writable. 180</p></blockquote></div> 181 182<div class="defun"> 183— Instance Variable of Breakpoint: <b>condition</b><var><a name="index-condition-1935"></a></var><br> 184<blockquote><p>This attribute holds the condition of the breakpoint, as specified by 185the user. It is a string. If there is no condition, this attribute's 186value is <code>None</code>. This attribute is writable. 187</p></blockquote></div> 188 189<div class="defun"> 190— Instance Variable of Breakpoint: <b>commands</b><var><a name="index-commands-1936"></a></var><br> 191<blockquote><p>This attribute holds the commands attached to the breakpoint. If 192there are commands, this attribute's value is a string holding all the 193commands, separated by newlines. If there are no commands, this 194attribute is <code>None</code>. This attribute is not writable. 195</p></blockquote></div> 196 197 </body></html> 198 199