[Lldb-commits] [lldb] [llvm] [LLDB][Minidump] Support minidumps where there are multiple exception streams (PR #97470)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Jul 5 11:37:13 PDT 2024
================
@@ -53,6 +54,31 @@ Expected<std::string> MinidumpFile::getString(size_t Offset) const {
return Result;
}
+Expected<std::vector<minidump::ExceptionStream>>
+MinidumpFile::getExceptionStreams() const {
+ // Scan the directories for exceptions first
+ std::vector<Directory> exceptionStreams;
+ for (const auto &directory : Streams) {
+ if (directory.Type == StreamType::Exception)
+ exceptionStreams.push_back(directory);
+ }
+
+ if (exceptionStreams.empty())
+ return createError("No exception streams found");
+
+ std::vector<minidump::ExceptionStream> exceptionStreamList;
+ for (const auto &exceptionStream : exceptionStreams) {
+ llvm::Expected<minidump::ExceptionStream> ExpectedStream =
+ getStreamFromDirectory<minidump::ExceptionStream>(exceptionStream);
+ if (!ExpectedStream)
+ return ExpectedStream.takeError();
+
+ exceptionStreamList.push_back(ExpectedStream.get());
----------------
jeffreytan81 wrote:
`minidump::ExceptionStream` is non-trivial in size. There are a lot of copying here which I do not think you need.
The ownership of `minidump::ExceptionStream` is still inside the stream, so let's return reference/pointer from these functions instead of copying by value.
https://github.com/llvm/llvm-project/pull/97470
More information about the lldb-commits
mailing list