================ @@ -82,15 +82,24 @@ class MinidumpFile : public Binary { return getListStream<minidump::Thread>(minidump::StreamType::ThreadList); } - /// Returns the contents of the Exception stream. An error is returned if the - /// file does not contain this stream, or the stream is smaller than the size - /// of the ExceptionStream structure. The internal consistency of the stream - /// is not checked in any way. - Expected<const minidump::ExceptionStream &> getExceptionStream() const { - return getStream<minidump::ExceptionStream>( - minidump::StreamType::Exception); + /// Returns the contents of the Exception stream. An error is returned if the + /// associated stream is smaller than the size of the ExceptionStream + /// structure. Or the directory supplied is not of kind exception stream. + Expected<minidump::ExceptionStream> + getExceptionStream(minidump::Directory Directory) const { + if (Directory.Type != minidump::StreamType::Exception) { + return createError("Not an exception stream"); + } + + return getStreamFromDirectory<minidump::ExceptionStream>(Directory); } + /// Returns the contents of the Exception streams. An error is returned if + /// any of the streams are smaller than the size of the ExceptionStream + /// structure. The internal consistency of the stream is not checked in any + /// way. + Expected<std::vector<minidump::ExceptionStream>> getExceptionStreams() const; ---------------- jeffreytan81 wrote:
Should this API return `Expected<>` instead of `std::option<>`? It seems perfect expected that a minidump does not have any exceptions. 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