================
@@ -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)) {
----------------
labath wrote:

```suggestion
  if (lldbStream.size() < sizeof(StreamType)) {
```
`empty` is subsumed by the size check, and I think you need a strict comparison 
here.

https://github.com/llvm/llvm-project/pull/120166
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to