Skip Navigation Links | |
Exit Print View | |
Oracle Solaris Modular Debugger Guide Oracle Solaris 11.1 Information Library |
Scoping Within User-Level Applications and Shared Libraries
Using the Scoping Operator With a Kernel Module
Dcmd and Walker Name Resolution
4. Using MDB Commands Interactively
9. Debugging With the Kernel Memory Allocator
The /, \, ?, and = metacharacters are used to denote the special output formatting dcmds. Each of these dcmds accepts an argument list consisting of one or more format characters, repeat counts, or quoted strings. A format character is one of the ASCII characters described below.
Format characters are used to read and format data from the target. A repeat count is a positive integer preceding the format character that is always interpreted in base 10 (decimal). A repeat count can also be specified as an expression enclosed in square brackets preceded by a dollar sign ($[expr]). A string argument must be enclosed in double quotation marks ("str"). No blanks are necessary between format arguments.
The formatting dcmds are:
Display data from the target's virtual address space starting at the virtual address specified by dot.
Display data from the target's physical address space starting at the physical address specified by dot.
Display data from the target's primary object file starting at the object file location corresponding to the virtual address specified by dot.
Display the value of dot in each of the specified data formats. The = dcmd is useful for converting between bases and performing arithmetic.
In addition to dot, MDB keeps track of another global value called the increment. The increment represents the distance between dot and the address following all the data read by the last formatting dcmd.
For example, let dot equal address addr, where addr displays as a 4-byte integer. After a formatting dcmd is executed with dot equal to addr, the increment is set to 4. The plus (+) operator, described in Arithmetic Expansion, would now evaluate to the value A+4, and could be used to reset dot to the address of the next data object for a subsequent dcmd.
Most format characters increase the value of the increment by the number of bytes corresponding to the size of the data format. The number of bytes in various data formats are shown below. Use the ::formats dcmd to display the list of format characters from within MDB.
The format characters are:
Increment dot by the count (variable size)
Decrement dot by the count (variable size)
Hexadecimal int (1 byte)
Character using C character notation (1 byte)
Decimal signed int (4 bytes)
Decimal unsigned long long (8 bytes)
Double (8 bytes)
Octal unsigned long long (8 bytes)
Swap bytes and shorts (4 bytes)
Address and disassembled instruction (variable size)
Hexadecimal long long (8 bytes)
Hexadecimal uintptr_t (4 or 8 bytes)
Newline
Octal unsigned int (4 bytes)
Symbol (4 or 8 bytes)
Octal signed int (4 bytes)
Binary int (8 bytes)
String using C string notation (variable size)
Horizontal tab
Decimal unsigned int (4 bytes)
Decimal unsigned int (1 byte)
Default radix unsigned int (4 bytes)
Hexadecimal int (4 bytes)
Decoded time32_t (4 bytes)
Hexadecimal long long (8 bytes)
Decrement dot by increment * count (variable size)
Dot as symbol+offset
Octal unsigned int (1 byte)
Character (1 byte)
Decimal signed short (2 bytes)
Decimal signed long long (8 bytes)
Float (4 bytes)
Octal signed long long (8 bytes)
Swap bytes (2 bytes)
Disassembled instruction (variable size)
Newline
Octal unsigned short (2 bytes)
Symbol (4 or 8 bytes)
Octal signed short (2 bytes)
Whitespace
Raw string (variable size)
Horizontal tab
Decimal unsigned short (2 bytes)
Decimal signed int (1 byte)
Default radix unsigned short (2 bytes)
Hexadecimal short (2 bytes)
Decoded time64_t (8 bytes)
You can also use the /, \, and ? formatting dcmds to write to the target's virtual address space, physical address space, or object file. First, specify one of the following modifiers as the first format character, and then specify a list of words. The words in the list are either immediate values or expressions enclosed in square brackets preceded by a dollar sign ($[expr]).
The write modifiers are:
Write the lowest byte of the value of each expression to the target beginning at the location specified by dot
Write the lowest 2 bytes of the value of each expression to the target beginning at the location specified by dot
Write the lowest 4 bytes of the value of each expression to the target beginning at the location specified by dot
Write the complete 8 bytes of the value of each expression to the target beginning at the location specified by dot
You can also use the /, \, and ? formatting dcmds to search for a particular integer value in the target's virtual address space, physical address space, and object file, respectively. First specify one of the following modifiers as the first format character, and then specify a value and optional mask. The value and mask are each either immediate values or expressions enclosed in square brackets preceded by a dollar sign.
If only a value is specified, MDB reads integers of the appropriate size and stops at the address that contains the matching value. If a value V and mask M are specified, MDB reads integers of the appropriate size and stops at the address that contains a value X where (X & M) == V. At the completion of the dcmd, dot is updated to the address of the match. If no match is found, dot is left at the last address that was read.
The search modifiers are:
Search for the specified 2-byte value
Search for the specified 4-byte value
Search for the specified 8-byte value
For both user and kernel targets, an address space is typically composed of a set of discontiguous segments. It is not legal to read from an address that does not have a corresponding segment. If a search reaches a segment boundary without finding a match, the search aborts when the read past the end of the segment boundary fails.