nbdkit_debug_hexdump - Man Page

display buffer in hexdump format

Synopsis

 #include <nbdkit-plugin.h>

 void nbdkit_debug_hexdump (const void *buf, size_t len,
                            const char *prefix, uint64_t start);

 void nbdkit_debug_hexdiff (const void *buf1, const void *buf2,
                            size_t len,
                            const char *prefix, uint64_t start);

Description

nbdkit_debug_hexdump displays a buffer of binary data in canonical hexdump format, sending the output to the same place as nbdkit_debug(3).  For example:

 char buf[33] = "12345678123456781234567812345678";
 nbdkit_debug_hexdump (buf, 32, "data: ", 0);

would produce output similar to this:

 data: 00000000: 31 32 33 34 35 36 37 38  31 32 33 34 35 36 37 38  |1234567812345678|
 data: 00000010: 31 32 33 34 35 36 37 38  31 32 33 34 35 36 37 38  |1234567812345678|

An optional prefix may be given which prefixes the string on each line of output.  (This may be NULL or "" for no prefix).

An optional start may be given which changes the first offset displayed in the output.

nbdkit_debug_hexdiff displays the differences between two binary buffers (of the same length).

For rows which are the same in both buffers, the output is the same as above.  For rows which are different it shows the first buffer in the first row (prefixed with -) and the differences in the second buffer in the second row (prefixed with +):

 -00000000: 31 32 33 34 35 36 37 38  31 32 33 34 35 36 37 38  |1234567812345678|
 +00000000:                          39 38 37 36    34 33 32  |        9876 432|

Language Bindings

In nbdkit-ocaml-plugin(3):

 NBDKit.debug_hexdump : NBDKit.buf -> string option -> int64 -> unit
 NBDKit.debug_hexdiff : NBDKit.buf -> NBDKit.buf -> string option ->
                        int64 -> unit

In nbdkit-python-plugin(3):

 import nbdkit
 nbdkit.debug_hexdump(bytes, prefix, start)
 nbdkit.debug_hexdiff(bytes, bytes, prefix, start)

In nbdkit-rust-plugin(3):

 use nbdkit::*;
 debug_hexdump(buf, prefix, start);
 debug_hexdiff(buf1, buf2, prefix, start);

History

nbdkit_debug_hexdump was added in nbdkit 1.46.

nbdkit_debug_hexdiff was added in nbdkit 1.48.

See Also

nbdkit(1), nbdkit_debug(3), nbdkit-plugin(3), nbdkit-filter(3), nbdkit-checkwrite-filter(1), nbdkit-evil-filter(1), nbddump(1), hexdump(1).

Authors

Richard W.M. Jones

License

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Referenced By

NBDKit(3), nbdkit_debug(3), nbdkit-plugin(3), nbdkit-release-notes-1.46(1).

2026-01-02 nbdkit-1.47.1