diff options
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/postmortem')
3 files changed, 67 insertions, 34 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/TestLinuxCore.py b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/TestLinuxCore.py index 3c650639aeb..197a0378d99 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/TestLinuxCore.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/TestLinuxCore.py @@ -12,18 +12,19 @@ from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class LinuxCoreTestCase(TestBase): NO_DEBUG_INFO_TESTCASE = True mydir = TestBase.compute_mydir(__file__) - _i386_pid = 32306 + _i386_pid = 32306 _x86_64_pid = 32259 - _s390x_pid = 1045 + _s390x_pid = 1045 - _i386_regions = 4 + _i386_regions = 4 _x86_64_regions = 5 - _s390x_regions = 2 + _s390x_regions = 2 def test_i386(self): """Test that lldb can read the process information from an i386 linux core file.""" @@ -33,8 +34,9 @@ class LinuxCoreTestCase(TestBase): """Test that lldb can read the process information from an x86_64 linux core file.""" self.do_test("x86_64", self._x86_64_pid, self._x86_64_regions) - # This seems to hang on non-s390x platforms for some reason. Disabling for now. - @skipIf(archs=no_match(['s390x'])) + # This seems to hang on non-s390x platforms for some reason. Disabling + # for now. + @skipIf(archs=no_match(['s390x'])) def test_s390x(self): """Test that lldb can read the process information from an s390x linux core file.""" self.do_test("s390x", self._s390x_pid, self._s390x_regions) @@ -43,7 +45,7 @@ class LinuxCoreTestCase(TestBase): """Test that we read the information from the core correctly even if we have a running process with the same PID around""" try: - shutil.copyfile("x86_64.out", "x86_64-pid.out") + shutil.copyfile("x86_64.out", "x86_64-pid.out") shutil.copyfile("x86_64.core", "x86_64-pid.core") with open("x86_64-pid.core", "r+b") as f: # These are offsets into the NT_PRSTATUS and NT_PRPSINFO structures in the note @@ -51,9 +53,14 @@ class LinuxCoreTestCase(TestBase): # as well. (Notes can be viewed with readelf --notes.) for pid_offset in [0x1c4, 0x320]: f.seek(pid_offset) - self.assertEqual(struct.unpack("<I", f.read(4))[0], self._x86_64_pid) - - # We insert our own pid, and make sure the test still works. + self.assertEqual( + struct.unpack( + "<I", + f.read(4))[0], + self._x86_64_pid) + + # We insert our own pid, and make sure the test still + # works. f.seek(pid_offset) f.write(struct.pack("<I", os.getpid())) self.do_test("x86_64-pid", os.getpid(), self._x86_64_regions) @@ -72,10 +79,15 @@ class LinuxCoreTestCase(TestBase): altframe = altprocess.GetSelectedThread().GetFrameAtIndex(0) self.assertEqual(altframe.GetFunctionName(), "_start") - self.assertEqual(altframe.GetLineEntry().GetLine(), line_number("altmain.c", "Frame _start")) + self.assertEqual( + altframe.GetLineEntry().GetLine(), + line_number( + "altmain.c", + "Frame _start")) error = lldb.SBError() - F = altprocess.ReadCStringFromMemory(altframe.FindVariable("F").GetValueAsUnsigned(), 256, error) + F = altprocess.ReadCStringFromMemory( + altframe.FindVariable("F").GetValueAsUnsigned(), 256, error) self.assertTrue(error.Success()) self.assertEqual(F, "_start") @@ -90,33 +102,40 @@ class LinuxCoreTestCase(TestBase): region = lldb.SBMemoryRegionInfo() # Check we have the right number of regions. - self.assertEqual(region_list.GetSize(), region_count); + self.assertEqual(region_list.GetSize(), region_count) # Check that getting a region beyond the last in the list fails. - self.assertFalse(region_list.GetMemoryRegionAtIndex(region_count, region)); + self.assertFalse( + region_list.GetMemoryRegionAtIndex( + region_count, region)) # Check each region is valid. for i in range(region_list.GetSize()): # Check we can actually get this region. self.assertTrue(region_list.GetMemoryRegionAtIndex(i, region)) - #Every region in the list should be mapped. + # Every region in the list should be mapped. self.assertTrue(region.IsMapped()) - # Test the address at the start of a region returns it's enclosing region. + # Test the address at the start of a region returns it's enclosing + # region. begin_address = region.GetRegionBase() region_at_begin = lldb.SBMemoryRegionInfo() error = process.GetMemoryRegionInfo(begin_address, region_at_begin) self.assertEqual(region, region_at_begin) - # Test an address in the middle of a region returns it's enclosing region. - middle_address = (region.GetRegionBase() + region.GetRegionEnd()) / 2l + # Test an address in the middle of a region returns it's enclosing + # region. + middle_address = (region.GetRegionBase() + + region.GetRegionEnd()) / 2 region_at_middle = lldb.SBMemoryRegionInfo() - error = process.GetMemoryRegionInfo(middle_address, region_at_middle) + error = process.GetMemoryRegionInfo( + middle_address, region_at_middle) self.assertEqual(region, region_at_middle) - # Test the address at the end of a region returns it's enclosing region. - end_address = region.GetRegionEnd() - 1l + # Test the address at the end of a region returns it's enclosing + # region. + end_address = region.GetRegionEnd() - 1 region_at_end = lldb.SBMemoryRegionInfo() error = process.GetMemoryRegionInfo(end_address, region_at_end) self.assertEqual(region, region_at_end) @@ -124,18 +143,24 @@ class LinuxCoreTestCase(TestBase): # Check that quering the end address does not return this region but # the next one. next_region = lldb.SBMemoryRegionInfo() - error = process.GetMemoryRegionInfo(region.GetRegionEnd(), next_region) + error = process.GetMemoryRegionInfo( + region.GetRegionEnd(), next_region) self.assertNotEqual(region, next_region) - self.assertEqual(region.GetRegionEnd(), next_region.GetRegionBase()) + self.assertEqual( + region.GetRegionEnd(), + next_region.GetRegionBase()) # Check that query beyond the last region returns an unmapped region # that ends at LLDB_INVALID_ADDRESS last_region = lldb.SBMemoryRegionInfo() region_list.GetMemoryRegionAtIndex(region_count - 1, last_region) end_region = lldb.SBMemoryRegionInfo() - error = process.GetMemoryRegionInfo(last_region.GetRegionEnd(), end_region) + error = process.GetMemoryRegionInfo( + last_region.GetRegionEnd(), end_region) self.assertFalse(end_region.IsMapped()) - self.assertEqual(last_region.GetRegionEnd(), end_region.GetRegionBase()) + self.assertEqual( + last_region.GetRegionEnd(), + end_region.GetRegionBase()) self.assertEqual(end_region.GetRegionEnd(), lldb.LLDB_INVALID_ADDRESS) def do_test(self, filename, pid, region_count): @@ -155,8 +180,10 @@ class LinuxCoreTestCase(TestBase): self.assertTrue(frame) self.assertEqual(frame.GetFunctionName(), backtrace[i]) self.assertEqual(frame.GetLineEntry().GetLine(), - line_number("main.c", "Frame " + backtrace[i])) - self.assertEqual(frame.FindVariable("F").GetValueAsUnsigned(), ord(backtrace[i][0])) + line_number("main.c", "Frame " + backtrace[i])) + self.assertEqual( + frame.FindVariable("F").GetValueAsUnsigned(), ord( + backtrace[i][0])) self.check_memory_regions(process, region_count) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py index 89d1974b670..8c375f7d862 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py @@ -11,6 +11,7 @@ from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class MiniDumpTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @@ -35,12 +36,13 @@ class MiniDumpTestCase(TestBase): self.dbg.CreateTarget("") self.target = self.dbg.GetSelectedTarget() self.process = self.target.LoadCore("fizzbuzz_no_heap.dmp") - # This process crashed due to an access violation (0xc0000005) in its one and only thread. + # This process crashed due to an access violation (0xc0000005) in its + # one and only thread. self.assertEqual(self.process.GetNumThreads(), 1) thread = self.process.GetThreadAtIndex(0) self.assertEqual(thread.GetStopReason(), lldb.eStopReasonException) - stop_description = thread.GetStopDescription(256); - self.assertTrue("0xc0000005" in stop_description); + stop_description = thread.GetStopDescription(256) + self.assertTrue("0xc0000005" in stop_description) @skipUnlessWindows # for now mini-dump debugging is limited to Windows hosts @no_debug_info_test @@ -72,7 +74,8 @@ class MiniDumpTestCase(TestBase): # Set a breakpoint and capture a mini dump. target = self.dbg.CreateTarget(exe) breakpoint = target.BreakpointCreateByName("bar") - process = target.LaunchSimple(None, None, self.get_process_working_directory()) + process = target.LaunchSimple( + None, None, self.get_process_working_directory()) self.assertEqual(process.GetState(), lldb.eStateStopped) self.assertTrue(process.SaveCore(core)) self.assertTrue(os.path.isfile(core)) @@ -83,7 +86,7 @@ class MiniDumpTestCase(TestBase): process = target.LoadCore(core) thread = process.GetThreadAtIndex(0) - expected_stack = { 0: 'bar', 1: 'foo', 2: 'main' } + expected_stack = {0: 'bar', 1: 'foo', 2: 'main'} self.assertGreaterEqual(thread.GetNumFrames(), len(expected_stack)) for index, name in iteritems(expected_stack): frame = thread.GetFrameAtIndex(index) @@ -108,7 +111,8 @@ class MiniDumpTestCase(TestBase): # Set a breakpoint and capture a mini dump. target = self.dbg.CreateTarget(exe) breakpoint = target.BreakpointCreateByName("bar") - process = target.LaunchSimple(None, None, self.get_process_working_directory()) + process = target.LaunchSimple( + None, None, self.get_process_working_directory()) self.assertEqual(process.GetState(), lldb.eStateStopped) self.assertTrue(process.SaveCore(core)) self.assertTrue(os.path.isfile(core)) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py index 08debab538f..d68871a34fb 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py @@ -16,6 +16,7 @@ from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class Wow64MiniDumpTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @@ -66,7 +67,8 @@ class Wow64MiniDumpTestCase(TestBase): # In the dump, none of the threads are stopped, so we cannot use # lldbutil.get_stopped_thread. thread = process.GetThreadAtIndex(0) - # The crash is in main, so there should be at least one frame on the stack. + # The crash is in main, so there should be at least one frame on the + # stack. self.assertGreaterEqual(thread.GetNumFrames(), 1) frame = thread.GetFrameAtIndex(0) self.assertTrue(frame.IsValid()) |