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 unlimited
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 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.