summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2019-03-20 16:50:17 +0000
committerGreg Clayton <gclayton@apple.com>2019-03-20 16:50:17 +0000
commit621e8b438701e928b4f3ac9044c47925fe0e19f9 (patch)
tree93577931e8a995703e6b18cdbe48f4a91198e354 /lldb/packages/Python/lldbsuite
parenta2250e923b3926471c9dfdf163c4b134b0c2918a (diff)
downloadbcm5719-llvm-621e8b438701e928b4f3ac9044c47925fe0e19f9.tar.gz
bcm5719-llvm-621e8b438701e928b4f3ac9044c47925fe0e19f9.zip
Fix UUID decoding from minidump files
This patch fixes: UUIDs now don't include the age field from a PDB70 when the age is zero. Prior to this they would incorrectly contain the zero age which stopped us from being able to match up the UUID with real files. UUIDs for Apple targets get the first 32 bit value and next two 16 bit values swapped. Breakpad incorrectly swaps these values when it creates darwin minidump files, so this must be undone so we can match up symbol files with the minidump modules. UUIDs that are all zeroes are treated as invalid UUIDs. Breakpad will always save out a UUID, even if one wasn't available. This caused all files that have UUID values of zero to be uniqued to the first module that had a zero UUID. We now don't fill in the UUID if it is all zeroes. Added tests for PDB70 and ELF build ID based CvRecords. Differential Revision: https://reviews.llvm.org/D59433 llvm-svn: 356573
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py121
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-16.dmpbin0 -> 460 bytes
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-20.dmpbin0 -> 468 bytes
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-no-age.dmpbin0 -> 470 bytes
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-with-age.dmpbin0 -> 470 bytes
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-zero-uuids.dmpbin0 -> 534 bytes
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/macos-arm-uuids-no-age.dmpbin0 -> 470 bytes
7 files changed, 121 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
new file mode 100644
index 00000000000..3924955612e
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
@@ -0,0 +1,121 @@
+"""
+Test basics of Minidump debugging.
+"""
+
+from __future__ import print_function
+from six import iteritems
+
+import shutil
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class MiniDumpUUIDTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ NO_DEBUG_INFO_TESTCASE = True
+
+ def setUp(self):
+ super(MiniDumpUUIDTestCase, self).setUp()
+ self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+ def tearDown(self):
+ lldb.DBG.SetSelectedPlatform(self._initial_platform)
+ super(MiniDumpUUIDTestCase, self).tearDown()
+
+ def verify_module(self, module, verify_path, verify_uuid):
+ uuid = module.GetUUIDString()
+ self.assertEqual(verify_path, module.GetFileSpec().fullpath)
+ self.assertEqual(verify_uuid, uuid)
+
+ def test_zero_uuid_modules(self):
+ """
+ Test multiple modules having a MINIDUMP_MODULE.CvRecord that is valid,
+ but contains a PDB70 value whose age is zero and whose UUID values are
+ all zero. Prior to a fix all such modules would be duplicated to the
+ first one since the UUIDs claimed to be valid and all zeroes. Now we
+ ensure that the UUID is not valid for each module and that we have
+ each of the modules in the target after loading the core
+ """
+ self.dbg.CreateTarget(None)
+ self.target = self.dbg.GetSelectedTarget()
+ self.process = self.target.LoadCore("linux-arm-zero-uuids.dmp")
+ modules = self.target.modules
+ self.assertEqual(2, len(modules))
+ self.verify_module(modules[0], "/file/does/not/exist/a", None)
+ self.verify_module(modules[1], "/file/does/not/exist/b", None)
+
+ def test_uuid_modules_no_age(self):
+ """
+ Test multiple modules having a MINIDUMP_MODULE.CvRecord that is valid,
+ and contains a PDB70 value whose age is zero and whose UUID values are
+ valid. Ensure we decode the UUID and don't include the age field in the UUID.
+ """
+ self.dbg.CreateTarget(None)
+ self.target = self.dbg.GetSelectedTarget()
+ self.process = self.target.LoadCore("linux-arm-uuids-no-age.dmp")
+ modules = self.target.modules
+ self.assertEqual(2, len(modules))
+ self.verify_module(modules[0], "/tmp/a", "01020304-0506-0708-090A-0B0C0D0E0F10")
+ self.verify_module(modules[1], "/tmp/b", "0A141E28-323C-4650-5A64-6E78828C96A0")
+
+ def test_uuid_modules_no_age_apple(self):
+ """
+ Test multiple modules having a MINIDUMP_MODULE.CvRecord that is valid,
+ and contains a PDB70 value whose age is zero and whose UUID values are
+ valid. Ensure we decode the UUID and don't include the age field in the UUID.
+ Also ensure that the first uint32_t is byte swapped, along with the next
+ two uint16_t values. Breakpad incorrectly byte swaps these values when it
+ saves Darwin minidump files.
+ """
+ self.dbg.CreateTarget(None)
+ self.target = self.dbg.GetSelectedTarget()
+ self.process = self.target.LoadCore("macos-arm-uuids-no-age.dmp")
+ modules = self.target.modules
+ self.assertEqual(2, len(modules))
+ self.verify_module(modules[0], "/tmp/a", "04030201-0605-0807-090A-0B0C0D0E0F10")
+ self.verify_module(modules[1], "/tmp/b", "281E140A-3C32-5046-5A64-6E78828C96A0")
+
+ def test_uuid_modules_with_age(self):
+ """
+ Test multiple modules having a MINIDUMP_MODULE.CvRecord that is valid,
+ and contains a PDB70 value whose age is valid and whose UUID values are
+ valid. Ensure we decode the UUID and include the age field in the UUID.
+ """
+ self.dbg.CreateTarget(None)
+ self.target = self.dbg.GetSelectedTarget()
+ self.process = self.target.LoadCore("linux-arm-uuids-with-age.dmp")
+ modules = self.target.modules
+ self.assertEqual(2, len(modules))
+ self.verify_module(modules[0], "/tmp/a", "01020304-0506-0708-090A-0B0C0D0E0F10-10101010")
+ self.verify_module(modules[1], "/tmp/b", "0A141E28-323C-4650-5A64-6E78828C96A0-20202020")
+
+ def test_uuid_modules_elf_build_id_16(self):
+ """
+ Test multiple modules having a MINIDUMP_MODULE.CvRecord that is valid,
+ and contains a ELF build ID whose value is valid and is 16 bytes long.
+ """
+ self.dbg.CreateTarget(None)
+ self.target = self.dbg.GetSelectedTarget()
+ self.process = self.target.LoadCore("linux-arm-uuids-elf-build-id-16.dmp")
+ modules = self.target.modules
+ self.assertEqual(2, len(modules))
+ self.verify_module(modules[0], "/tmp/a", "01020304-0506-0708-090A-0B0C0D0E0F10")
+ self.verify_module(modules[1], "/tmp/b", "0A141E28-323C-4650-5A64-6E78828C96A0")
+
+ def test_uuid_modules_elf_build_id_20(self):
+ """
+ Test multiple modules having a MINIDUMP_MODULE.CvRecord that is valid,
+ and contains a ELF build ID whose value is valid and is 20 bytes long.
+ """
+ self.dbg.CreateTarget(None)
+ self.target = self.dbg.GetSelectedTarget()
+ self.process = self.target.LoadCore("linux-arm-uuids-elf-build-id-20.dmp")
+ modules = self.target.modules
+ 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")
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-16.dmp b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-16.dmp
new file mode 100644
index 00000000000..df24fef6d38
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-16.dmp
Binary files differ
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-20.dmp b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-20.dmp
new file mode 100644
index 00000000000..d1a39827b5e
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-20.dmp
Binary files differ
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-no-age.dmp b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-no-age.dmp
new file mode 100644
index 00000000000..1ce4ce2cffc
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-no-age.dmp
Binary files differ
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-with-age.dmp b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-with-age.dmp
new file mode 100644
index 00000000000..ee82b9bd704
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-with-age.dmp
Binary files differ
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-zero-uuids.dmp b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-zero-uuids.dmp
new file mode 100644
index 00000000000..d8e1f4a70c9
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-zero-uuids.dmp
Binary files differ
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/macos-arm-uuids-no-age.dmp b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/macos-arm-uuids-no-age.dmp
new file mode 100644
index 00000000000..1cc6e56987a
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/macos-arm-uuids-no-age.dmp
Binary files differ
OpenPOWER on IntegriCloud