mdr(1) Memory manipulation commands

Other Alias

md, mdWcN, mds, mm, mmW

SYNOPSIS

md [ address-expression [ line-count [output-radix ] ] ]

mdWcn [ address-expression [ line-count [output-radix ] ] ]

mdp physical-address-expression,bytes

mdr address-expression,bytes

mds [ address-expression [ line-count [output-radix ] ] ]

mm address-expression new-contents

mmW address-expression new-contents

DESCRIPTION

The md command is used to display the contents of memory. The address-expression may be a numeric value (decimal or hexidecimal), a symbol name, a register name preceeded by one or more percent symbols '%', an environment variable name preceeded by a currency symbol '$', or a simple expression consisting of a symbol name, an addition or subtraction character and a numeric value (decimal or hexidecimal).

If an address is specified and the line-count or radix arguments are omitted, they default to the values of the MDCOUNT and RADIX environment variables respectively. If the MDCOUNT or RADIX environment variables are unset, the appropriate defaults will be used [see ENVIRONMENT below]. If no address is specified then md resumes after the last address printed, using the previous values of count and radix. The start address is rounded down to a multiple of the BYTESPERWORD (md) or width (mdW).

md uses the current value of environment variable BYTESPERWORD to read the data. When reading hardware registers that require special widths, it is more convenient to use mdWcn where W is the width for this command and cn is the number of entries to read. For example, md1c20 reads 20 bytes, 1 at a time. To continue printing just type md, the width and count apply to following md commands with no parameters. Note: The count is the number of repeats of the width, unlike MDCOUNT which gives the number of md lines to print.

The mdp command displays the contents of physical memory, starting at the specified physical address for the specified number of bytes. The address is preceded by 'phys'.

The mdr command displays the raw contents of memory, starting at the specified address for the specified number of bytes. The data is printed in one line without a leading address and no trailing character conversion. mdr is intended for interfacing with external debuggers, it is of little use to humans.

The mds command displays the contents of memory one word per line and attempts to correlate the contents of each word with a symbol in the symbol table. If no symbol is found, the ascii representation of the word is printed, otherwise the symbol name and offset from symbol value are printed. By default the section data is printed for kernel symbols.

The mm and mmW commands allow modification of memory. The bytes at the address represented by address-expression are changed to new-contents. new-contents is allowed to be an address-expression. mm changes a machine word, mmW changes W bytes at that address.

LIMITATIONS

None.

ENVIRONMENT

MDCOUNT
This environment variable (default=8) defines the number of lines that will be displayed by each invocation of the md command.

RADIX
This environment variable (default=16) defines the radix used to print the memory contents.

BYTESPERWORD
This environment variable (default=4) selects the width of output data when printing memory contents. Select the value two to get 16-bit word output, select the value one to get byte output.

LINES
This environment variable governs the number of lines of output that will be presented before the kernel debugger built-in pager pauses the output. This variable only affects the functioning of the md and mds if the MDCOUNT variable is set to a value greater than the LINES variable.

NOSECT
If the NOSECT environment variable is non-zero then the section information is suppressed. The default is NOSECT=1 so section data is suppressed; use set NOSECT=0 to see section information.

SMP CONSIDERATIONS

None.

EXAMPLES

md %edx
Display memory starting at the address contained in register %edx.

mds %esp
Display stack contents symbolically. This command is quite useful in manual stack traceback.

mm 0xc0252110 0x25
Change the memory location at 0xc0252110 to the value 0x25.

md chrdev_table 15
Display 15 lines (at 16 bytes per line) starting at address represented by the symbol chrdev_table.