aboutsummaryrefslogtreecommitdiff
path: root/util/hexdump.c
AgeCommit message (Collapse)AuthorFilesLines
2024-06-05util/hexdump: Inline g_string_append_printf "%02x"Richard Henderson1-1/+11
Trivial arithmetic can be used for emitting the nibbles, rather than full-blown printf formatting. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20240412073346.458116-6-richard.henderson@linaro.org>
2024-06-05util/hexdump: Add unit_len and block_len to qemu_hexdump_lineRichard Henderson1-9/+21
Generalize the current 1 byte unit and 4 byte blocking within the output. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20240412073346.458116-5-richard.henderson@linaro.org>
2024-06-05util/hexdump: Use a GString for qemu_hexdump_lineRichard Henderson1-11/+16
Allocate a new, or append to an existing GString instead of using a fixed sized buffer. Require the caller to determine the length of the line -- do not bound len here. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20240412073346.458116-4-richard.henderson@linaro.org>
2024-06-04util/hexdump: Remove ascii parameter from qemu_hexdump_lineRichard Henderson1-22/+30
Split out asciidump_line as a separate function, local to hexdump.c, for use by qemu_hexdump. Use "%-*s" to generate the alignment between the hex and the ascii, rather than explicit spaces. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240412073346.458116-3-richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-06-04util/hexdump: Remove b parameter from qemu_hexdump_lineRichard Henderson1-7/+6
Require that the caller output the offset and increment bufptr. Use QEMU_HEXDUMP_LINE_BYTES in vhost_vdpa_dump_config instead of raw integer. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240412073346.458116-2-richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2022-04-06include: move C/util-related declarations to cutils.hMarc-André Lureau1-1/+1
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220323155743.1585078-22-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-29util/hexdump: introduce qemu_hexdump_line()Laurent Vivier1-20/+34
Dumping one line of hexadecimal/ASCII from a buffer is often needed. Move this part from qemu_hexdump() and use it Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Laurent Vivier <lvivier@redhat.com> Message-Id: <20200925091055.186023-2-lvivier@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2020-09-11util/hexdump: Reorder qemu_hexdump() argumentsPhilippe Mathieu-Daudé1-2/+2
qemu_hexdump()'s pointer to the buffer and length of the buffer are closely related arguments but are widely separated in the argument list order (also, the format of <stdio.h> function prototypes is usually to have the FILE* argument coming first). Reorder the arguments as "fp, prefix, buf, size" which is more logical. Suggested-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20200822180950.1343963-3-f4bug@amsat.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-09-11util/hexdump: Convert to take a void pointer argumentPhilippe Mathieu-Daudé1-1/+3
Most uses of qemu_hexdump() do not take an array of char as input, forcing use of cast. Since we can use this helper to dump any kind of buffer, use a pointer to void argument instead. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by: Li Qiang <liq3ea@gmail.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20200822180950.1343963-2-f4bug@amsat.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2016-04-06util: Improved qemu_hexmap() to include an ascii dump of the bufferIsaac Lozano1-11/+22
qemu_hexdump() in util/hexdump.c has been changed to give also include a ascii dump of the buffer. Also, calls to hex_dump() in net/net.c have been replaced with calls to qemu_hexdump(). This takes care of two misc BiteSized Tasks. Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Isaac Lozano <109lozanoi@gmail.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
2016-02-04util: Clean up includesPeter Maydell1-0/+1
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1454089805-5470-6-git-send-email-peter.maydell@linaro.org
2013-05-20Rename hexdump to avoid FreeBSD libutil conflictEd Maste1-1/+1
On FreeBSD libutil is used for openpty(), but it also provides a hexdump() which conflicts with QEMU's. Signed-off-by: Ed Maste <emaste@freebsd.org> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1368718348-15199-1-git-send-email-emaste@freebsd.org Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-03-15iov: Factor out hexdumperPeter Crosthwaite1-0/+37
Factor out the hexdumper functionality from iov for all to use. Useful for creating verbose debug printfery that dumps packet data. Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Message-id: faaac219c55ea586d3f748befaf5a2788fd271b8.1361853677.git.peter.crosthwaite@xilinx.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>