1<html lang="en"> 2<head> 3<title>Lazy Strings 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="Finish-Breakpoints-in-Python.html#Finish-Breakpoints-in-Python" title="Finish Breakpoints in Python"> 10<link rel="next" href="Architectures-In-Python.html#Architectures-In-Python" title="Architectures 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="Lazy-Strings-In-Python"></a> 43<p> 44Next: <a rel="next" accesskey="n" href="Architectures-In-Python.html#Architectures-In-Python">Architectures In Python</a>, 45Previous: <a rel="previous" accesskey="p" href="Finish-Breakpoints-in-Python.html#Finish-Breakpoints-in-Python">Finish Breakpoints in Python</a>, 46Up: <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.26 Python representation of lazy strings.</h5> 51 52<p><a name="index-lazy-strings-in-python-2186"></a><a name="index-gdb_002eLazyString-2187"></a> 53A <dfn>lazy string</dfn> is a string whose contents is not retrieved or 54encoded until it is needed. 55 56 <p>A <code>gdb.LazyString</code> is represented in <span class="sc">gdb</span> as an 57<code>address</code> that points to a region of memory, an <code>encoding</code> 58that will be used to encode that region of memory, and a <code>length</code> 59to delimit the region of memory that represents the string. The 60difference between a <code>gdb.LazyString</code> and a string wrapped within 61a <code>gdb.Value</code> is that a <code>gdb.LazyString</code> will be treated 62differently by <span class="sc">gdb</span> when printing. A <code>gdb.LazyString</code> is 63retrieved and encoded during printing, while a <code>gdb.Value</code> 64wrapping a string is immediately retrieved and encoded on creation. 65 66 <p>A <code>gdb.LazyString</code> object has the following functions: 67 68<div class="defun"> 69— Function: <b>LazyString.value</b> ()<var><a name="index-LazyString_002evalue-2188"></a></var><br> 70<blockquote><p>Convert the <code>gdb.LazyString</code> to a <code>gdb.Value</code>. This value 71will point to the string in memory, but will lose all the delayed 72retrieval, encoding and handling that <span class="sc">gdb</span> applies to a 73<code>gdb.LazyString</code>. 74</p></blockquote></div> 75 76<div class="defun"> 77— Variable: <b>LazyString.address</b><var><a name="index-LazyString_002eaddress-2189"></a></var><br> 78<blockquote><p>This attribute holds the address of the string. This attribute is not 79writable. 80</p></blockquote></div> 81 82<div class="defun"> 83— Variable: <b>LazyString.length</b><var><a name="index-LazyString_002elength-2190"></a></var><br> 84<blockquote><p>This attribute holds the length of the string in characters. If the 85length is -1, then the string will be fetched and encoded up to the 86first null of appropriate width. This attribute is not writable. 87</p></blockquote></div> 88 89<div class="defun"> 90— Variable: <b>LazyString.encoding</b><var><a name="index-LazyString_002eencoding-2191"></a></var><br> 91<blockquote><p>This attribute holds the encoding that will be applied to the string 92when the string is printed by <span class="sc">gdb</span>. If the encoding is not 93set, or contains an empty string, then <span class="sc">gdb</span> will select the 94most appropriate encoding when the string is printed. This attribute 95is not writable. 96</p></blockquote></div> 97 98<div class="defun"> 99— Variable: <b>LazyString.type</b><var><a name="index-LazyString_002etype-2192"></a></var><br> 100<blockquote><p>This attribute holds the type that is represented by the lazy string's 101type. For a lazy string this will always be a pointer type. To 102resolve this to the lazy string's character type, use the type's 103<code>target</code> method. See <a href="Types-In-Python.html#Types-In-Python">Types In Python</a>. This attribute is not 104writable. 105</p></blockquote></div> 106 107 </body></html> 108 109