Previous: , Up: Data   [Contents][Index]


10.23 Value Sizes

Whenever GDB prints a value memory will be allocated within GDB 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 GDB to try and allocate an overly large ammount of memory.

set max-value-size bytes
set max-value-size unlimited

Set the maximum size of memory that GDB will allocate for the contents of a value to bytes, trying to display a value that requires more memory than that will result in an error.

Setting this variable does not effect values that have already been allocated within GDB, only future allocations.

There’s a minimum size that max-value-size can be set to in order that GDB can still operate correctly, this minimum is currently 16 bytes.

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 x.y.z, may fail if the size of x.y is dynamic and exceeds bytes. On the other hand, GDB is sometimes clever; the expression A[i], where A is an array variable with non-constant size, will generally succeed regardless of the bounds on A, as long as the component size is less than bytes.

The default value of max-value-size is currently 64k.

show max-value-size

Show the maximum size of memory, in bytes, that GDB will allocate for the contents of a value.