@@ -794,25 +794,23 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(
794
794
module_spec.GetArchitecture () = target.GetArchitecture ();
795
795
796
796
// For the kernel, we really do need an on-disk file copy of the binary
797
- // to do anything useful. This will force a clal to
797
+ // to do anything useful. This will force a call to dsymForUUID if it
798
+ // exists, instead of depending on the DebugSymbols preferences being
799
+ // set.
798
800
if (IsKernel ()) {
799
801
if (Symbols::DownloadObjectAndSymbolFile (module_spec, true )) {
800
802
if (FileSystem::Instance ().Exists (module_spec.GetFileSpec ())) {
801
803
m_module_sp = std::make_shared<Module>(module_spec.GetFileSpec (),
802
804
target.GetArchitecture ());
803
- if (m_module_sp.get () &&
804
- m_module_sp->MatchesModuleSpec (module_spec)) {
805
- ModuleList loaded_module_list;
806
- loaded_module_list.Append (m_module_sp);
807
- target.ModulesDidLoad (loaded_module_list);
808
- }
809
805
}
810
806
}
811
807
}
812
808
813
809
// If the current platform is PlatformDarwinKernel, create a ModuleSpec
814
810
// with the filename set to be the bundle ID for this kext, e.g.
815
811
// "com.apple.filesystems.msdosfs", and ask the platform to find it.
812
+ // PlatformDarwinKernel does a special scan for kexts on the local
813
+ // system.
816
814
PlatformSP platform_sp (target.GetPlatform ());
817
815
if (!m_module_sp && platform_sp) {
818
816
ConstString platform_name (platform_sp->GetPluginName ());
@@ -821,7 +819,7 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(
821
819
if (platform_name == g_platform_name) {
822
820
ModuleSpec kext_bundle_module_spec (module_spec);
823
821
FileSpec kext_filespec (m_name.c_str ());
824
- FileSpecList search_paths = target.GetExecutableSearchPaths ();
822
+ FileSpecList search_paths = target.GetExecutableSearchPaths ();
825
823
kext_bundle_module_spec.GetFileSpec () = kext_filespec;
826
824
platform_sp->GetSharedModule (kext_bundle_module_spec, process,
827
825
m_module_sp, &search_paths, nullptr ,
@@ -852,7 +850,7 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(
852
850
// UUIDs
853
851
if (m_module_sp) {
854
852
if (m_uuid.IsValid () && m_module_sp->GetUUID () == m_uuid) {
855
- target.GetImages ().AppendIfNeeded (m_module_sp);
853
+ target.GetImages ().AppendIfNeeded (m_module_sp, false );
856
854
if (IsKernel () &&
857
855
target.GetExecutableModulePointer () != m_module_sp.get ()) {
858
856
target.SetExecutableModule (m_module_sp, eLoadDependentsNo);
@@ -951,6 +949,15 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(
951
949
s->Flush ();
952
950
}
953
951
}
952
+
953
+ // Notify the target about the module being added;
954
+ // set breakpoints, load dSYM scripts, etc. as needed.
955
+ if (is_loaded && m_module_sp) {
956
+ ModuleList loaded_module_list;
957
+ loaded_module_list.Append (m_module_sp);
958
+ target.ModulesDidLoad (loaded_module_list);
959
+ }
960
+
954
961
return is_loaded;
955
962
}
956
963
0 commit comments