[Lldb-commits] [lldb] [Minidump] Update Minidump file builder to continue when the Module's section cannot be found (PR #152009)
Jacob Lalonde via lldb-commits
lldb-commits at lists.llvm.org
Mon Aug 4 11:45:32 PDT 2025
================
@@ -308,40 +308,57 @@ Status MinidumpFileBuilder::AddModuleList() {
// the llvm::minidump::Module's structures into helper data
size_t size_before = GetCurrentDataEndOffset();
- // This is the size of the main part of the ModuleList stream.
- // It consists of a module number and corresponding number of
- // structs describing individual modules
- size_t module_stream_size =
- sizeof(llvm::support::ulittle32_t) + modules_count * minidump_module_size;
-
- // Adding directory describing this stream.
- error = AddDirectory(StreamType::ModuleList, module_stream_size);
- if (error.Fail())
- return error;
-
- m_data.AppendData(&modules_count, sizeof(llvm::support::ulittle32_t));
-
// Temporary storage for the helper data (of variable length)
// as these cannot be dumped to m_data before dumping entire
// array of module structures.
DataBufferHeap helper_data;
+ // Struct to hold module information.
+ struct ValidModuleInfo {
+ ModuleSP module;
+ std::string module_name;
+ uint64_t module_size;
+ };
+
+ // Vector to store modules that pass validation.
+ std::vector<ValidModuleInfo> valid_modules;
+
+ // Track the count of successfully processed modules and log errors.
+ uint32_t successful_modules_count = 0;
for (size_t i = 0; i < modules_count; ++i) {
ModuleSP mod = modules.GetModuleAtIndex(i);
std::string module_name = mod->GetSpecificationDescription();
auto maybe_mod_size = getModuleFileSize(target, mod);
if (!maybe_mod_size) {
llvm::Error mod_size_err = maybe_mod_size.takeError();
- llvm::handleAllErrors(std::move(mod_size_err),
- [&](const llvm::ErrorInfoBase &E) {
- error = Status::FromErrorStringWithFormat(
- "Unable to get the size of module %s: %s.",
- module_name.c_str(), E.message().c_str());
- });
- return error;
+ Log *log = GetLog(LLDBLog::Object);
+ llvm::handleAllErrors(
+ std::move(mod_size_err), [&](const llvm::ErrorInfoBase &E) {
+ if (log) {
+ LLDB_LOGF(log, "Unable to get the size of module %s: %s",
+ module_name.c_str(), E.message().c_str());
+ }
+ });
+ continue;
}
+ ++successful_modules_count;
----------------
Jlalond wrote:
Do you still need this variable? Can we just take the vector count
https://github.com/llvm/llvm-project/pull/152009
More information about the lldb-commits
mailing list