@@ -5757,49 +5757,33 @@ addr_t Process::ResolveIndirectFunction(const Address *address, Status &error) {
5757
5757
}
5758
5758
5759
5759
void Process::ModulesDidLoad (ModuleList &module_list) {
5760
+ // Inform the system runtime of the modified modules.
5760
5761
SystemRuntime *sys_runtime = GetSystemRuntime ();
5761
- if (sys_runtime) {
5762
+ if (sys_runtime)
5762
5763
sys_runtime->ModulesDidLoad (module_list);
5763
- }
5764
5764
5765
5765
GetJITLoaders ().ModulesDidLoad (module_list);
5766
5766
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.
5768
5769
InstrumentationRuntime::ModulesDidLoad (module_list, this ,
5769
5770
m_instrumentation_runtimes);
5771
+ for (auto &runtime : m_instrumentation_runtimes)
5772
+ runtime.second ->ModulesDidLoad (module_list);
5770
5773
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);
5795
5779
}
5796
5780
5797
5781
// If we don't have an operating system plug-in, try to load one since
5798
5782
// loading shared libraries might cause a new one to try and load
5799
5783
if (!m_os_up)
5800
5784
LoadOperatingSystemPlugin (false );
5801
5785
5802
- // Give structured-data plugins a chance to see the modified modules.
5786
+ // Inform the structured-data plugins of the modified modules.
5803
5787
for (auto pair : m_structured_data_plugin_map) {
5804
5788
if (pair.second )
5805
5789
pair.second ->ModulesDidLoad (*this , module_list);
0 commit comments