summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2019-04-02 15:40:54 +0000
committerGreg Clayton <gclayton@apple.com>2019-04-02 15:40:54 +0000
commit838bba9c34bf1e5500c2e100327bc764afc8d367 (patch)
tree54531ef63c0c0a5c0d71a24c893a03a4492ce31b /lldb/packages/Python/lldbsuite
parentf76fe454268d661cb31018d9e46a6df467bb22b9 (diff)
downloadbcm5719-llvm-838bba9c34bf1e5500c2e100327bc764afc8d367.tar.gz
bcm5719-llvm-838bba9c34bf1e5500c2e100327bc764afc8d367.zip
Allow partial UUID matching in Minidump core file plug-in
Breakpad had bugs in earlier versions where it would take a 20 byte ELF build ID and put it into the minidump file as a 16 byte PDB70 UUID with an age of zero. This would make it impossible to do postmortem debugging with one of these older minidump files. This fix allows partial matching of UUIDs. To do this we first try and match with the full UUID value, and then fall back to removing the original directory path from the module specification and we remove the UUID requirement, and then manually do the matching ourselves. This allows scripts to find symbols files using a symbol server, place them all in a directory, use the "setting set target.exec-search-paths" setting to specify the directory, and then load the core file. The Target::GetSharedModule() can then find the correct file without doing any other matching and load it. Tests were added to cover a partial UUID match where the breakpad file has a 16 byte UUID and the actual file on disk has a 20 byte UUID, both where the first 16 bytes match, and don't match. Differential Revision: https://reviews.llvm.org/D60001 llvm-svn: 357482
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py52
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/libuuidmatch.yaml14
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/libuuidmismatch.yaml14
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-partial-uuids-match.dmpbin0 -> 403 bytes
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-partial-uuids-mismatch.dmpbin0 -> 409 bytes
5 files changed, 80 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
index 1e4a98363e3..da93a03c30a 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
@@ -8,6 +8,7 @@ from six import iteritems
import shutil
import lldb
+import os
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
@@ -132,3 +133,54 @@ class MiniDumpUUIDTestCase(TestBase):
self.assertEqual(2, len(modules))
self.verify_module(modules[0], "/not/exist/a", None)
self.verify_module(modules[1], "/not/exist/b", None)
+
+ def test_partial_uuid_match(self):
+ """
+ Breakpad has been known to create minidump files using CvRecord in each
+ module whose signature is set to PDB70 where the UUID only contains the
+ first 16 bytes of a 20 byte ELF build ID. Code was added to
+ ProcessMinidump.cpp to deal with this and allows partial UUID matching.
+
+ This test verifies that if we have a minidump with a 16 byte UUID, that
+ we are able to associate a symbol file with a 20 byte UUID only if the
+ first 16 bytes match. In this case we will see the path from the file
+ we found in the test directory and the 20 byte UUID from the actual
+ file, not the 16 byte shortened UUID from the minidump.
+ """
+ so_path = self.getBuildArtifact("libuuidmatch.so")
+ self.yaml2obj("libuuidmatch.yaml", so_path)
+ self.dbg.CreateTarget(None)
+ self.target = self.dbg.GetSelectedTarget()
+ cmd = 'settings set target.exec-search-paths "%s"' % (os.path.dirname(so_path))
+ self.dbg.HandleCommand(cmd)
+ self.process = self.target.LoadCore("linux-arm-partial-uuids-match.dmp")
+ modules = self.target.modules
+ self.assertEqual(1, len(modules))
+ self.verify_module(modules[0],
+ "libuuidmatch.so",
+ "7295E17C-6668-9E05-CBB5-DEE5003865D5-5267C116")
+
+ def test_partial_uuid_mismatch(self):
+ """
+ Breakpad has been known to create minidump files using CvRecord in each
+ module whose signature is set to PDB70 where the UUID only contains the
+ first 16 bytes of a 20 byte ELF build ID. Code was added to
+ ProcessMinidump.cpp to deal with this and allows partial UUID matching.
+
+ This test verifies that if we have a minidump with a 16 byte UUID, that
+ we are not able to associate a symbol file with a 20 byte UUID only if
+ any of the first 16 bytes do not match. In this case we will see the UUID
+ from the minidump file and the path from the minidump file.
+ """
+ so_path = self.getBuildArtifact("libuuidmismatch.so")
+ self.yaml2obj("libuuidmatch.yaml", so_path)
+ self.dbg.CreateTarget(None)
+ self.target = self.dbg.GetSelectedTarget()
+ cmd = 'settings set target.exec-search-paths "%s"' % (os.path.dirname(so_path))
+ self.dbg.HandleCommand(cmd)
+ self.process = self.target.LoadCore("linux-arm-partial-uuids-mismatch.dmp")
+ modules = self.target.modules
+ self.assertEqual(1, len(modules))
+ self.verify_module(modules[0],
+ "/invalid/path/on/current/system/libuuidmismatch.so",
+ "7295E17C-6668-9E05-CBB5-DEE5003865D5")
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/libuuidmatch.yaml b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/libuuidmatch.yaml
new file mode 100644
index 00000000000..3610694d4db
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/libuuidmatch.yaml
@@ -0,0 +1,14 @@
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_DYN
+ Machine: EM_ARM
+ Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ]
+Sections:
+ - Name: .note.gnu.build-id
+ Type: SHT_NOTE
+ Flags: [ SHF_ALLOC ]
+ Address: 0x0000000000000114
+ AddressAlign: 0x0000000000000004
+ Content: 040000001400000003000000474E55007295E17C66689E05CBB5DEE5003865D55267C116
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/libuuidmismatch.yaml b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/libuuidmismatch.yaml
new file mode 100644
index 00000000000..5fef636228e
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/libuuidmismatch.yaml
@@ -0,0 +1,14 @@
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_DYN
+ Machine: EM_ARM
+ Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ]
+Sections:
+ - Name: .note.gnu.build-id
+ Type: SHT_NOTE
+ Flags: [ SHF_ALLOC ]
+ Address: 0x0000000000000114
+ AddressAlign: 0x0000000000000004
+ Content: 040000001400000003000000474E55008295E17C66689E05CBB5DEE5003865D55267C116
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-partial-uuids-match.dmp b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-partial-uuids-match.dmp
new file mode 100644
index 00000000000..12045dacb4e
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-partial-uuids-match.dmp
Binary files differ
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-partial-uuids-mismatch.dmp b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-partial-uuids-mismatch.dmp
new file mode 100644
index 00000000000..c5c610e63b1
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-partial-uuids-mismatch.dmp
Binary files differ
OpenPOWER on IntegriCloud