Handle a LC_NOTE main bin spec for user process corefiles
authorJason Molenda <jason@molenda.com>
Wed, 24 Mar 2021 09:18:17 +0000 (02:18 -0700)
committerJason Molenda <jason@molenda.com>
Wed, 24 Mar 2021 09:18:17 +0000 (02:18 -0700)
I was playing around with main bin spec LC_NOTEs and noticed
a small oversight in the parsing of user process corefile notes.

lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp

index 0f77110..82a946f 100644 (file)
@@ -285,14 +285,16 @@ Status ProcessMachCore::DoLoadCore() {
   ObjectFile::BinaryType type;
   if (core_objfile->GetCorefileMainBinaryInfo(objfile_binary_addr,
                                               objfile_binary_uuid, type)) {
-    if (objfile_binary_addr != LLDB_INVALID_ADDRESS)
-    {
+    if (objfile_binary_addr != LLDB_INVALID_ADDRESS) {
+      if (type == ObjectFile::eBinaryTypeUser)
+        m_dyld_addr = objfile_binary_addr;
+      else
         m_mach_kernel_addr = objfile_binary_addr;
-        found_main_binary_definitively = true;
-        LLDB_LOGF(log,
-                  "ProcessMachCore::DoLoadCore: using kernel address 0x%" PRIx64
-                  " from LC_NOTE 'main bin spec' load command.",
-                  m_mach_kernel_addr);
+      found_main_binary_definitively = true;
+      LLDB_LOGF(log,
+                "ProcessMachCore::DoLoadCore: using kernel address 0x%" PRIx64
+                " from LC_NOTE 'main bin spec' load command.",
+                m_mach_kernel_addr);
     }
   }