Values-From-Inferior.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2019 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Free Software" and "Free Software Needs
  8. Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
  9. and with the Back-Cover Texts as in (a) below.
  10. (a) The FSF's Back-Cover Text is: "You are free to copy and modify
  11. this GNU Manual. Buying copies from GNU Press supports the FSF in
  12. developing GNU and promoting software freedom." -->
  13. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <title>Debugging with GDB: Values From Inferior</title>
  16. <meta name="description" content="Debugging with GDB: Values From Inferior">
  17. <meta name="keywords" content="Debugging with GDB: Values From Inferior">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  22. <link href="index.html#Top" rel="start" title="Top">
  23. <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
  24. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  25. <link href="Python-API.html#Python-API" rel="up" title="Python API">
  26. <link href="Types-In-Python.html#Types-In-Python" rel="next" title="Types In Python">
  27. <link href="Exception-Handling.html#Exception-Handling" rel="prev" title="Exception Handling">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.smallquotation {font-size: smaller}
  32. div.display {margin-left: 3.2em}
  33. div.example {margin-left: 3.2em}
  34. div.indentedblock {margin-left: 3.2em}
  35. div.lisp {margin-left: 3.2em}
  36. div.smalldisplay {margin-left: 3.2em}
  37. div.smallexample {margin-left: 3.2em}
  38. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  39. div.smalllisp {margin-left: 3.2em}
  40. kbd {font-style:oblique}
  41. pre.display {font-family: inherit}
  42. pre.format {font-family: inherit}
  43. pre.menu-comment {font-family: serif}
  44. pre.menu-preformatted {font-family: serif}
  45. pre.smalldisplay {font-family: inherit; font-size: smaller}
  46. pre.smallexample {font-size: smaller}
  47. pre.smallformat {font-family: inherit; font-size: smaller}
  48. pre.smalllisp {font-size: smaller}
  49. span.nocodebreak {white-space:nowrap}
  50. span.nolinebreak {white-space:nowrap}
  51. span.roman {font-family:serif; font-weight:normal}
  52. span.sansserif {font-family:sans-serif; font-weight:normal}
  53. ul.no-bullet {list-style: none}
  54. -->
  55. </style>
  56. </head>
  57. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  58. <a name="Values-From-Inferior"></a>
  59. <div class="header">
  60. <p>
  61. Next: <a href="Types-In-Python.html#Types-In-Python" accesskey="n" rel="next">Types In Python</a>, Previous: <a href="Exception-Handling.html#Exception-Handling" accesskey="p" rel="prev">Exception Handling</a>, Up: <a href="Python-API.html#Python-API" accesskey="u" rel="up">Python API</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  62. </div>
  63. <hr>
  64. <a name="Values-From-Inferior-1"></a>
  65. <h4 class="subsubsection">23.2.2.3 Values From Inferior</h4>
  66. <a name="index-values-from-inferior_002c-with-Python"></a>
  67. <a name="index-python_002c-working-with-values-from-inferior"></a>
  68. <a name="index-gdb_002eValue"></a>
  69. <p><small>GDB</small> provides values it obtains from the inferior program in
  70. an object of type <code>gdb.Value</code>. <small>GDB</small> uses this object
  71. for its internal bookkeeping of the inferior&rsquo;s values, and for
  72. fetching values when necessary.
  73. </p>
  74. <p>Inferior values that are simple scalars can be used directly in
  75. Python expressions that are valid for the value&rsquo;s data type. Here&rsquo;s
  76. an example for an integer or floating-point value <code>some_val</code>:
  77. </p>
  78. <div class="smallexample">
  79. <pre class="smallexample">bar = some_val + 2
  80. </pre></div>
  81. <p>As result of this, <code>bar</code> will also be a <code>gdb.Value</code> object
  82. whose values are of the same type as those of <code>some_val</code>. Valid
  83. Python operations can also be performed on <code>gdb.Value</code> objects
  84. representing a <code>struct</code> or <code>class</code> object. For such cases,
  85. the overloaded operator (if present), is used to perform the operation.
  86. For example, if <code>val1</code> and <code>val2</code> are <code>gdb.Value</code> objects
  87. representing instances of a <code>class</code> which overloads the <code>+</code>
  88. operator, then one can use the <code>+</code> operator in their Python script
  89. as follows:
  90. </p>
  91. <div class="smallexample">
  92. <pre class="smallexample">val3 = val1 + val2
  93. </pre></div>
  94. <p>The result of the operation <code>val3</code> is also a <code>gdb.Value</code>
  95. object corresponding to the value returned by the overloaded <code>+</code>
  96. operator. In general, overloaded operators are invoked for the
  97. following operations: <code>+</code> (binary addition), <code>-</code> (binary
  98. subtraction), <code>*</code> (multiplication), <code>/</code>, <code>%</code>, <code>&lt;&lt;</code>,
  99. <code>&gt;&gt;</code>, <code>|</code>, <code>&amp;</code>, <code>^</code>.
  100. </p>
  101. <p>Inferior values that are structures or instances of some class can
  102. be accessed using the Python <em>dictionary syntax</em>. For example, if
  103. <code>some_val</code> is a <code>gdb.Value</code> instance holding a structure, you
  104. can access its <code>foo</code> element with:
  105. </p>
  106. <div class="smallexample">
  107. <pre class="smallexample">bar = some_val['foo']
  108. </pre></div>
  109. <a name="index-getting-structure-elements-using-gdb_002eField-objects-as-subscripts"></a>
  110. <p>Again, <code>bar</code> will also be a <code>gdb.Value</code> object. Structure
  111. elements can also be accessed by using <code>gdb.Field</code> objects as
  112. subscripts (see <a href="Types-In-Python.html#Types-In-Python">Types In Python</a>, for more information on
  113. <code>gdb.Field</code> objects). For example, if <code>foo_field</code> is a
  114. <code>gdb.Field</code> object corresponding to element <code>foo</code> of the above
  115. structure, then <code>bar</code> can also be accessed as follows:
  116. </p>
  117. <div class="smallexample">
  118. <pre class="smallexample">bar = some_val[foo_field]
  119. </pre></div>
  120. <p>A <code>gdb.Value</code> that represents a function can be executed via
  121. inferior function call. Any arguments provided to the call must match
  122. the function&rsquo;s prototype, and must be provided in the order specified
  123. by that prototype.
  124. </p>
  125. <p>For example, <code>some_val</code> is a <code>gdb.Value</code> instance
  126. representing a function that takes two integers as arguments. To
  127. execute this function, call it like so:
  128. </p>
  129. <div class="smallexample">
  130. <pre class="smallexample">result = some_val (10,20)
  131. </pre></div>
  132. <p>Any values returned from a function call will be stored as a
  133. <code>gdb.Value</code>.
  134. </p>
  135. <p>The following attributes are provided:
  136. </p>
  137. <dl>
  138. <dt><a name="index-Value_002eaddress"></a>Variable: <strong>Value.address</strong></dt>
  139. <dd><p>If this object is addressable, this read-only attribute holds a
  140. <code>gdb.Value</code> object representing the address. Otherwise,
  141. this attribute holds <code>None</code>.
  142. </p></dd></dl>
  143. <a name="index-optimized-out-value-in-Python"></a>
  144. <dl>
  145. <dt><a name="index-Value_002eis_005foptimized_005fout"></a>Variable: <strong>Value.is_optimized_out</strong></dt>
  146. <dd><p>This read-only boolean attribute is true if the compiler optimized out
  147. this value, thus it is not available for fetching from the inferior.
  148. </p></dd></dl>
  149. <dl>
  150. <dt><a name="index-Value_002etype"></a>Variable: <strong>Value.type</strong></dt>
  151. <dd><p>The type of this <code>gdb.Value</code>. The value of this attribute is a
  152. <code>gdb.Type</code> object (see <a href="Types-In-Python.html#Types-In-Python">Types In Python</a>).
  153. </p></dd></dl>
  154. <dl>
  155. <dt><a name="index-Value_002edynamic_005ftype"></a>Variable: <strong>Value.dynamic_type</strong></dt>
  156. <dd><p>The dynamic type of this <code>gdb.Value</code>. This uses the object&rsquo;s
  157. virtual table and the C<tt>++</tt> run-time type information
  158. (<acronym>RTTI</acronym>) to determine the dynamic type of the value. If this
  159. value is of class type, it will return the class in which the value is
  160. embedded, if any. If this value is of pointer or reference to a class
  161. type, it will compute the dynamic type of the referenced object, and
  162. return a pointer or reference to that type, respectively. In all
  163. other cases, it will return the value&rsquo;s static type.
  164. </p>
  165. <p>Note that this feature will only work when debugging a C<tt>++</tt> program
  166. that includes <acronym>RTTI</acronym> for the object in question. Otherwise,
  167. it will just return the static type of the value as in <kbd>ptype foo</kbd>
  168. (see <a href="Symbols.html#Symbols">ptype</a>).
  169. </p></dd></dl>
  170. <dl>
  171. <dt><a name="index-Value_002eis_005flazy"></a>Variable: <strong>Value.is_lazy</strong></dt>
  172. <dd><p>The value of this read-only boolean attribute is <code>True</code> if this
  173. <code>gdb.Value</code> has not yet been fetched from the inferior.
  174. <small>GDB</small> does not fetch values until necessary, for efficiency.
  175. For example:
  176. </p>
  177. <div class="smallexample">
  178. <pre class="smallexample">myval = gdb.parse_and_eval ('somevar')
  179. </pre></div>
  180. <p>The value of <code>somevar</code> is not fetched at this time. It will be
  181. fetched when the value is needed, or when the <code>fetch_lazy</code>
  182. method is invoked.
  183. </p></dd></dl>
  184. <p>The following methods are provided:
  185. </p>
  186. <dl>
  187. <dt><a name="index-Value_002e_005f_005finit_005f_005f"></a>Function: <strong>Value.__init__</strong> <em>(<var>val</var>)</em></dt>
  188. <dd><p>Many Python values can be converted directly to a <code>gdb.Value</code> via
  189. this object initializer. Specifically:
  190. </p>
  191. <dl compact="compact">
  192. <dt>Python boolean</dt>
  193. <dd><p>A Python boolean is converted to the boolean type from the current
  194. language.
  195. </p>
  196. </dd>
  197. <dt>Python integer</dt>
  198. <dd><p>A Python integer is converted to the C <code>long</code> type for the
  199. current architecture.
  200. </p>
  201. </dd>
  202. <dt>Python long</dt>
  203. <dd><p>A Python long is converted to the C <code>long long</code> type for the
  204. current architecture.
  205. </p>
  206. </dd>
  207. <dt>Python float</dt>
  208. <dd><p>A Python float is converted to the C <code>double</code> type for the
  209. current architecture.
  210. </p>
  211. </dd>
  212. <dt>Python string</dt>
  213. <dd><p>A Python string is converted to a target string in the current target
  214. language using the current target encoding.
  215. If a character cannot be represented in the current target encoding,
  216. then an exception is thrown.
  217. </p>
  218. </dd>
  219. <dt><code>gdb.Value</code></dt>
  220. <dd><p>If <code>val</code> is a <code>gdb.Value</code>, then a copy of the value is made.
  221. </p>
  222. </dd>
  223. <dt><code>gdb.LazyString</code></dt>
  224. <dd><p>If <code>val</code> is a <code>gdb.LazyString</code> (see <a href="Lazy-Strings-In-Python.html#Lazy-Strings-In-Python">Lazy Strings In Python</a>), then the lazy string&rsquo;s <code>value</code> method is called, and
  225. its result is used.
  226. </p></dd>
  227. </dl>
  228. </dd></dl>
  229. <dl>
  230. <dt><a name="index-Value_002e_005f_005finit_005f_005f-1"></a>Function: <strong>Value.__init__</strong> <em>(<var>val</var>, <span class="roman">[</span>, type <span class="roman">]</span>)</em></dt>
  231. <dd><p>This second form of the <code>gdb.Value</code> constructor returns a
  232. <code>gdb.Value</code> of type <var>type</var> where the value contents are taken
  233. from the Python buffer object specified by <var>val</var>. The number of
  234. bytes in the Python buffer object must be greater than or equal to the
  235. size of <var>type</var>.
  236. </p></dd></dl>
  237. <dl>
  238. <dt><a name="index-Value_002ecast"></a>Function: <strong>Value.cast</strong> <em>(type)</em></dt>
  239. <dd><p>Return a new instance of <code>gdb.Value</code> that is the result of
  240. casting this instance to the type described by <var>type</var>, which must
  241. be a <code>gdb.Type</code> object. If the cast cannot be performed for some
  242. reason, this method throws an exception.
  243. </p></dd></dl>
  244. <dl>
  245. <dt><a name="index-Value_002edereference"></a>Function: <strong>Value.dereference</strong> <em>()</em></dt>
  246. <dd><p>For pointer data types, this method returns a new <code>gdb.Value</code> object
  247. whose contents is the object pointed to by the pointer. For example, if
  248. <code>foo</code> is a C pointer to an <code>int</code>, declared in your C program as
  249. </p>
  250. <div class="smallexample">
  251. <pre class="smallexample">int *foo;
  252. </pre></div>
  253. <p>then you can use the corresponding <code>gdb.Value</code> to access what
  254. <code>foo</code> points to like this:
  255. </p>
  256. <div class="smallexample">
  257. <pre class="smallexample">bar = foo.dereference ()
  258. </pre></div>
  259. <p>The result <code>bar</code> will be a <code>gdb.Value</code> object holding the
  260. value pointed to by <code>foo</code>.
  261. </p>
  262. <p>A similar function <code>Value.referenced_value</code> exists which also
  263. returns <code>gdb.Value</code> objects corresonding to the values pointed to
  264. by pointer values (and additionally, values referenced by reference
  265. values). However, the behavior of <code>Value.dereference</code>
  266. differs from <code>Value.referenced_value</code> by the fact that the
  267. behavior of <code>Value.dereference</code> is identical to applying the C
  268. unary operator <code>*</code> on a given value. For example, consider a
  269. reference to a pointer <code>ptrref</code>, declared in your C<tt>++</tt> program
  270. as
  271. </p>
  272. <div class="smallexample">
  273. <pre class="smallexample">typedef int *intptr;
  274. ...
  275. int val = 10;
  276. intptr ptr = &amp;val;
  277. intptr &amp;ptrref = ptr;
  278. </pre></div>
  279. <p>Though <code>ptrref</code> is a reference value, one can apply the method
  280. <code>Value.dereference</code> to the <code>gdb.Value</code> object corresponding
  281. to it and obtain a <code>gdb.Value</code> which is identical to that
  282. corresponding to <code>val</code>. However, if you apply the method
  283. <code>Value.referenced_value</code>, the result would be a <code>gdb.Value</code>
  284. object identical to that corresponding to <code>ptr</code>.
  285. </p>
  286. <div class="smallexample">
  287. <pre class="smallexample">py_ptrref = gdb.parse_and_eval (&quot;ptrref&quot;)
  288. py_val = py_ptrref.dereference ()
  289. py_ptr = py_ptrref.referenced_value ()
  290. </pre></div>
  291. <p>The <code>gdb.Value</code> object <code>py_val</code> is identical to that
  292. corresponding to <code>val</code>, and <code>py_ptr</code> is identical to that
  293. corresponding to <code>ptr</code>. In general, <code>Value.dereference</code> can
  294. be applied whenever the C unary operator <code>*</code> can be applied
  295. to the corresponding C value. For those cases where applying both
  296. <code>Value.dereference</code> and <code>Value.referenced_value</code> is allowed,
  297. the results obtained need not be identical (as we have seen in the above
  298. example). The results are however identical when applied on
  299. <code>gdb.Value</code> objects corresponding to pointers (<code>gdb.Value</code>
  300. objects with type code <code>TYPE_CODE_PTR</code>) in a C/C<tt>++</tt> program.
  301. </p></dd></dl>
  302. <dl>
  303. <dt><a name="index-Value_002ereferenced_005fvalue"></a>Function: <strong>Value.referenced_value</strong> <em>()</em></dt>
  304. <dd><p>For pointer or reference data types, this method returns a new
  305. <code>gdb.Value</code> object corresponding to the value referenced by the
  306. pointer/reference value. For pointer data types,
  307. <code>Value.dereference</code> and <code>Value.referenced_value</code> produce
  308. identical results. The difference between these methods is that
  309. <code>Value.dereference</code> cannot get the values referenced by reference
  310. values. For example, consider a reference to an <code>int</code>, declared
  311. in your C<tt>++</tt> program as
  312. </p>
  313. <div class="smallexample">
  314. <pre class="smallexample">int val = 10;
  315. int &amp;ref = val;
  316. </pre></div>
  317. <p>then applying <code>Value.dereference</code> to the <code>gdb.Value</code> object
  318. corresponding to <code>ref</code> will result in an error, while applying
  319. <code>Value.referenced_value</code> will result in a <code>gdb.Value</code> object
  320. identical to that corresponding to <code>val</code>.
  321. </p>
  322. <div class="smallexample">
  323. <pre class="smallexample">py_ref = gdb.parse_and_eval (&quot;ref&quot;)
  324. er_ref = py_ref.dereference () # Results in error
  325. py_val = py_ref.referenced_value () # Returns the referenced value
  326. </pre></div>
  327. <p>The <code>gdb.Value</code> object <code>py_val</code> is identical to that
  328. corresponding to <code>val</code>.
  329. </p></dd></dl>
  330. <dl>
  331. <dt><a name="index-Value_002ereference_005fvalue"></a>Function: <strong>Value.reference_value</strong> <em>()</em></dt>
  332. <dd><p>Return a <code>gdb.Value</code> object which is a reference to the value
  333. encapsulated by this instance.
  334. </p></dd></dl>
  335. <dl>
  336. <dt><a name="index-Value_002econst_005fvalue"></a>Function: <strong>Value.const_value</strong> <em>()</em></dt>
  337. <dd><p>Return a <code>gdb.Value</code> object which is a <code>const</code> version of the
  338. value encapsulated by this instance.
  339. </p></dd></dl>
  340. <dl>
  341. <dt><a name="index-Value_002edynamic_005fcast"></a>Function: <strong>Value.dynamic_cast</strong> <em>(type)</em></dt>
  342. <dd><p>Like <code>Value.cast</code>, but works as if the C<tt>++</tt> <code>dynamic_cast</code>
  343. operator were used. Consult a C<tt>++</tt> reference for details.
  344. </p></dd></dl>
  345. <dl>
  346. <dt><a name="index-Value_002ereinterpret_005fcast"></a>Function: <strong>Value.reinterpret_cast</strong> <em>(type)</em></dt>
  347. <dd><p>Like <code>Value.cast</code>, but works as if the C<tt>++</tt> <code>reinterpret_cast</code>
  348. operator were used. Consult a C<tt>++</tt> reference for details.
  349. </p></dd></dl>
  350. <dl>
  351. <dt><a name="index-Value_002estring"></a>Function: <strong>Value.string</strong> <em>(<span class="roman">[</span>encoding<span class="roman">[</span>, errors<span class="roman">[</span>, length<span class="roman">]]]</span>)</em></dt>
  352. <dd><p>If this <code>gdb.Value</code> represents a string, then this method
  353. converts the contents to a Python string. Otherwise, this method will
  354. throw an exception.
  355. </p>
  356. <p>Values are interpreted as strings according to the rules of the
  357. current language. If the optional length argument is given, the
  358. string will be converted to that length, and will include any embedded
  359. zeroes that the string may contain. Otherwise, for languages
  360. where the string is zero-terminated, the entire string will be
  361. converted.
  362. </p>
  363. <p>For example, in C-like languages, a value is a string if it is a pointer
  364. to or an array of characters or ints of type <code>wchar_t</code>, <code>char16_t</code>,
  365. or <code>char32_t</code>.
  366. </p>
  367. <p>If the optional <var>encoding</var> argument is given, it must be a string
  368. naming the encoding of the string in the <code>gdb.Value</code>, such as
  369. <code>&quot;ascii&quot;</code>, <code>&quot;iso-8859-6&quot;</code> or <code>&quot;utf-8&quot;</code>. It accepts
  370. the same encodings as the corresponding argument to Python&rsquo;s
  371. <code>string.decode</code> method, and the Python codec machinery will be used
  372. to convert the string. If <var>encoding</var> is not given, or if
  373. <var>encoding</var> is the empty string, then either the <code>target-charset</code>
  374. (see <a href="Character-Sets.html#Character-Sets">Character Sets</a>) will be used, or a language-specific encoding
  375. will be used, if the current language is able to supply one.
  376. </p>
  377. <p>The optional <var>errors</var> argument is the same as the corresponding
  378. argument to Python&rsquo;s <code>string.decode</code> method.
  379. </p>
  380. <p>If the optional <var>length</var> argument is given, the string will be
  381. fetched and converted to the given length.
  382. </p></dd></dl>
  383. <dl>
  384. <dt><a name="index-Value_002elazy_005fstring"></a>Function: <strong>Value.lazy_string</strong> <em>(<span class="roman">[</span>encoding <span class="roman">[</span>, length<span class="roman">]]</span>)</em></dt>
  385. <dd><p>If this <code>gdb.Value</code> represents a string, then this method
  386. converts the contents to a <code>gdb.LazyString</code> (see <a href="Lazy-Strings-In-Python.html#Lazy-Strings-In-Python">Lazy Strings In Python</a>). Otherwise, this method will throw an exception.
  387. </p>
  388. <p>If the optional <var>encoding</var> argument is given, it must be a string
  389. naming the encoding of the <code>gdb.LazyString</code>. Some examples are:
  390. &lsquo;<samp>ascii</samp>&rsquo;, &lsquo;<samp>iso-8859-6</samp>&rsquo; or &lsquo;<samp>utf-8</samp>&rsquo;. If the
  391. <var>encoding</var> argument is an encoding that <small>GDB</small> does
  392. recognize, <small>GDB</small> will raise an error.
  393. </p>
  394. <p>When a lazy string is printed, the <small>GDB</small> encoding machinery is
  395. used to convert the string during printing. If the optional
  396. <var>encoding</var> argument is not provided, or is an empty string,
  397. <small>GDB</small> will automatically select the encoding most suitable for
  398. the string type. For further information on encoding in <small>GDB</small>
  399. please see <a href="Character-Sets.html#Character-Sets">Character Sets</a>.
  400. </p>
  401. <p>If the optional <var>length</var> argument is given, the string will be
  402. fetched and encoded to the length of characters specified. If
  403. the <var>length</var> argument is not provided, the string will be fetched
  404. and encoded until a null of appropriate width is found.
  405. </p></dd></dl>
  406. <dl>
  407. <dt><a name="index-Value_002efetch_005flazy"></a>Function: <strong>Value.fetch_lazy</strong> <em>()</em></dt>
  408. <dd><p>If the <code>gdb.Value</code> object is currently a lazy value
  409. (<code>gdb.Value.is_lazy</code> is <code>True</code>), then the value is
  410. fetched from the inferior. Any errors that occur in the process
  411. will produce a Python exception.
  412. </p>
  413. <p>If the <code>gdb.Value</code> object is not a lazy value, this method
  414. has no effect.
  415. </p>
  416. <p>This method does not return a value.
  417. </p></dd></dl>
  418. <hr>
  419. <div class="header">
  420. <p>
  421. Next: <a href="Types-In-Python.html#Types-In-Python" accesskey="n" rel="next">Types In Python</a>, Previous: <a href="Exception-Handling.html#Exception-Handling" accesskey="p" rel="prev">Exception Handling</a>, Up: <a href="Python-API.html#Python-API" accesskey="u" rel="up">Python API</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  422. </div>
  423. </body>
  424. </html>