Skip to content

Commit 8ef5bf2

Browse files
authored
Merge pull request #1551 from JDevlieghere/🍒/apple/stable/20200714/0b339c069266b7a4f3c82f80067d74620cbe19c4
[lldb] Inform every language runtime of the modified modules
2 parents 1f7d5a8 + 1f24b48 commit 8ef5bf2

File tree

1 file changed

+12
-28
lines changed

1 file changed

+12
-28
lines changed

‎lldb/source/Target/Process.cpp

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5757,49 +5757,33 @@ addr_t Process::ResolveIndirectFunction(const Address *address, Status &error) {
57575757
}
57585758

57595759
void Process::ModulesDidLoad(ModuleList &module_list) {
5760+
// Inform the system runtime of the modified modules.
57605761
SystemRuntime *sys_runtime = GetSystemRuntime();
5761-
if (sys_runtime) {
5762+
if (sys_runtime)
57625763
sys_runtime->ModulesDidLoad(module_list);
5763-
}
57645764

57655765
GetJITLoaders().ModulesDidLoad(module_list);
57665766

5767-
// Give runtimes a chance to be created.
5767+
// Give the instrumentation runtimes a chance to be created before informing
5768+
// them of the modified modules.
57685769
InstrumentationRuntime::ModulesDidLoad(module_list, this,
57695770
m_instrumentation_runtimes);
5771+
for (auto &runtime : m_instrumentation_runtimes)
5772+
runtime.second->ModulesDidLoad(module_list);
57705773

5771-
// Tell runtimes about new modules.
5772-
for (auto pos = m_instrumentation_runtimes.begin();
5773-
pos != m_instrumentation_runtimes.end(); ++pos) {
5774-
InstrumentationRuntimeSP runtime = pos->second;
5775-
runtime->ModulesDidLoad(module_list);
5776-
}
5777-
5778-
// Let any language runtimes we have already created know about the modules
5779-
// that loaded.
5780-
5781-
// Iterate over a copy of this language runtime list in case the language
5782-
// runtime ModulesDidLoad somehow causes the language runtime to be
5783-
// unloaded.
5784-
{
5785-
std::lock_guard<std::recursive_mutex> guard(m_language_runtimes_mutex);
5786-
LanguageRuntimeCollection language_runtimes(m_language_runtimes);
5787-
for (const auto &pair : language_runtimes) {
5788-
// We must check language_runtime_sp to make sure it is not nullptr as we
5789-
// might cache the fact that we didn't have a language runtime for a
5790-
// language.
5791-
LanguageRuntimeSP language_runtime_sp = pair.second;
5792-
if (language_runtime_sp)
5793-
language_runtime_sp->ModulesDidLoad(module_list);
5794-
}
5774+
// Give the language runtimes a chance to be created before informing them of
5775+
// the modified modules.
5776+
for (const lldb::LanguageType lang_type : Language::GetSupportedLanguages()) {
5777+
if (LanguageRuntime *runtime = GetLanguageRuntime(lang_type))
5778+
runtime->ModulesDidLoad(module_list);
57955779
}
57965780

57975781
// If we don't have an operating system plug-in, try to load one since
57985782
// loading shared libraries might cause a new one to try and load
57995783
if (!m_os_up)
58005784
LoadOperatingSystemPlugin(false);
58015785

5802-
// Give structured-data plugins a chance to see the modified modules.
5786+
// Inform the structured-data plugins of the modified modules.
58035787
for (auto pair : m_structured_data_plugin_map) {
58045788
if (pair.second)
58055789
pair.second->ModulesDidLoad(*this, module_list);

0 commit comments

Comments
 (0)