Debugging with GDB (September 2007)

72 Debugging with GDB
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
numb e r 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 char-
acter 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.