summaryrefslogtreecommitdiff
path: root/lib/Support/ScopedPrinter.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-04-28 00:43:38 +0000
committerZachary Turner <zturner@google.com>2017-04-28 00:43:38 +0000
commita102628313675d0671f30fbbbcb02dbbab2cdb9d (patch)
treeb8862ca0c1f37aef20d9fbe1343fb72fcdb3bf2e /lib/Support/ScopedPrinter.cpp
parent4275ee9fcbb1c8f95f65f29b5d6aee6c192345ea (diff)
[llvm-pdbdump] Allow printing only a portion of a stream.
When dumping raw data from a stream, you might know the offset of a certain record you're interested in, as well as how long that record is. Previously, you had to dump the entire stream and wade through the bytes to find the interesting record. This patch allows you to specify an offset and length on the command line, and it will only dump the requested range. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301607 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/ScopedPrinter.cpp')
-rw-r--r--lib/Support/ScopedPrinter.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Support/ScopedPrinter.cpp b/lib/Support/ScopedPrinter.cpp
index d8ee1efd8f3..537ff62c7b0 100644
--- a/lib/Support/ScopedPrinter.cpp
+++ b/lib/Support/ScopedPrinter.cpp
@@ -21,7 +21,8 @@ const std::string to_hexString(uint64_t Value, bool UpperCase) {
}
void ScopedPrinter::printBinaryImpl(StringRef Label, StringRef Str,
- ArrayRef<uint8_t> Data, bool Block) {
+ ArrayRef<uint8_t> Data, bool Block,
+ uint32_t StartOffset) {
if (Data.size() > 16)
Block = true;
@@ -31,7 +32,8 @@ void ScopedPrinter::printBinaryImpl(StringRef Label, StringRef Str,
OS << ": " << Str;
OS << " (\n";
if (!Data.empty())
- OS << format_bytes_with_ascii(Data, 0, 16, 4, (IndentLevel + 1) * 2, true)
+ OS << format_bytes_with_ascii(Data, StartOffset, 16, 4,
+ (IndentLevel + 1) * 2, true)
<< "\n";
startLine() << ")\n";
} else {