• 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>Inferiors 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="Writing-a-Frame-Filter.html#Writing-a-Frame-Filter" title="Writing a Frame Filter">
10<link rel="next" href="Events-In-Python.html#Events-In-Python" title="Events 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="Inferiors-In-Python"></a>
43<p>
44Next:&nbsp;<a rel="next" accesskey="n" href="Events-In-Python.html#Events-In-Python">Events In Python</a>,
45Previous:&nbsp;<a rel="previous" accesskey="p" href="Writing-a-Frame-Filter.html#Writing-a-Frame-Filter">Writing a Frame Filter</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.12 Inferiors In Python</h5>
51
52<p><a name="index-inferiors-in-Python-1898"></a>
53<a name="index-gdb_002eInferior-1899"></a>Programs which are being run under <span class="sc">gdb</span> are called inferiors
54(see <a href="Inferiors-and-Programs.html#Inferiors-and-Programs">Inferiors and Programs</a>).  Python scripts can access
55information about and manipulate inferiors controlled by <span class="sc">gdb</span>
56via objects of the <code>gdb.Inferior</code> class.
57
58   <p>The following inferior-related functions are available in the <code>gdb</code>
59module:
60
61<div class="defun">
62&mdash; Function: <b>gdb.inferiors</b> ()<var><a name="index-gdb_002einferiors-1900"></a></var><br>
63<blockquote><p>Return a tuple containing all inferior objects. 
64</p></blockquote></div>
65
66<div class="defun">
67&mdash; Function: <b>gdb.selected_inferior</b> ()<var><a name="index-gdb_002eselected_005finferior-1901"></a></var><br>
68<blockquote><p>Return an object representing the current inferior. 
69</p></blockquote></div>
70
71   <p>A <code>gdb.Inferior</code> object has the following attributes:
72
73<div class="defun">
74&mdash; Variable: <b>Inferior.num</b><var><a name="index-Inferior_002enum-1902"></a></var><br>
75<blockquote><p>ID of inferior, as assigned by GDB. 
76</p></blockquote></div>
77
78<div class="defun">
79&mdash; Variable: <b>Inferior.pid</b><var><a name="index-Inferior_002epid-1903"></a></var><br>
80<blockquote><p>Process ID of the inferior, as assigned by the underlying operating
81system. 
82</p></blockquote></div>
83
84<div class="defun">
85&mdash; Variable: <b>Inferior.was_attached</b><var><a name="index-Inferior_002ewas_005fattached-1904"></a></var><br>
86<blockquote><p>Boolean signaling whether the inferior was created using `attach', or
87started by <span class="sc">gdb</span> itself. 
88</p></blockquote></div>
89
90   <p>A <code>gdb.Inferior</code> object has the following methods:
91
92<div class="defun">
93&mdash; Function: <b>Inferior.is_valid</b> ()<var><a name="index-Inferior_002eis_005fvalid-1905"></a></var><br>
94<blockquote><p>Returns <code>True</code> if the <code>gdb.Inferior</code> object is valid,
95<code>False</code> if not.  A <code>gdb.Inferior</code> object will become invalid
96if the inferior no longer exists within <span class="sc">gdb</span>.  All other
97<code>gdb.Inferior</code> methods will throw an exception if it is invalid
98at the time the method is called. 
99</p></blockquote></div>
100
101<div class="defun">
102&mdash; Function: <b>Inferior.threads</b> ()<var><a name="index-Inferior_002ethreads-1906"></a></var><br>
103<blockquote><p>This method returns a tuple holding all the threads which are valid
104when it is called.  If there are no valid threads, the method will
105return an empty tuple. 
106</p></blockquote></div>
107
108   <p><a name="index-Inferior_002eread_005fmemory-1907"></a>
109
110<div class="defun">
111&mdash; Function: <b>Inferior.read_memory</b> (<var>address, length</var>)<var><a name="index-Inferior_002eread_005fmemory-1908"></a></var><br>
112<blockquote><p>Read <var>length</var> bytes of memory from the inferior, starting at
113<var>address</var>.  Returns a buffer object, which behaves much like an array
114or a string.  It can be modified and given to the
115<code>Inferior.write_memory</code> function.  In <code>Python</code> 3, the return
116value is a <code>memoryview</code> object. 
117</p></blockquote></div>
118
119   <p><a name="index-Inferior_002ewrite_005fmemory-1909"></a>
120
121<div class="defun">
122&mdash; Function: <b>Inferior.write_memory</b> (<var>address, buffer </var><span class="roman">[</span><var>, length</var><span class="roman">]</span>)<var><a name="index-Inferior_002ewrite_005fmemory-1910"></a></var><br>
123<blockquote><p>Write the contents of <var>buffer</var> to the inferior, starting at
124<var>address</var>.  The <var>buffer</var> parameter must be a Python object
125which supports the buffer protocol, i.e., a string, an array or the
126object returned from <code>Inferior.read_memory</code>.  If given, <var>length</var>
127determines the number of bytes from <var>buffer</var> to be written. 
128</p></blockquote></div>
129
130   <p><a name="index-gdb_002esearch_005fmemory-1911"></a>
131
132<div class="defun">
133&mdash; Function: <b>Inferior.search_memory</b> (<var>address, length, pattern</var>)<var><a name="index-Inferior_002esearch_005fmemory-1912"></a></var><br>
134<blockquote><p>Search a region of the inferior memory starting at <var>address</var> with
135the given <var>length</var> using the search pattern supplied in
136<var>pattern</var>.  The <var>pattern</var> parameter must be a Python object
137which supports the buffer protocol, i.e., a string, an array or the
138object returned from <code>gdb.read_memory</code>.  Returns a Python <code>Long</code>
139containing the address where the pattern was found, or <code>None</code> if
140the pattern could not be found. 
141</p></blockquote></div>
142
143   </body></html>
144
145