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

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 9 00:09:56 PDT 2024


================
@@ -209,7 +208,23 @@ Status ProcessMinidump::DoLoadCore() {
   GetTarget().SetArchitecture(arch, true /*set_platform*/);
 
   m_thread_list = m_minidump_parser->GetThreads();
-  m_active_exception = m_minidump_parser->GetExceptionStream();
+  auto exception_stream_it = m_minidump_parser->GetExceptionStreams();
+  for (auto exception_stream : exception_stream_it) {
+    // If we can't read an exception stream skip it
+    // We should probably serve a warning
+    if (!exception_stream)
+      continue;
+
+    if (!m_exceptions_by_tid
+             .try_emplace(exception_stream->ThreadId, exception_stream.get())
+             .second) {
+      // We only cast to avoid the warning around converting little endian in
+      // printf.
+      return Status::FromErrorStringWithFormat(
+          "Duplicate exception stream for tid %" PRIu32,
+          (uint32_t)exception_stream->ThreadId);
+    }
----------------
labath wrote:

This wasn't just an idle warning. The cast is actually necessary to make the code correct. But it's even better to use a formatting function that handles this for you.

```suggestion
      return Status::FromErrorStringWithFormatv(
          "Duplicate exception stream for tid {0}",
          exception_stream->ThreadId);
    }
```

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


More information about the lldb-commits mailing list