[PATCH] D26405: Add the ability to dump hex bytes with optional offsets and ASCII bytes.

Greg Clayton via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 8 09:43:16 PST 2016


clayborg created this revision.
clayborg added reviewers: zturner, mehdi_amini, lhames, llvm-commits.
clayborg set the repository for this revision to rL LLVM.

There are sure to be many places where a buffer of bytes need to be dumped in LLVM. This change allows users to quickly dump a buffer of bytes with optional offset prefix and ASCII display:

Example output for raw hex bytes:
55 48 89 e5 48 81 ec 70 04 00 00 48 8d 05 10 02
00 00 4c 8d 05 fd 01 00 00 4c 8b 0d d0 02 00 00

Example output for raw hex bytes with ASCII:
55 48 89 e5 48 81 ec 70 04 00 00 48 8d 05 10 02  UH.?H.?p...H....
00 00 4c 8d 05 fd 01 00 00 4c 8b 0d d0 02 00 00  ..L..?...L..?...

Example output for raw hex bytes with ASCII and offsets/addresses:
0x100000d10: 55 48 89 e5 48 81 ec 70 04 00 00 48 8d 05 10 02  UH.?H.?p...H....
0x100000d20: 00 00 4c 8d 05 fd 01 00 00 4c 8b 0d d0 02 00 00  ..L..?...L..?...

Added unit tests as well.


Repository:
  rL LLVM

https://reviews.llvm.org/D26405

Files:
  include/llvm/Support/Format.h
  include/llvm/Support/raw_ostream.h
  lib/Support/raw_ostream.cpp
  unittests/Support/NativeFormatTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26405.77207.patch
Type: text/x-patch
Size: 9945 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161108/984609b0/attachment.bin>


More information about the llvm-commits mailing list