///
/// \param[in] module_sp
/// A shared pointer to a module to replace in this collection.
- void ReplaceEquivalent(const lldb::ModuleSP &module_sp);
+ ///
+ /// \param[in] old_modules
+ /// Optional pointer to a vector which, if provided, will have shared
+ /// pointers to the replaced module(s) appended to it.
+ void ReplaceEquivalent(
+ const lldb::ModuleSP &module_sp,
+ llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules = nullptr);
/// Append a module to the module list, if it is not already there.
///
AppendImpl(module_sp, notify);
}
-void ModuleList::ReplaceEquivalent(const ModuleSP &module_sp) {
+void ModuleList::ReplaceEquivalent(
+ const ModuleSP &module_sp,
+ llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules) {
if (module_sp) {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
size_t idx = 0;
while (idx < m_modules.size()) {
- ModuleSP module_sp(m_modules[idx]);
- if (module_sp->MatchesModuleSpec(equivalent_module_spec))
+ ModuleSP test_module_sp(m_modules[idx]);
+ if (test_module_sp->MatchesModuleSpec(equivalent_module_spec)) {
+ if (old_modules)
+ old_modules->push_back(test_module_sp);
RemoveImpl(m_modules.begin() + idx);
- else
+ } else {
++idx;
+ }
}
// Now add the new module to the list
Append(module_sp);
*did_create_ptr = true;
}
- shared_module_list.ReplaceEquivalent(module_sp);
+ shared_module_list.ReplaceEquivalent(module_sp, old_modules);
return error;
}
}
if (did_create_ptr)
*did_create_ptr = true;
- shared_module_list.ReplaceEquivalent(module_sp);
+ shared_module_list.ReplaceEquivalent(module_sp, old_modules);
return Status();
}
}
if (did_create_ptr)
*did_create_ptr = true;
- shared_module_list.ReplaceEquivalent(module_sp);
+ shared_module_list.ReplaceEquivalent(module_sp, old_modules);
}
} else {
located_binary_modulespec.GetFileSpec().GetPath(path, sizeof(path));
os.path.normcase(module.GetFileSpec().dirname or ""))
self.assertEqual(verify_uuid, module.GetUUIDString())
- def get_minidump_modules(self, yaml_file):
+ def get_minidump_modules(self, yaml_file, exe = None):
minidump_path = self.getBuildArtifact(os.path.basename(yaml_file) + ".dmp")
self.yaml2obj(yaml_file, minidump_path)
- self.target = self.dbg.CreateTarget(None)
+ self.target = self.dbg.CreateTarget(exe)
self.process = self.target.LoadCore(minidump_path)
return self.target.modules
# will check that this matches.
self.verify_module(modules[0], so_path, "48EB9FD7")
+ def test_breakpad_hash_match_exe_outside_sysroot(self):
+ """
+ Check that we can match the breakpad .text section hash when the
+ module is specified as the exe during launch, and a syroot is
+ provided, which does not contain the exe.
+ """
+ sysroot_path = os.path.join(self.getBuildDir(), "mock_sysroot")
+ lldbutil.mkdir_p(sysroot_path)
+ so_dir = os.path.join(self.getBuildDir(), "binary")
+ so_path = os.path.join(so_dir, "libbreakpad.so")
+ lldbutil.mkdir_p(so_dir)
+ self.yaml2obj("libbreakpad.yaml", so_path)
+ self.runCmd("platform select remote-linux --sysroot '%s'" % sysroot_path)
+ modules = self.get_minidump_modules("linux-arm-breakpad-uuid-match.yaml", so_path)
+ self.assertEqual(1, len(modules))
+ # LLDB makes up its own UUID as well when there is no build ID so we
+ # will check that this matches.
+ self.verify_module(modules[0], so_path, "D9C480E8")
def test_facebook_hash_match(self):
"""