Extend r356573 (minidump UUID handling) to cover elf build-ids too
authorPavel Labath <pavel@labath.sk>
Fri, 22 Mar 2019 14:03:59 +0000 (14:03 +0000)
committerPavel Labath <pavel@labath.sk>
Fri, 22 Mar 2019 14:03:59 +0000 (14:03 +0000)
Breakpad (but not crashpad) will insert an empty (all-zero) build-id
record for modules which do not have a build-id. This tells lldb to
treat such records as empty/invalid uuids.

llvm-svn: 356751

lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-zero.dmp [new file with mode: 0644]
lldb/source/Plugins/Process/minidump/MinidumpParser.cpp

index 3924955..1e4a983 100644 (file)
@@ -119,3 +119,16 @@ class MiniDumpUUIDTestCase(TestBase):
         self.assertEqual(2, len(modules))
         self.verify_module(modules[0], "/tmp/a", "01020304-0506-0708-090A-0B0C0D0E0F10-11121314")
         self.verify_module(modules[1], "/tmp/b", "0A141E28-323C-4650-5A64-6E78828C96A0-AAB4BEC8")
+
+    def test_uuid_modules_elf_build_id_zero(self):
+        """
+            Test multiple modules having a MINIDUMP_MODULE.CvRecord that is valid,
+            and contains a ELF build ID whose value is all zero.
+        """
+        self.dbg.CreateTarget(None)
+        self.target = self.dbg.GetSelectedTarget()
+        self.process = self.target.LoadCore("linux-arm-uuids-elf-build-id-zero.dmp")
+        modules = self.target.modules
+        self.assertEqual(2, len(modules))
+        self.verify_module(modules[0], "/not/exist/a", None)
+        self.verify_module(modules[1], "/not/exist/b", None)
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-zero.dmp b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-zero.dmp
new file mode 100644 (file)
index 0000000..238c0f9
Binary files /dev/null and b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-zero.dmp differ
index 884d7c9..d18244f 100644 (file)
@@ -204,7 +204,7 @@ UUID MinidumpParser::GetModuleUUID(const MinidumpModule *module) {
     }
     return UUID::fromData(pdb70_uuid->Uuid, sizeof(pdb70_uuid->Uuid));
   } else if (cv_signature == CvSignature::ElfBuildId)
-    return UUID::fromData(cv_record);
+    return UUID::fromOptionalData(cv_record);
 
   return UUID();
 }