diff options
author | Greg Clayton <clayborg@gmail.com> | 2019-10-09 22:03:15 +0000 |
---|---|---|
committer | Greg Clayton <clayborg@gmail.com> | 2019-10-09 22:03:15 +0000 |
commit | 0156be59b45d3231ee0cb91eae3d68b8aaaed152 (patch) | |
tree | c3b4545a432dc798be3ba954f0772b20ff407eb3 /lldb/packages/Python/lldbsuite/test | |
parent | c6dec1d8288cd78ca0d6032551f826ce7a5bbc4e (diff) | |
download | bcm5719-llvm-0156be59b45d3231ee0cb91eae3d68b8aaaed152.tar.gz bcm5719-llvm-0156be59b45d3231ee0cb91eae3d68b8aaaed152.zip |
Fix a crasher due to an assert when two files have the same UUID but different paths.
Summary: The PlaceholderObjectFile has an assert in SetLoadAddress that fires if "m_base == value" is not true. To avoid this, we create check that the base address matches, and if it doesn't we clear the module that was found using the UUID so that we create a new PlaceholderObjectFile. Added a test to cover this issue.
Reviewers: labath, aadsm, dvlahovski
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D68106
llvm-svn: 374242
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
2 files changed, 50 insertions, 11 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 74241a5fe60..3752cfd9c9b 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 @@ -42,7 +42,7 @@ class MiniDumpUUIDTestCase(TestBase): 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 + 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 @@ -56,7 +56,7 @@ class MiniDumpUUIDTestCase(TestBase): 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 + 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. """ modules = self.get_minidump_modules("linux-arm-uuids-no-age.yaml") @@ -68,7 +68,7 @@ class MiniDumpUUIDTestCase(TestBase): 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 + 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 @@ -83,7 +83,7 @@ class MiniDumpUUIDTestCase(TestBase): 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 + 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. """ modules = self.get_minidump_modules("linux-arm-uuids-with-age.yaml") @@ -121,13 +121,31 @@ class MiniDumpUUIDTestCase(TestBase): self.verify_module(modules[0], "/not/exist/a", None) self.verify_module(modules[1], "/not/exist/b", None) + def test_uuid_modules_elf_build_id_same(self): + """ + Test multiple modules having a MINIDUMP_MODULE.CvRecord that is + valid, and contains a ELF build ID whose value is the same. There + is an assert in the PlaceholderObjectFile that was firing when we + encountered this which was crashing the process that was checking + if PlaceholderObjectFile.m_base was the same as the address this + fake module was being loaded at. We need to ensure we don't crash + in such cases and that we add both modules even though they have + the same UUID. + """ + modules = self.get_minidump_modules("linux-arm-same-uuids.yaml") + self.assertEqual(2, len(modules)) + self.verify_module(modules[0], "/file/does/not/exist/a", + '11223344-1122-3344-1122-334411223344-11223344') + self.verify_module(modules[1], "/file/does/not/exist/b", + '11223344-1122-3344-1122-334411223344-11223344') + @expectedFailureAll(oslist=["windows"]) 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. + 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 @@ -141,16 +159,16 @@ class MiniDumpUUIDTestCase(TestBase): self.dbg.HandleCommand(cmd) modules = self.get_minidump_modules("linux-arm-partial-uuids-match.yaml") self.assertEqual(1, len(modules)) - self.verify_module(modules[0], so_path, + self.verify_module(modules[0], so_path, "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. - + 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 @@ -163,7 +181,7 @@ class MiniDumpUUIDTestCase(TestBase): modules = self.get_minidump_modules("linux-arm-partial-uuids-mismatch.yaml") self.assertEqual(1, len(modules)) self.verify_module(modules[0], - "/invalid/path/on/current/system/libuuidmismatch.so", + "/invalid/path/on/current/system/libuuidmismatch.so", "7295E17C-6668-9E05-CBB5-DEE5003865D5") def test_relative_module_name(self): diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-same-uuids.yaml b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-same-uuids.yaml new file mode 100644 index 00000000000..21c5220e415 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-same-uuids.yaml @@ -0,0 +1,21 @@ +--- !minidump +Streams: + - Type: SystemInfo + Processor Arch: AMD64 + Platform ID: Linux + CSD Version: '15E216' + CPU: + Vendor ID: GenuineIntel + Version Info: 0x00000000 + Feature Info: 0x00000000 + - Type: ModuleList + Modules: + - Base of Image: 0x0000000000001000 + Size of Image: 0x00001000 + Module Name: '/file/does/not/exist/a' + CodeView Record: '52534453112233441122334411223344112233441122334411' + - Base of Image: 0x0000000000003000 + Size of Image: 0x00001000 + Module Name: '/file/does/not/exist/b' + CodeView Record: '52534453112233441122334411223344112233441122334411' +... |