Name

print

Synopsis

print [/format] [expression]

Print the value of expression. If the first argument is "/" and format, use the format to print the expression. Omitting expression prints the previous expression, allowing you to use a different format to see the same value. The allowed format values are a subset of the format items for the x command; see also x, later in this section.

Print Formats

a

Print the value as an address. The address is printed as both an absolute (hexadecimal) address, and as an offset from the nearest symbol.

c

Print the value as a character constant.

d

Print the value as a signed decimal integer.

f

Print the value as a floating point number.

o

Print the value as an octal integer.

t

Print the value as a binary integer (t stands for “two”).

u

Print the value as an unsigned decimal integer.

x

Print the value as a hexadecimal integer.

Example

Print a wide character value as a regular character:

    (gdb) print tmp->sub.val.wsp
    $2 = (wchar_t *) 0x99f0910
    (gdb) print/c *$2
    $3 = 97 'a'

Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.