diff options
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/unwind/standard')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py | 78 |
1 files changed, 55 insertions, 23 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py b/lldb/packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py index 20532c6fc67..2416128d2ef 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py @@ -13,9 +13,9 @@ after escaping some special characters). from __future__ import print_function - import unittest2 -import os, time +import os +import time import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * @@ -23,10 +23,11 @@ from lldbsuite.test import lldbutil test_source_dirs = ["."] + class StandardUnwindTest(TestBase): mydir = TestBase.compute_mydir(__file__) - def standard_unwind_tests (self): + def standard_unwind_tests(self): # The following variables have to be defined for each architecture and OS we testing for: # base_function_names: List of function names where we accept that the stack unwinding is # correct if they are on the stack. It should include the bottom most @@ -36,20 +37,27 @@ class StandardUnwindTest(TestBase): # instruction by instruction for any reason. (A valid reason is if # it is impossible to step through a function instruction by # instruction because it is special for some reason.) For these - # functions we will immediately do a step-out when we hit them. + # functions we will immediately do a step-out when we hit them. triple = self.dbg.GetSelectedPlatform().GetTriple() if re.match("arm-.*-.*-android", triple): base_function_names = [ "_start", # Base function on the stack "__memcpy_base", # Function reached by a fall through from the previous function - "__memcpy_base_aligned", # Function reached by a fall through from the previous function + "__memcpy_base_aligned", + # Function reached by a fall through from the previous function ] no_step_function_names = [ - "__sync_fetch_and_add_4", # Calls into a special SO where we can't set a breakpoint - "pthread_mutex_lock", # Uses ldrex and strex what interferes with the software single stepping - "pthread_mutex_unlock", # Uses ldrex and strex what interferes with the software single stepping - "pthread_once", # Uses ldrex and strex what interferes with the software single stepping + "__sync_fetch_and_add_4", # Calls into a special SO where we can't set a breakpoint + "pthread_mutex_lock", + # Uses ldrex and strex what interferes with the software single + # stepping + "pthread_mutex_unlock", + # Uses ldrex and strex what interferes with the software single + # stepping + "pthread_once", + # Uses ldrex and strex what interferes with the software single + # stepping ] elif re.match("aarch64-.*-.*-android", triple): base_function_names = [ @@ -57,11 +65,21 @@ class StandardUnwindTest(TestBase): ] no_step_function_names = [ None, - "__cxa_guard_acquire", # Uses ldxr and stxr what interferes with the software single stepping - "__cxa_guard_release", # Uses ldxr and stxr what interferes with the software single stepping - "pthread_mutex_lock", # Uses ldxr and stxr what interferes with the software single stepping - "pthread_mutex_unlock", # Uses ldxr and stxr what interferes with the software single stepping - "pthread_once", # Uses ldxr and stxr what interferes with the software single stepping + "__cxa_guard_acquire", + # Uses ldxr and stxr what interferes with the software single + # stepping + "__cxa_guard_release", + # Uses ldxr and stxr what interferes with the software single + # stepping + "pthread_mutex_lock", + # Uses ldxr and stxr what interferes with the software single + # stepping + "pthread_mutex_unlock", + # Uses ldxr and stxr what interferes with the software single + # stepping + "pthread_once", + # Uses ldxr and stxr what interferes with the software single + # stepping ] else: self.skipTest("No expectations for the current architecture") @@ -72,17 +90,23 @@ class StandardUnwindTest(TestBase): target.BreakpointCreateByName("main") - process = target.LaunchSimple (None, None, self.get_process_working_directory()) + process = target.LaunchSimple( + None, None, self.get_process_working_directory()) self.assertTrue(process is not None, "SBTarget.Launch() failed") - self.assertEqual(process.GetState(), lldb.eStateStopped, "The process didn't hit main") + self.assertEqual( + process.GetState(), + lldb.eStateStopped, + "The process didn't hit main") index = 0 while process.GetState() == lldb.eStateStopped: index += 1 if process.GetNumThreads() > 1: # In case of a multi threaded inferior if one of the thread is stopped in a blocking - # syscall and we try to step it then SBThread::StepInstruction() will block forever - self.skipTest("Multi threaded inferiors are not supported by this test") + # syscall and we try to step it then + # SBThread::StepInstruction() will block forever + self.skipTest( + "Multi threaded inferiors are not supported by this test") thread = process.GetThreadAtIndex(0) @@ -97,9 +121,11 @@ class StandardUnwindTest(TestBase): if f.GetFunctionName() in base_function_names: found_main = True break - self.assertTrue(found_main, "Main function isn't found on the backtrace") + self.assertTrue(found_main, + "Main function isn't found on the backtrace") - if thread.GetFrameAtIndex(0).GetFunctionName() in no_step_function_names: + if thread.GetFrameAtIndex( + 0).GetFunctionName() in no_step_function_names: thread.StepOut() else: thread.StepInstruction(False) @@ -113,13 +139,16 @@ for d in test_source_dirs: dirname = os.path.join(os.path.dirname(__file__), d) for root, _, files in os.walk(dirname): - test_source_files = test_source_files | set(os.path.abspath(os.path.join(root, f)) for f in files) + test_source_files = test_source_files | set( + os.path.abspath(os.path.join(root, f)) for f in files) # Generate test cases based on the collected source files for f in test_source_files: if f.endswith(".cpp") or f.endswith(".c"): @add_test_categories(["dwarf"]) - @unittest2.skipIf(TestBase.skipLongRunningTest(), "Skip this long running test") + @unittest2.skipIf( + TestBase.skipLongRunningTest(), + "Skip this long running test") def test_function_dwarf(self, f=f): if f.endswith(".cpp"): d = {'CXX_SOURCES': f} @@ -143,4 +172,7 @@ for f in test_source_files: test_name = test_name.replace(c, '_') test_function_dwarf.__name__ = test_name - setattr(StandardUnwindTest, test_function_dwarf.__name__, test_function_dwarf) + setattr( + StandardUnwindTest, + test_function_dwarf.__name__, + test_function_dwarf) |