[lldb] [llvm] [LLDB][Minidump] Make workaround for the Dynamic loader issue (PR #120166)

Pavel Labath via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 23 04:56:12 PST 2024


================
@@ -354,6 +354,39 @@ DataExtractor ProcessMinidump::GetAuxvData() {
                        GetAddressByteSize(), GetAddressByteSize());
 }
 
+bool ProcessMinidump::IsLLDBMinidump() {
+  // If we've already checked, return the cached value
+  if (m_is_lldb_generated.has_value())
+    return *m_is_lldb_generated;
+
+  // If the minidump doesn't have a LLDBGeneratedStream, it's not an LLDB
+  // We also check to see if the section was generated correctly, but not
+  // enforcing an exact size so we can change it in the future without
+  // impacting older generated Minidumps.
+  llvm::ArrayRef<uint8_t> lldbStream =
+      m_minidump_parser->GetStream(StreamType::LLDBGenerated);
+  if (lldbStream.empty() || lldbStream.size() <= sizeof(StreamType)) {
+    m_is_lldb_generated = false;
+    return false;
+  }
+
+  const uint32_t *lldbStreamType =
+      reinterpret_cast<const uint32_t *>(lldbStream.data());
----------------
labath wrote:

```suggestion
  uint32_t lldbStreamType = llvm::support::endian::read<uint32_t, llvm::endianness::little>(lldbStream.data());
```

We only support little-endian minidumps right now, but it'd be nice if they could be read on a system of any endianness. I'm also not sure if this is guaranteed to be aligned.

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


More information about the llvm-commits mailing list