================ @@ -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; + valid_modules.push_back({mod, module_name, *maybe_mod_size}); ---------------- Jlalond wrote:
Aren't these properties of the module? Can't we emit a llvm::Minidump::Module into the vector instead of making a custom struct? https://github.com/llvm/llvm-project/pull/152009 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits