================ @@ -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 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits