• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2013.11/share/doc/arm-arm-none-eabi/html/gdb/
1<html lang="en">
2<head>
3<title>Threads 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="Events-In-Python.html#Events-In-Python" title="Events In Python">
10<link rel="next" href="Commands-In-Python.html#Commands-In-Python" title="Commands In Python">
11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
12<!--
13Copyright (C) 1988-2013 Free Software Foundation, Inc.
14
15Permission is granted to copy, distribute and/or modify this document
16under the terms of the GNU Free Documentation License, Version 1.3 or
17any later version published by the Free Software Foundation; with the
18Invariant Sections being ``Free Software'' and ``Free Software Needs
19Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
20and with the Back-Cover Texts as in (a) below.
21
22(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
23this GNU Manual.  Buying copies from GNU Press supports the FSF in
24developing GNU and promoting software freedom.''
25-->
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="Threads-In-Python"></a>
43<p>
44Next:&nbsp;<a rel="next" accesskey="n" href="Commands-In-Python.html#Commands-In-Python">Commands In Python</a>,
45Previous:&nbsp;<a rel="previous" accesskey="p" href="Events-In-Python.html#Events-In-Python">Events In Python</a>,
46Up:&nbsp;<a rel="up" accesskey="u" href="Python-API.html#Python-API">Python API</a>
47<hr>
48</div>
49
50<h5 class="subsubsection">23.2.2.14 Threads In Python</h5>
51
52<p><a name="index-threads-in-python-1923"></a>
53<a name="index-gdb_002eInferiorThread-1924"></a>Python scripts can access information about, and manipulate inferior threads
54controlled by <span class="sc">gdb</span>, via objects of the <code>gdb.InferiorThread</code> class.
55
56   <p>The following thread-related functions are available in the <code>gdb</code>
57module:
58
59   <p><a name="index-gdb_002eselected_005fthread-1925"></a>
60
61<div class="defun">
62&mdash; Function: <b>gdb.selected_thread</b> ()<var><a name="index-gdb_002eselected_005fthread-1926"></a></var><br>
63<blockquote><p>This function returns the thread object for the selected thread.  If there
64is no selected thread, this will return <code>None</code>. 
65</p></blockquote></div>
66
67   <p>A <code>gdb.InferiorThread</code> object has the following attributes:
68
69<div class="defun">
70&mdash; Variable: <b>InferiorThread.name</b><var><a name="index-InferiorThread_002ename-1927"></a></var><br>
71<blockquote><p>The name of the thread.  If the user specified a name using
72<code>thread name</code>, then this returns that name.  Otherwise, if an
73OS-supplied name is available, then it is returned.  Otherwise, this
74returns <code>None</code>.
75
76        <p>This attribute can be assigned to.  The new value must be a string
77object, which sets the new name, or <code>None</code>, which removes any
78user-specified thread name. 
79</p></blockquote></div>
80
81<div class="defun">
82&mdash; Variable: <b>InferiorThread.num</b><var><a name="index-InferiorThread_002enum-1928"></a></var><br>
83<blockquote><p>ID of the thread, as assigned by GDB. 
84</p></blockquote></div>
85
86<div class="defun">
87&mdash; Variable: <b>InferiorThread.ptid</b><var><a name="index-InferiorThread_002eptid-1929"></a></var><br>
88<blockquote><p>ID of the thread, as assigned by the operating system.  This attribute is a
89tuple containing three integers.  The first is the Process ID (PID); the second
90is the Lightweight Process ID (LWPID), and the third is the Thread ID (TID). 
91Either the LWPID or TID may be 0, which indicates that the operating system
92does not  use that identifier. 
93</p></blockquote></div>
94
95   <p>A <code>gdb.InferiorThread</code> object has the following methods:
96
97<div class="defun">
98&mdash; Function: <b>InferiorThread.is_valid</b> ()<var><a name="index-InferiorThread_002eis_005fvalid-1930"></a></var><br>
99<blockquote><p>Returns <code>True</code> if the <code>gdb.InferiorThread</code> object is valid,
100<code>False</code> if not.  A <code>gdb.InferiorThread</code> object will become
101invalid if the thread exits, or the inferior that the thread belongs
102is deleted.  All other <code>gdb.InferiorThread</code> methods will throw an
103exception if it is invalid at the time the method is called. 
104</p></blockquote></div>
105
106<div class="defun">
107&mdash; Function: <b>InferiorThread.switch</b> ()<var><a name="index-InferiorThread_002eswitch-1931"></a></var><br>
108<blockquote><p>This changes <span class="sc">gdb</span>'s currently selected thread to the one represented
109by this object. 
110</p></blockquote></div>
111
112<div class="defun">
113&mdash; Function: <b>InferiorThread.is_stopped</b> ()<var><a name="index-InferiorThread_002eis_005fstopped-1932"></a></var><br>
114<blockquote><p>Return a Boolean indicating whether the thread is stopped. 
115</p></blockquote></div>
116
117<div class="defun">
118&mdash; Function: <b>InferiorThread.is_running</b> ()<var><a name="index-InferiorThread_002eis_005frunning-1933"></a></var><br>
119<blockquote><p>Return a Boolean indicating whether the thread is running. 
120</p></blockquote></div>
121
122<div class="defun">
123&mdash; Function: <b>InferiorThread.is_exited</b> ()<var><a name="index-InferiorThread_002eis_005fexited-1934"></a></var><br>
124<blockquote><p>Return a Boolean indicating whether the thread is exited. 
125</p></blockquote></div>
126
127   </body></html>
128
129