diff options
author | Pavel Labath <pavel@labath.sk> | 2019-05-02 07:45:42 +0000 |
---|---|---|
committer | Pavel Labath <pavel@labath.sk> | 2019-05-02 07:45:42 +0000 |
commit | cfc4519ef3d7da365b5786c4056823d67e04828a (patch) | |
tree | f8c927b0a4ed9bfef63dcf2db0f84b49f81a258a /llvm/lib/Object/Minidump.cpp | |
parent | da7ae979f8f862ebfd7f059be7a8d65901f843a9 (diff) | |
download | bcm5719-llvm-cfc4519ef3d7da365b5786c4056823d67e04828a.tar.gz bcm5719-llvm-cfc4519ef3d7da365b5786c4056823d67e04828a.zip |
Object/Minidump: Add support for the ThreadList stream
Summary:
The stream contains the list of threads belonging to the process
described by the minidump. Its structure is the same as the ModuleList
stream, and in fact, I have generalized the ModuleList reading code to
handle this stream too.
Reviewers: amccarth, jhenderson, clayborg
Subscribers: llvm-commits, lldb-commits, markmentovai, zturner
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61064
llvm-svn: 359762
Diffstat (limited to 'llvm/lib/Object/Minidump.cpp')
-rw-r--r-- | llvm/lib/Object/Minidump.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/llvm/lib/Object/Minidump.cpp b/llvm/lib/Object/Minidump.cpp index 4b1abe52994..a5de579a627 100644 --- a/llvm/lib/Object/Minidump.cpp +++ b/llvm/lib/Object/Minidump.cpp @@ -53,8 +53,9 @@ Expected<std::string> MinidumpFile::getString(size_t Offset) const { return Result; } -Expected<ArrayRef<Module>> MinidumpFile::getModuleList() const { - auto OptionalStream = getRawStream(StreamType::ModuleList); +template <typename T> +Expected<ArrayRef<T>> MinidumpFile::getListStream(StreamType Stream) const { + auto OptionalStream = getRawStream(Stream); if (!OptionalStream) return createError("No such stream"); auto ExpectedSize = @@ -65,14 +66,18 @@ Expected<ArrayRef<Module>> MinidumpFile::getModuleList() const { size_t ListSize = ExpectedSize.get()[0]; size_t ListOffset = 4; - // Some producers insert additional padding bytes to align the module list to - // 8-byte boundary. Check for that by comparing the module list size with the - // overall stream size. - if (ListOffset + sizeof(Module) * ListSize < OptionalStream->size()) + // Some producers insert additional padding bytes to align the list to an + // 8-byte boundary. Check for that by comparing the list size with the overall + // stream size. + if (ListOffset + sizeof(T) * ListSize < OptionalStream->size()) ListOffset = 8; - return getDataSliceAs<Module>(*OptionalStream, ListOffset, ListSize); + return getDataSliceAs<T>(*OptionalStream, ListOffset, ListSize); } +template Expected<ArrayRef<Module>> + MinidumpFile::getListStream(StreamType) const; +template Expected<ArrayRef<Thread>> + MinidumpFile::getListStream(StreamType) const; Expected<ArrayRef<uint8_t>> MinidumpFile::getDataSlice(ArrayRef<uint8_t> Data, size_t Offset, size_t Size) { |