blob: 38ffed3ca6a744c12bb69fdbdad1e0c302635cad [file] [log] [blame]
<html lang="en">
<head>
<title>Value Sizes - 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="Data.html#Data" title="Data">
<link rel="prev" href="Searching-Memory.html#Searching-Memory" title="Searching Memory">
<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="Value-Sizes"></a>
<p>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Searching-Memory.html#Searching-Memory">Searching Memory</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Data.html#Data">Data</a>
<hr>
</div>
<h3 class="section">10.23 Value Sizes</h3>
<p>Whenever <span class="sc">gdb</span> prints a value memory will be allocated within
<span class="sc">gdb</span> to hold the contents of the value. It is possible in
some languages with dynamic typing systems, that an invalid program
may indicate a value that is incorrectly large, this in turn may cause
<span class="sc">gdb</span> to try and allocate an overly large ammount of memory.
<a name="index-set-max_002dvalue_002dsize-832"></a>
<dl><dt><code>set max-value-size </code><var>bytes</var><dt><code>set max-value-size unlimited</code><dd>Set the maximum size of memory that <span class="sc">gdb</span> will allocate for the
contents of a value to <var>bytes</var>, trying to display a value that
requires more memory than that will result in an error.
<p>Setting this variable does not effect values that have already been
allocated within <span class="sc">gdb</span>, only future allocations.
<p>There's a minimum size that <code>max-value-size</code> can be set to in
order that <span class="sc">gdb</span> can still operate correctly, this minimum is
currently 16 bytes.
<p>The limit applies to the results of some subexpressions as well as to
complete expressions. For example, an expression denoting a simple
integer component, such as <code>x.y.z</code>, may fail if the size of
<var>x.y</var> is dynamic and exceeds <var>bytes</var>. On the other hand,
<span class="sc">gdb</span> is sometimes clever; the expression <code>A[i]</code>, where
<var>A</var> is an array variable with non-constant size, will generally
succeed regardless of the bounds on <var>A</var>, as long as the component
size is less than <var>bytes</var>.
<p>The default value of <code>max-value-size</code> is currently 64k.
<p><a name="index-show-max_002dvalue_002dsize-833"></a><br><dt><code>show max-value-size</code><dd>Show the maximum size of memory, in bytes, that <span class="sc">gdb</span> will
allocate for the contents of a value.
</dl>
</body></html>