TestMinidumpNew.py: Use yaml2obj where possible

Replace checked-in minidumps with their yaml forms now that yaml2obj
supports the ThreadList stream. I delete the test_modules_in_mini_dump
test altogether as this functionality is covered more systematically in
TestMinidumpUUID.py.

llvm-svn: 360655
This commit is contained in:
Pavel Labath 2019-05-14 08:59:08 +00:00
parent efe8e7e36d
commit b1f213cfdc
10 changed files with 147 additions and 79 deletions

View File

@ -31,6 +31,13 @@ class MiniDumpNewTestCase(TestBase):
lldb.DBG.SetSelectedPlatform(self._initial_platform)
super(MiniDumpNewTestCase, self).tearDown()
def process_from_yaml(self, yaml_file):
minidump_path = self.getBuildArtifact(os.path.basename(yaml_file) + ".dmp")
self.yaml2obj(yaml_file, minidump_path)
self.target = self.dbg.CreateTarget(None)
self.process = self.target.LoadCore(minidump_path)
return self.process
def check_state(self):
with open(os.devnull) as devnul:
# sanitize test output
@ -61,17 +68,17 @@ class MiniDumpNewTestCase(TestBase):
def test_loadcore_error_status(self):
"""Test the SBTarget.LoadCore(core, error) overload."""
self.dbg.CreateTarget(None)
self.target = self.dbg.GetSelectedTarget()
minidump_path = self.getBuildArtifact("linux-x86_64.dmp")
self.yaml2obj("linux-x86_64.yaml", minidump_path)
self.target = self.dbg.CreateTarget(None)
error = lldb.SBError()
self.process = self.target.LoadCore("linux-x86_64.dmp", error)
self.process = self.target.LoadCore(minidump_path, error)
self.assertTrue(self.process, PROCESS_IS_VALID)
self.assertTrue(error.Success())
def test_loadcore_error_status_failure(self):
"""Test the SBTarget.LoadCore(core, error) overload."""
self.dbg.CreateTarget(None)
self.target = self.dbg.GetSelectedTarget()
self.target = self.dbg.CreateTarget(None)
error = lldb.SBError()
self.process = self.target.LoadCore("non-existent.dmp", error)
self.assertFalse(self.process, PROCESS_IS_VALID)
@ -79,19 +86,14 @@ class MiniDumpNewTestCase(TestBase):
def test_process_info_in_minidump(self):
"""Test that lldb can read the process information from the Minidump."""
# target create -c linux-x86_64.dmp
self.dbg.CreateTarget(None)
self.target = self.dbg.GetSelectedTarget()
self.process = self.target.LoadCore("linux-x86_64.dmp")
self.process_from_yaml("linux-x86_64.yaml")
self.assertTrue(self.process, PROCESS_IS_VALID)
self.assertEqual(self.process.GetNumThreads(), 1)
self.assertEqual(self.process.GetProcessID(), self._linux_x86_64_pid)
self.check_state()
def test_memory_region_name(self):
self.dbg.CreateTarget(None)
self.target = self.dbg.GetSelectedTarget()
self.process = self.target.LoadCore("regions-linux-map.dmp")
self.process_from_yaml("regions-linux-map.yaml")
result = lldb.SBCommandReturnObject()
addr_region_name_pairs = [
("0x400d9000", "/system/bin/app_process"),
@ -118,63 +120,9 @@ class MiniDumpNewTestCase(TestBase):
region_name, command)
self.assertTrue(region_name in result.GetOutput(), message)
def test_modules_in_mini_dump(self):
"""Test that lldb can read the list of modules from the minidump."""
# target create -c linux-x86_64.dmp
self.dbg.CreateTarget(None)
self.target = self.dbg.GetSelectedTarget()
self.process = self.target.LoadCore("linux-x86_64.dmp")
self.assertTrue(self.process, PROCESS_IS_VALID)
expected_modules = [
{
'filename' : 'linux-x86_64',
'uuid' : 'E35C283B-C327-C287-62DB-788BF5A4078B-E2351448',
},
{
'filename' : 'libm-2.19.so',
'uuid' : 'D144258E-6149-00B2-55A3-1F3FD2283A87-8670D5BC',
},
{
'filename' : 'libgcc_s.so.1',
'uuid' : '36311B44-5771-0AE5-578C-4BF00791DED7-359DBB92',
},
{
'filename' : 'libstdc++.so.6.0.19',
'uuid' : '76190E92-2AF7-457D-078F-75C9B15FA184-E83EB506',
},
{
'filename' : 'libc-2.19.so',
'uuid' : 'CF699A15-CAAE-64F5-0311-FC4655B86DC3-9A479789',
},
{
'filename' : 'libpthread-2.19.so',
'uuid' : '31E9F21A-E8C1-0396-171F-1E13DA157809-86FA696C',
},
{
'filename' : 'libbreakpad.so',
'uuid' : '784FD549-332D-826E-D23F-18C17C6F320A',
},
{
'filename' : 'ld-2.19.so',
'uuid' : 'D0F53790-4076-D73F-29E4-A37341F8A449-E2EF6CD0',
},
{
'filename' : 'linux-gate.so',
'uuid' : '4EAD28F8-88EF-3520-872B-73C6F2FE7306-C41AF22F',
},
]
self.assertEqual(self.target.GetNumModules(), len(expected_modules))
for module, expected in zip(self.target.modules, expected_modules):
self.assertTrue(module.IsValid())
self.assertEqual(module.file.basename, expected['filename'])
self.assertEqual(module.GetUUIDString(), expected['uuid'])
def test_thread_info_in_minidump(self):
"""Test that lldb can read the thread information from the Minidump."""
# target create -c linux-x86_64.dmp
self.dbg.CreateTarget(None)
self.target = self.dbg.GetSelectedTarget()
self.process = self.target.LoadCore("linux-x86_64.dmp")
self.process_from_yaml("linux-x86_64.yaml")
self.check_state()
# This process crashed due to a segmentation fault in its
# one and only thread.
@ -238,10 +186,7 @@ class MiniDumpNewTestCase(TestBase):
def test_arm64_registers(self):
"""Test ARM64 registers from a breakpad created minidump."""
# target create -c arm64-macos.dmp
self.dbg.CreateTarget(None)
self.target = self.dbg.GetSelectedTarget()
self.process = self.target.LoadCore("arm64-macos.dmp")
self.process_from_yaml("arm64-macos.yaml")
self.check_state()
self.assertEqual(self.process.GetNumThreads(), 1)
thread = self.process.GetThreadAtIndex(0)
@ -305,12 +250,10 @@ class MiniDumpNewTestCase(TestBase):
Verify values of all ARM registers from a breakpad created
minidump.
"""
self.dbg.CreateTarget(None)
self.target = self.dbg.GetSelectedTarget()
if apple:
self.process = self.target.LoadCore("arm-macos.dmp")
self.process_from_yaml("arm-macos.yaml")
else:
self.process = self.target.LoadCore("arm-linux.dmp")
self.process_from_yaml("arm-linux.yaml")
self.check_state()
self.assertEqual(self.process.GetNumThreads(), 1)
thread = self.process.GetThreadAtIndex(0)
@ -451,10 +394,7 @@ class MiniDumpNewTestCase(TestBase):
def test_memory_regions_in_minidump(self):
"""Test memory regions from a Minidump"""
# target create -c regions-linux-map.dmp
self.dbg.CreateTarget(None)
self.target = self.dbg.GetSelectedTarget()
self.process = self.target.LoadCore("regions-linux-map.dmp")
self.process_from_yaml("regions-linux-map.yaml")
self.check_state()
regions_count = 19

View File

@ -0,0 +1,18 @@
--- !minidump
Streams:
- Type: SystemInfo
Processor Arch: ARM
Platform ID: Linux
CSD Version: ABC123
CPU:
CPUID: 0x00000000
- Type: MiscInfo
Content: 00000000010000007B000000000000000000000000000000
- Type: ThreadList
Threads:
- Thread Id: 0x00001000
Context: 060000400100000002000000030000000400000005000000060000000700000008000000090000000A0000000B0000000C0000000D0000000E0000000F0000001000000044332211DDCCBBAA887766550101000001000100020200000200020003030000030003000404000004000400050500000500050006060000060006000707000007000700080800000800080009090000090009000A0A00000A000A000B0B00000B000B000C0C00000C000C000D0D00000D000D000E0E00000E000E000F0F00000F000F0010100000100010001111000011001100121200001200120013130000130013001414000014001400151500001500150016160000160016001717000017001700181800001800180019190000190019001A1A00001A001A001B1B00001B001B001C1C00001C001C001D1D00001D001D001E1E00001E001E001F1F00001F001F0020200000200020000000000001000100020002000300030004000400050005000600060007000700
Stack:
Start of Memory Range: 0x0000000000000000
Content: ''
...

View File

@ -0,0 +1,18 @@
--- !minidump
Streams:
- Type: SystemInfo
Processor Arch: ARM
Platform ID: MacOSX
CSD Version: ABC123
CPU:
CPUID: 0x00000000
- Type: MiscInfo
Content: 00000000010000007B000000000000000000000000000000
- Type: ThreadList
Threads:
- Thread Id: 0x00001000
Context: 060000400100000002000000030000000400000005000000060000000700000008000000090000000A0000000B0000000C0000000D0000000E0000000F0000001000000044332211DDCCBBAA887766550101000001000100020200000200020003030000030003000404000004000400050500000500050006060000060006000707000007000700080800000800080009090000090009000A0A00000A000A000B0B00000B000B000C0C00000C000C000D0D00000D000D000E0E00000E000E000F0F00000F000F0010100000100010001111000011001100121200001200120013130000130013001414000014001400151500001500150016160000160016001717000017001700181800001800180019190000190019001A1A00001A001A001B1B00001B001B001C1C00001C001C001D1D00001D001D001E1E00001E001E001F1F00001F001F0020200000200020000000000001000100020002000300030004000400050005000600060007000700
Stack:
Start of Memory Range: 0x0000000000000000
Content: ''
...

View File

@ -0,0 +1,18 @@
--- !minidump
Streams:
- Type: SystemInfo
Processor Arch: ARM64
Platform ID: MacOSX
CSD Version: '15E216'
CPU:
CPUID: 0x00000000
- Type: MiscInfo
Content: 00000000010000007B000000000000000000000000000000
- Type: ThreadList
Threads:
- Thread Id: 0x00001000
Context: 060000800000000001000000020003000200000003000400030000000400050004000000050006000500000006000700060000000700080007000000080009000800000009000A00090000000A000B000A0000000B000C000B0000000C000D000C0000000D000E000D0000000E000F000E0000000F0010000F00000010001100100000001100120011000000120013001200000013001400130000001400150014000000150016001500000016001700160000001700180017000000180019001800000019001A00190000001A001B001A0000001B001C001B0000001C001D001C0000001D001E001D0000001E001F001E0000001F0020001F00000020002100200000002100220000100000000000004433221188776655CCBBAA99000102030405060708090A0B0C0D0E0F0102030405060708090A0B0C0D0E0F1002030405060708090A0B0C0D0E0F1011030405060708090A0B0C0D0E0F1011120405060708090A0B0C0D0E0F1011121305060708090A0B0C0D0E0F1011121314060708090A0B0C0D0E0F1011121314150708090A0B0C0D0E0F1011121314151608090A0B0C0D0E0F1011121314151617090A0B0C0D0E0F1011121314151617180A0B0C0D0E0F101112131415161718190B0C0D0E0F101112131415161718191A0C0D0E0F101112131415161718191A1B0D0E0F101112131415161718191A1B1C0E0F101112131415161718191A1B1C1D0F101112131415161718191A1B1C1D1E101112131415161718191A1B1C1D1E1F1112131415161718191A1B1C1D1E1F2012131415161718191A1B1C1D1E1F2021131415161718191A1B1C1D1E1F2021221415161718191A1B1C1D1E1F2021222315161718191A1B1C1D1E1F2021222324161718191A1B1C1D1E1F2021222324251718191A1B1C1D1E1F2021222324252618191A1B1C1D1E1F2021222324252627191A1B1C1D1E1F2021222324252627281A1B1C1D1E1F202122232425262728291B1C1D1E1F202122232425262728292A1C1D1E1F202122232425262728292A2B1D1E1F202122232425262728292A2B2C1E1F202122232425262728292A2B2C2D1F202122232425262728292A2B2C2D2E
Stack:
Start of Memory Range: 0x0000000000000000
Content: ''
...

View File

@ -0,0 +1,41 @@
--- !minidump
Streams:
- Type: ThreadList
Threads:
- Thread Id: 0x000074DD
Context: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B0010000000000033000000000000000000000002020100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040109600000000000100000000000000000000000000000068E7D0C8FF7F000068E7D0C8FF7F000097E6D0C8FF7F000010109600000000000000000000000000020000000000000088E4D0C8FF7F0000603FFF85C77F0000F00340000000000080E7D0C8FF7F000000000000000000000000000000000000E0034000000000007F0300000000000000000000000000000000000000000000801F0000FFFF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF252525252525252525252525252525250000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Stack:
Start of Memory Range: 0x00007FFFC8D0E000
Content: DEADBEEFBAADF00D
- Type: ModuleList
Modules:
- Base of Image: 0x0000000000400000
Size of Image: 0x00001000
Module Name: '/tmp/test/linux-x86_64'
CodeView Record: 4C457042E35C283BC327C28762DB788BF5A4078BE2351448
- Type: Exception
Content: DD740000000000000B00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000D0040000F8310000
- Type: SystemInfo
Processor Arch: AMD64
Processor Level: 6
Processor Revision: 15876
Number of Processors: 40
Platform ID: Linux
CSD Version: 'Linux 3.13.0-91-generic'
CPU:
Vendor ID: GenuineIntel
Version Info: 0x00000000
Feature Info: 0x00000000
- Type: LinuxProcStatus
Text: |
Name: linux-x86_64
State: t (tracing stop)
Tgid: 29917
Ngid: 0
Pid: 29917
PPid: 29370
TracerPid: 29918
Uid: 1001 1001 1001 1001
Gid: 1001 1001 1001 1001
...

View File

@ -0,0 +1,33 @@
--- !minidump
Streams:
- Type: SystemInfo
Processor Arch: ARM64
Platform ID: Linux
CSD Version: '15E216'
CPU:
CPUID: 0x00000000
- Type: MiscInfo
Content: 00000000010000007B000000000000000000000000000000
- Type: LinuxMaps
Text: |
400d9000-400db000 r-xp 00000000 b3:04 227 /system/bin/app_process
400db000-400dc000 r--p 00001000 b3:04 227 /system/bin/app_process
400dc000-400dd000 rw-p 00000000 00:00 0
400dd000-400ec000 r-xp 00000000 b3:04 300 /system/bin/linker
400ec000-400ed000 r--p 00000000 00:00 0
400ed000-400ee000 r--p 0000f000 b3:04 300 /system/bin/linker
400ee000-400ef000 rw-p 00010000 b3:04 300 /system/bin/linker
400ef000-400fb000 rw-p 00000000 00:00 0
400fb000-400fc000 r-xp 00000000 b3:04 1096 /system/lib/liblog.so
400fc000-400fd000 rwxp 00001000 b3:04 1096 /system/lib/liblog.so
400fd000-400ff000 r-xp 00002000 b3:04 1096 /system/lib/liblog.so
400ff000-40100000 r--p 00003000 b3:04 1096 /system/lib/liblog.so
40100000-40101000 rw-p 00004000 b3:04 1096 /system/lib/liblog.so
40101000-40122000 r-xp 00000000 b3:04 955 /system/lib/libc.so
40122000-40123000 rwxp 00021000 b3:04 955 /system/lib/libc.so
40123000-40167000 r-xp 00022000 b3:04 955 /system/lib/libc.so
40167000-40169000 r--p 00065000 b3:04 955 /system/lib/libc.so
40169000-4016b000 rw-p 00067000 b3:04 955 /system/lib/libc.so
4016b000-40176000 rw-p 00000000 00:00 0
...