Don't set executable file in ObjectFileMachO::LoadCoreFileImages
authorJason Molenda <jason@molenda.com>
Thu, 16 Sep 2021 08:36:56 +0000 (01:36 -0700)
committerJason Molenda <jason@molenda.com>
Thu, 16 Sep 2021 08:38:48 +0000 (01:38 -0700)
When the corefile reader is adding binaries from the "all image
infos" LC_NOTE in a Mach-O corefile, it would detect if the binary
being added was an executable binary and set it as the Target's
executable binary.  This has the side effect of clearing the Target's
image list, so if the executable was in the middle of the all image
infos, the initial images would be dropped.  There's no need to set
the executable binary in the Target for these corefile processes,
so instead of doing multiple passes over the list to find the
executable, I'm dropping that.

lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

index d96b591..99aef04 100644 (file)
@@ -7033,12 +7033,8 @@ bool ObjectFileMachO::LoadCoreFileImages(lldb_private::Process &process) {
                                                    image.load_address);
         }
       }
-      if (module_sp.get() && module_sp->GetObjectFile()) {
+      if (module_sp.get()) {
         added_images = true;
-        if (module_sp->GetObjectFile()->GetType() ==
-            ObjectFile::eTypeExecutable) {
-          process.GetTarget().SetExecutableModule(module_sp, eLoadDependentsNo);
-        }
         for (auto name_vmaddr_tuple : image.segment_load_addresses) {
           SectionList *sectlist = module_sp->GetObjectFile()->GetSectionList();
           if (sectlist) {