mdb_dumpptr
() and mdb_dump64
() Functions
int mdb_dumpptr(uintptr_t addr, size_t nbytes, uint_t flags, mdb_dumpptr_cb_t func, void *data); int mdb_dump64(uint64_t addr, uint64_t nbytes, uint_t flags, mdb_dump64_cb_t func, void *data);
These functions can be used to generate formatted hexadecimal and ASCII data dumps that are printed to standard output. Each function accepts an addr
parameter specifying the starting location, a nbytes
parameter specifying the number of bytes to display, a set of flags described below, a func callback function to use to read the data to display, and a data parameter that is passed to each invocation of the callback func as its last argument. The functions are identical in every regard except that mdb_dumpptr
uses uintptr_t
for its address parameters and mdb_dump64
uses uint64_t
. This distinction is useful when combining mdb_dump64
with mdb_pread
, for example. The built-in ::dump
dcmd uses these functions to perform its data display.
The flags parameter should be the bitwise OR of one or more of the following values:
-
MDB_DUMP_RELATIVE
-
Number lines relative to the start address instead of with the explicit address of each line.
-
MDB_DUMP_ALIGN
-
Align the output at a paragraph boundary.
-
MDB_DUMP_PEDANT
-
Display full-width addresses instead of truncating the address to fit the output in 80 columns.
-
MDB_DUMP_ASCII
-
Display ASCII values next to the hexadecimal data.
-
MDB_DUMP_HEADER
-
Display a header line about the data.
-
MDB_DUMP_TRIM
-
Only read from and display the contents of the specified addresses, instead of reading and printing entire lines.
-
MDB_DUMP_SQUISH
-
Elide repeated lines by placing a "*" on a line that is a repeat of the previous line.
-
MDB_DUMP_NEWDOT
-
Update the value of dot to the address beyond the last address read by the function.
-
MDB_DUMP_ENDIAN
-
Adjust for endianness. This option assumes that the word size is equal to the current group size, specified by
MDB_DUMP_GROUP
(). This option will always turn off alignment, headers, and ASCII display to avoid confusing output. IfMDB_DUMP_TRIM
is set withMDB_DUMP_ENDIAN
, the number of bytes dumped will be rounded down to the nearest word size bytes. -
MDB_DUMP_WIDTH(
width)
-
Increase the number of 16-byte paragraphs per line that are displayed. The default value of width is one, and the maximum value is 16.
-
MDB_DUMP_GROUP(
group)
-
Set the byte group size to group. The default group size is four bytes. The group size must be a power of two that divides the line width.