|
|
Data of different forms can be displayed by specifying a string of format commands. A format command is a letter that specifies the format in which data is displayed. One or more letter commands can be concatenated with an integer to specify the number of times the letter commands are displayed.
The following partial list illustrates each letter command and associated data format displayed. For the complete list, see adb(CP).
Letter | Format |
o | 2 bytes in octal |
d | 2 bytes in decimal |
D | 4 bytes in decimal |
x | 2 bytes in hexadecimal |
X | 4 bytes in hexadecimal |
u | 2 bytes as an unsigned integer |
f | 4 bytes in floating point |
F | 8 bytes in floating point |
c | 1 byte as a character |
s | A null terminated character string |
i | Machine instruction |
b | 1 byte in octal |
a | The current symbolic address |
A | The current absolute address |
n | A Newline |
r | A blank space |
t | A horizontal TAB |
Use D and X to display long variables or 32-bit values. The f and F commands can be used to display single- and double-precision floating-point numbers. The c command displays char type variables, and the s command is for arrays of char that end with a null character (null terminated strings).
The i command displays machine instructions in 8086/286/386 mnemonics. The b command displays individual bytes and is useful for displaying data associated with instructions, or the high or low bytes of registers.
To make the display more readable, combine the a, r, and n commands with other commands. For example, the following format commands display the current address after each instruction:
iaTo repeat each format, precede each format with a number. For example, the following format commands display four ASCII characters:
4cAlso, combine format requests to provide elaborate displays. For instance, the following commands display four octal words followed by their ASCII interpretation from the data space of the core image file:
<b,-1/4o4^8CnIn this example, the display starts at the address ``<b'', the base address of the program's data. The display continues until the end-of-the-file since the negative count ``-1'' causes an indefinite execution of the commands until an error condition, such as the end of the file, occurs. The command 4o displays the next four words (16-bit values) as octal numbers. The command 4^ then moves the current address back to the beginning of these four words and the C command redisplays them as eight ASCII characters. Finally, n sends a Newline character to the terminal. The C command causes values to be displayed as ASCII characters if they are in the range 32 to 126. If the value is in the range 0 to 31, it is displayed as an at sign (@) followed by a lowercase letter. For example, the value 0 is displayed as @. The at sign itself is displayed as a double at sign (@@).