[lldb] [llvm] [LLDB][Minidump] Support minidumps where there are multiple exception streams (PR #97470)

Jacob Lalonde via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 8 14:56:45 PDT 2024


================
@@ -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;
----------------
Jlalond wrote:

I decided against this for Minidump.h because the existing API's expose `Expected`, for the Minidumparser I used optional upon your recommendation

https://github.com/llvm/llvm-project/pull/97470


More information about the llvm-commits mailing list