101 lines
5.2 KiB
HTML
101 lines
5.2 KiB
HTML
<html lang="en">
|
|
<head>
|
|
<title>Finish 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="Breakpoints-In-Python.html#Breakpoints-In-Python" title="Breakpoints In Python">
|
|
<link rel="next" 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-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="Finish-Breakpoints-in-Python"></a>
|
|
<p>
|
|
Next: <a rel="next" accesskey="n" href="Lazy-Strings-In-Python.html#Lazy-Strings-In-Python">Lazy Strings In Python</a>,
|
|
Previous: <a rel="previous" accesskey="p" href="Breakpoints-In-Python.html#Breakpoints-In-Python">Breakpoints In Python</a>,
|
|
Up: <a rel="up" accesskey="u" href="Python-API.html#Python-API">Python API</a>
|
|
<hr>
|
|
</div>
|
|
|
|
<h5 class="subsubsection">23.2.2.31 Finish Breakpoints</h5>
|
|
|
|
<p><a name="index-python-finish-breakpoints-2422"></a><a name="index-gdb_002eFinishBreakpoint-2423"></a>
|
|
A finish breakpoint is a temporary breakpoint set at the return address of
|
|
a frame, based on the <code>finish</code> command. <code>gdb.FinishBreakpoint</code>
|
|
extends <code>gdb.Breakpoint</code>. The underlying breakpoint will be disabled
|
|
and deleted when the execution will run out of the breakpoint scope (i.e.
|
|
<code>Breakpoint.stop</code> or <code>FinishBreakpoint.out_of_scope</code> triggered).
|
|
Finish breakpoints are thread specific and must be create with the right
|
|
thread selected.
|
|
|
|
<div class="defun">
|
|
— Function: <b>FinishBreakpoint.__init__</b> (<span class="roman">[</span><var>frame</var><span class="roman">]</span> <span class="roman">[</span><var>, internal</var><span class="roman">]</span>)<var><a name="index-FinishBreakpoint_002e_005f_005finit_005f_005f-2424"></a></var><br>
|
|
<blockquote><p>Create a finish breakpoint at the return address of the <code>gdb.Frame</code>
|
|
object <var>frame</var>. If <var>frame</var> is not provided, this defaults to the
|
|
newest frame. The optional <var>internal</var> argument allows the breakpoint to
|
|
become invisible to the user. See <a href="Breakpoints-In-Python.html#Breakpoints-In-Python">Breakpoints In Python</a>, for further
|
|
details about this argument.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Function: <b>FinishBreakpoint.out_of_scope</b> (<var>self</var>)<var><a name="index-FinishBreakpoint_002eout_005fof_005fscope-2425"></a></var><br>
|
|
<blockquote><p>In some circumstances (e.g. <code>longjmp</code>, C<tt>++</tt> exceptions, <span class="sc">gdb</span>
|
|
<code>return</code> command, <small class="dots">...</small>), a function may not properly terminate, and
|
|
thus never hit the finish breakpoint. When <span class="sc">gdb</span> notices such a
|
|
situation, the <code>out_of_scope</code> callback will be triggered.
|
|
|
|
<p>You may want to sub-class <code>gdb.FinishBreakpoint</code> and override this
|
|
method:
|
|
|
|
<pre class="smallexample"> class MyFinishBreakpoint (gdb.FinishBreakpoint)
|
|
def stop (self):
|
|
print "normal finish"
|
|
return True
|
|
|
|
def out_of_scope ():
|
|
print "abnormal finish"
|
|
</pre>
|
|
</blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Variable: <b>FinishBreakpoint.return_value</b><var><a name="index-FinishBreakpoint_002ereturn_005fvalue-2426"></a></var><br>
|
|
<blockquote><p>When <span class="sc">gdb</span> is stopped at a finish breakpoint and the frame
|
|
used to build the <code>gdb.FinishBreakpoint</code> object had debug symbols, this
|
|
attribute will contain a <code>gdb.Value</code> object corresponding to the return
|
|
value of the function. The value will be <code>None</code> if the function return
|
|
type is <code>void</code> or if the return value was not computable. This attribute
|
|
is not writable.
|
|
</p></blockquote></div>
|
|
|
|
</body></html>
|
|
|