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