labath created this revision.
labath added a reviewer: clayborg.
Herald added a subscriber: javed.absar.
labath marked an inline comment as done.
labath added inline comments.


================
Comment at: 
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-zero-uuids.yaml:5
+    Processor Arch:  AMD64
+    Platform ID:     MacOSX
+    CSD Version:     '15E216'
----------------
@clayborg: The OS in this minidump is inconsistent with the file name. Do you 
want me to rename the file, or change the OS in the minidump?


Instead of checking in raw minidump binaries, check in their yaml form,
and call yaml2obj in the test.


https://reviews.llvm.org/D60948

Files:
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-partial-uuids-match.dmp
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-partial-uuids-match.yaml
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-partial-uuids-mismatch.dmp
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-partial-uuids-mismatch.yaml
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-16.dmp
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-16.yaml
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-20.dmp
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-20.yaml
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-zero.dmp
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-zero.yaml
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-no-age.dmp
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-no-age.yaml
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-with-age.dmp
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-with-age.yaml
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-zero-uuids.dmp
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-zero-uuids.yaml
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/macos-arm-uuids-no-age.dmp
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/macos-arm-uuids-no-age.yaml

Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/macos-arm-uuids-no-age.yaml
===================================================================
--- /dev/null
+++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/macos-arm-uuids-no-age.yaml
@@ -0,0 +1,21 @@
+--- !minidump
+Streams:         
+  - Type:            SystemInfo
+    Processor Arch:  AMD64
+    Platform ID:     MacOSX
+    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:     '/tmp/a'
+        CodeView Record: 525344530102030405060708090A0B0C0D0E0F100000000000
+      - Base of Image:   0x0000000000001000
+        Size of Image:   0x00001000
+        Module Name:     '/tmp/b'
+        CodeView Record: 525344530A141E28323C46505A646E78828C96A00000000000
+...
Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-zero-uuids.yaml
===================================================================
--- /dev/null
+++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-zero-uuids.yaml
@@ -0,0 +1,21 @@
+--- !minidump
+Streams:         
+  - Type:            SystemInfo
+    Processor Arch:  AMD64
+    Platform ID:     MacOSX
+    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: '52534453000000000000000000000000000000000000000000'
+      - Base of Image:   0x0000000000001000
+        Size of Image:   0x00001000
+        Module Name:     '/file/does/not/exist/b'
+        CodeView Record: '52534453000000000000000000000000000000000000000000'
+...
Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-with-age.yaml
===================================================================
--- /dev/null
+++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-with-age.yaml
@@ -0,0 +1,19 @@
+--- !minidump
+Streams:         
+  - Type:            SystemInfo
+    Processor Arch:  ARM
+    Platform ID:     Linux
+    CSD Version:     '15E216'
+    CPU:             
+      CPUID:           0x00000000
+  - Type:            ModuleList
+    Modules:         
+      - Base of Image:   0x0000000000001000
+        Size of Image:   0x00001000
+        Module Name:     '/tmp/a'
+        CodeView Record: 525344530102030405060708090A0B0C0D0E0F101010101000
+      - Base of Image:   0x0000000000001000
+        Size of Image:   0x00001000
+        Module Name:     '/tmp/b'
+        CodeView Record: 525344530A141E28323C46505A646E78828C96A02020202000
+...
Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-no-age.yaml
===================================================================
--- /dev/null
+++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-no-age.yaml
@@ -0,0 +1,19 @@
+--- !minidump
+Streams:         
+  - Type:            SystemInfo
+    Processor Arch:  ARM
+    Platform ID:     Linux
+    CSD Version:     '15E216'
+    CPU:             
+      CPUID:           0x00000000
+  - Type:            ModuleList
+    Modules:         
+      - Base of Image:   0x0000000000001000
+        Size of Image:   0x00001000
+        Module Name:     '/tmp/a'
+        CodeView Record: 525344530102030405060708090A0B0C0D0E0F100000000000
+      - Base of Image:   0x0000000000001000
+        Size of Image:   0x00001000
+        Module Name:     '/tmp/b'
+        CodeView Record: 525344530A141E28323C46505A646E78828C96A00000000000
+...
Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-zero.yaml
===================================================================
--- /dev/null
+++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-zero.yaml
@@ -0,0 +1,19 @@
+--- !minidump
+Streams:         
+  - Type:            SystemInfo
+    Processor Arch:  ARM
+    Platform ID:     Linux
+    CSD Version:     '15E216'
+    CPU:             
+      CPUID:           0x00000000
+  - Type:            ModuleList
+    Modules:         
+      - Base of Image:   0x0000000000001000
+        Size of Image:   0x00001000
+        Module Name:     '/not/exist/a'
+        CodeView Record: 4C45704200000000000000000000000000000000
+      - Base of Image:   0x0000000000001000
+        Size of Image:   0x00001000
+        Module Name:     '/not/exist/b'
+        CodeView Record: 4C45704200000000000000000000000000000000
+...
Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-20.yaml
===================================================================
--- /dev/null
+++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-20.yaml
@@ -0,0 +1,19 @@
+--- !minidump
+Streams:         
+  - Type:            SystemInfo
+    Processor Arch:  ARM
+    Platform ID:     Linux
+    CSD Version:     '15E216'
+    CPU:             
+      CPUID:           0x00000000
+  - Type:            ModuleList
+    Modules:         
+      - Base of Image:   0x0000000000001000
+        Size of Image:   0x00001000
+        Module Name:     '/tmp/a'
+        CodeView Record: 4C4570420102030405060708090A0B0C0D0E0F1011121314
+      - Base of Image:   0x0000000000001000
+        Size of Image:   0x00001000
+        Module Name:     '/tmp/b'
+        CodeView Record: 4C4570420A141E28323C46505A646E78828C96A0AAB4BEC8
+...
Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-16.yaml
===================================================================
--- /dev/null
+++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-16.yaml
@@ -0,0 +1,19 @@
+--- !minidump
+Streams:         
+  - Type:            SystemInfo
+    Processor Arch:  ARM
+    Platform ID:     Linux
+    CSD Version:     '15E216'
+    CPU:             
+      CPUID:           0x00000000
+  - Type:            ModuleList
+    Modules:         
+      - Base of Image:   0x0000000000001000
+        Size of Image:   0x00001000
+        Module Name:     '/tmp/a'
+        CodeView Record: 4C4570420102030405060708090A0B0C0D0E0F10
+      - Base of Image:   0x0000000000001000
+        Size of Image:   0x00001000
+        Module Name:     '/tmp/b'
+        CodeView Record: 4C4570420A141E28323C46505A646E78828C96A0
+...
Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-partial-uuids-mismatch.yaml
===================================================================
--- /dev/null
+++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-partial-uuids-mismatch.yaml
@@ -0,0 +1,15 @@
+--- !minidump
+Streams:         
+  - Type:            SystemInfo
+    Processor Arch:  ARM
+    Platform ID:     Linux
+    CSD Version:     '15E216'
+    CPU:             
+      CPUID:           0x00000000
+  - Type:            ModuleList
+    Modules:         
+      - Base of Image:   0x0000000000001000
+        Size of Image:   0x00001000
+        Module Name:     '/invalid/path/on/current/system/libuuidmismatch.so'
+        CodeView Record: 525344537295E17C66689E05CBB5DEE5003865D50000000000
+...
Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-partial-uuids-match.yaml
===================================================================
--- /dev/null
+++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-arm-partial-uuids-match.yaml
@@ -0,0 +1,15 @@
+--- !minidump
+Streams:         
+  - Type:            SystemInfo
+    Processor Arch:  ARM
+    Platform ID:     Linux
+    CSD Version:     '15E216'
+    CPU:             
+      CPUID:           0x00000000
+  - Type:            ModuleList
+    Modules:         
+      - Base of Image:   0x0000000000001000
+        Size of Image:   0x00001000
+        Module Name:     '/invalid/path/on/current/system/libuuidmatch.so'
+        CodeView Record: 525344537295E17C66689E05CBB5DEE5003865D50000000000
+...
Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
+++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
@@ -33,6 +33,13 @@
         self.assertEqual(verify_path, module.GetFileSpec().fullpath)
         self.assertEqual(verify_uuid, uuid)
 
+    def get_minidump_modules(self, yaml_file):
+        minidump_path = self.getBuildArtifact(yaml_file + ".dmp")
+        self.yaml2obj(yaml_file, minidump_path)
+        self.target = self.dbg.CreateTarget(None)
+        self.process = self.target.LoadCore(minidump_path)
+        return self.target.modules
+
     def test_zero_uuid_modules(self):
         """
             Test multiple modules having a MINIDUMP_MODULE.CvRecord that is valid,
@@ -42,10 +49,7 @@
             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
+        modules = self.get_minidump_modules("linux-arm-zero-uuids.yaml")
         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)
@@ -56,9 +60,7 @@
             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.get_minidump_modules("linux-arm-uuids-no-age.yaml")
         modules = self.target.modules
         self.assertEqual(2, len(modules))
         self.verify_module(modules[0], "/tmp/a", "01020304-0506-0708-090A-0B0C0D0E0F10")
@@ -73,9 +75,7 @@
             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.get_minidump_modules("macos-arm-uuids-no-age.yaml")
         modules = self.target.modules
         self.assertEqual(2, len(modules))
         self.verify_module(modules[0], "/tmp/a", "04030201-0605-0807-090A-0B0C0D0E0F10")
@@ -87,10 +87,7 @@
             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
+        modules = self.get_minidump_modules("linux-arm-uuids-with-age.yaml")
         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")
@@ -100,10 +97,7 @@
             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
+        modules = self.get_minidump_modules("linux-arm-uuids-elf-build-id-16.yaml")
         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")
@@ -113,10 +107,7 @@
             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
+        modules = self.get_minidump_modules("linux-arm-uuids-elf-build-id-20.yaml")
         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")
@@ -126,10 +117,7 @@
             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
+        modules = self.get_minidump_modules("linux-arm-uuids-elf-build-id-zero.yaml")
         self.assertEqual(2, len(modules))
         self.verify_module(modules[0], "/not/exist/a", None)
         self.verify_module(modules[1], "/not/exist/b", None)
@@ -150,12 +138,9 @@
         """
         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
+        modules = self.get_minidump_modules("linux-arm-partial-uuids-match.yaml")
         self.assertEqual(1, len(modules))
         self.verify_module(modules[0], so_path, 
                            "7295E17C-6668-9E05-CBB5-DEE5003865D5-5267C116")
@@ -174,12 +159,9 @@
         """
         so_path = self.getBuildArtifact("libuuidmismatch.so")
         self.yaml2obj("libuuidmismatch.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
+        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", 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to