Debugging with GDB Manual The GNU Source-Level Debugger (769148-001, March 2014)
set print array off Return to compressed format for arrays.
show print array Show whether compressed or pretty format is selected for
displaying arrays.
set print elements
number-of-elements
Set a limit on how many elements of an array GDB will
print. If GDB is printing a large array, it stops printing after
it has printed the number of elements set by the set print
elements command. This limit also applies to the display
of strings. When GDB starts, this limit is set to 200. Setting
number-of-elements to zero means that the printing is
unlimited.
show print elements Display the number of elements of a large array that GDB
will print. If the number is 0, then the printing is unlimited.
set print null-stop Cause GDB to stop printing the characters of an array when
the first NULL is encountered. This is useful when large
arrays actually contain only short strings. The default is off.
set print pretty on Cause GDB to print structures in an indented format with
one member per line, like this:
$1 = {
next = 0x0,
flags = {
sweet = 1,
sour = 1
},
meat = 0x54 "Pork"
}
set print pretty off Cause GDB to print structures in a compact format, like this:
$1 = {next = 0x0, flags = {sweet = 1, sour =
1}, \
meat = 0x54 "Pork"}
This is the default format.
show print pretty Show which format GDB is using to print structures.
set print sevenbit-strings
on
Print using only seven-bit characters; if this option is set,
GDB displays any eight-bit characters (in strings or character
values) using the notation \nnn. This setting is best if you
are working in English (ASCII) and you use the high-order
bit of characters as a marker or “meta” bit.
set print sevenbit-strings
off
Print full eight-bit characters. This allows the use of more
international character sets, and is the default.
show print sevenbit-strings Show whether or not GDB is printing only seven-bit
characters.
set print union on Tell GDB to print unions which are contained in structures.
This is the default setting.
set print union off Tell GDB not to print unions which are contained in
structures.
show print union Ask GDB whether or not it will print unions which are
contained in structures.
For example, given the declarations
typedef enum {Tree, Bug} Species;
typedef enum {Big_tree, Acorn, Seedling}
Tree_forms;
typedef enum {Caterpillar, Cocoon, Butterfly}
Print settings 65