================ @@ -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 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits