diff options
| author | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
|---|---|---|
| committer | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
| commit | b9c1b51e45b845debb76d8658edabca70ca56079 (patch) | |
| tree | dfcb5a13ef2b014202340f47036da383eaee74aa /lldb/packages/Python/lldbsuite/test/functionalities/unwind | |
| parent | d5aa73376966339caad04013510626ec2e42c760 (diff) | |
| download | bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip | |
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has
*** two obvious implications:
Firstly, merging this particular commit into a downstream fork may be a huge
effort. Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit. The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):
find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;
The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.
Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit. There are alternatives available that will attempt
to look through this change and find the appropriate prior commit. YMMV.
llvm-svn: 280751
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/unwind')
4 files changed, 106 insertions, 54 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/TestEhFrameUnwind.py b/lldb/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/TestEhFrameUnwind.py index e17d5d36d39..a855be7536c 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/TestEhFrameUnwind.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/TestEhFrameUnwind.py @@ -5,20 +5,20 @@ Test that we can backtrace correctly from Non ABI functions on the stack from __future__ import print_function - -import os, time +import os +import time import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class EHFrameBasedUnwind(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessPlatform(['linux']) @skipIf(archs=["aarch64", "arm", "i386", "i686"]) - def test (self): + def test(self): """Test that we can backtrace correctly from Non ABI functions on the stack""" self.build() self.setTearDownCleanup() @@ -28,9 +28,10 @@ class EHFrameBasedUnwind(TestBase): self.assertTrue(target, VALID_TARGET) - lldbutil.run_break_set_by_symbol (self, "func") + lldbutil.run_break_set_by_symbol(self, "func") - process = target.LaunchSimple (["abc", "xyz"], None, self.get_process_working_directory()) + process = target.LaunchSimple( + ["abc", "xyz"], None, self.get_process_working_directory()) if not process: self.fail("SBTarget.Launch() failed") @@ -42,10 +43,10 @@ class EHFrameBasedUnwind(TestBase): stacktraces = lldbutil.print_stacktraces(process, string_buffer=True) self.expect(stacktraces, exe=False, - substrs = ['(int)argc=3']) + substrs=['(int)argc=3']) self.runCmd("thread step-inst") stacktraces = lldbutil.print_stacktraces(process, string_buffer=True) self.expect(stacktraces, exe=False, - substrs = ['(int)argc=3']) + substrs=['(int)argc=3']) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py b/lldb/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py index 62c6c16080a..e5c9c907727 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py @@ -5,18 +5,19 @@ Test that we can backtrace correctly with 'noreturn' functions on the stack from __future__ import print_function - -import os, time +import os +import time import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class NoreturnUnwind(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipIfWindows # clang-cl does not support gcc style attributes. - def test (self): + @skipIfWindows # clang-cl does not support gcc style attributes. + def test(self): """Test that we can backtrace correctly with 'noreturn' functions on the stack""" self.build() self.setTearDownCleanup() @@ -25,7 +26,8 @@ class NoreturnUnwind(TestBase): target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) - process = target.LaunchSimple (None, None, self.get_process_working_directory()) + process = target.LaunchSimple( + None, None, self.get_process_working_directory()) if not process: self.fail("SBTarget.Launch() failed") @@ -55,22 +57,27 @@ class NoreturnUnwind(TestBase): self.fail("Unable to find abort() in backtrace.") func_c_frame_number = abort_frame_number + 1 - if thread.GetFrameAtIndex (func_c_frame_number).GetFunctionName() != "func_c": + if thread.GetFrameAtIndex( + func_c_frame_number).GetFunctionName() != "func_c": self.fail("Did not find func_c() above abort().") # This depends on whether we see the func_b inlined function in the backtrace # or not. I'm not interested in testing that aspect of the backtrace here # right now. - if thread.GetFrameAtIndex (func_c_frame_number + 1).GetFunctionName() == "func_b": + if thread.GetFrameAtIndex( + func_c_frame_number + + 1).GetFunctionName() == "func_b": func_a_frame_number = func_c_frame_number + 2 else: func_a_frame_number = func_c_frame_number + 1 - if thread.GetFrameAtIndex (func_a_frame_number).GetFunctionName() != "func_a": + if thread.GetFrameAtIndex( + func_a_frame_number).GetFunctionName() != "func_a": self.fail("Did not find func_a() above func_c().") main_frame_number = func_a_frame_number + 1 - if thread.GetFrameAtIndex (main_frame_number).GetFunctionName() != "main": + if thread.GetFrameAtIndex( + main_frame_number).GetFunctionName() != "main": self.fail("Did not find main() above func_a().") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/TestSigtrampUnwind.py b/lldb/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/TestSigtrampUnwind.py index d2b36412f1f..e35bb966c91 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/TestSigtrampUnwind.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/TestSigtrampUnwind.py @@ -5,20 +5,21 @@ Test that we can backtrace correctly with 'sigtramp' functions on the stack from __future__ import print_function - -import os, time +import os +import time import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class SigtrampUnwind(TestBase): mydir = TestBase.compute_mydir(__file__) # On different platforms the "_sigtramp" and "__kill" frames are likely to be different. # This test could probably be adapted to run on linux/*bsd easily enough. @skipUnlessDarwin - def test (self): + def test(self): """Test that we can backtrace correctly with _sigtramp on the stack""" self.build() self.setTearDownCleanup() @@ -27,10 +28,11 @@ class SigtrampUnwind(TestBase): target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) + lldbutil.run_break_set_by_file_and_line(self, "main.c", line_number( + 'main.c', '// Set breakpoint here'), num_expected_locations=1) - lldbutil.run_break_set_by_file_and_line (self, "main.c", line_number('main.c', '// Set breakpoint here'), num_expected_locations=1) - - process = target.LaunchSimple (None, None, self.get_process_working_directory()) + process = target.LaunchSimple( + None, None, self.get_process_working_directory()) if not process: self.fail("SBTarget.Launch() failed") @@ -40,10 +42,20 @@ class SigtrampUnwind(TestBase): "instead the actual state is: '%s'" % lldbutil.state_type_to_str(process.GetState())) - self.expect("pro handle -n false -p true -s false SIGUSR1", "Have lldb pass SIGUSR1 signals", - substrs = ["SIGUSR1", "true", "false", "false"]) - - lldbutil.run_break_set_by_symbol (self, "handler", num_expected_locations=1, module_name="a.out") + self.expect( + "pro handle -n false -p true -s false SIGUSR1", + "Have lldb pass SIGUSR1 signals", + substrs=[ + "SIGUSR1", + "true", + "false", + "false"]) + + lldbutil.run_break_set_by_symbol( + self, + "handler", + num_expected_locations=1, + module_name="a.out") self.runCmd("continue") @@ -69,14 +81,14 @@ class SigtrampUnwind(TestBase): for f in thread.frames: print(" %d %s" % (f.GetFrameID(), f.GetFunctionName())) - if found_handler == False: + if not found_handler: self.fail("Unable to find handler() in backtrace.") - if found_sigtramp == False: + if not found_sigtramp: self.fail("Unable to find _sigtramp() in backtrace.") - if found_kill == False: + if not found_kill: self.fail("Unable to find kill() in backtrace.") - if found_main == False: + if not found_main: self.fail("Unable to find main() in backtrace.") 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) |

