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/expression_command/call-restarts | |
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/expression_command/call-restarts')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/expression_command/call-restarts/TestCallThatRestarts.py | 150 |
1 files changed, 97 insertions, 53 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/call-restarts/TestCallThatRestarts.py b/lldb/packages/Python/lldbsuite/test/expression_command/call-restarts/TestCallThatRestarts.py index 6b754a76878..bef4be1eb5f 100644 --- a/lldb/packages/Python/lldbsuite/test/expression_command/call-restarts/TestCallThatRestarts.py +++ b/lldb/packages/Python/lldbsuite/test/expression_command/call-restarts/TestCallThatRestarts.py @@ -5,12 +5,12 @@ Test calling a function that hits a signal set to auto-restart, make sure the ca from __future__ import print_function - import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class ExprCommandThatRestartsTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @@ -20,24 +20,30 @@ class ExprCommandThatRestartsTestCase(TestBase): TestBase.setUp(self) self.main_source = "lotta-signals.c" - self.main_source_spec = lldb.SBFileSpec (self.main_source) + self.main_source_spec = lldb.SBFileSpec(self.main_source) - @skipIfFreeBSD # llvm.org/pr19246: intermittent failure - @skipIfDarwin # llvm.org/pr19246: intermittent failure - @skipIfWindows # Test relies on signals, unsupported on Windows + @skipIfFreeBSD # llvm.org/pr19246: intermittent failure + @skipIfDarwin # llvm.org/pr19246: intermittent failure + @skipIfWindows # Test relies on signals, unsupported on Windows def test(self): """Test calling function that hits a signal and restarts.""" self.build() self.call_function() - def check_after_call (self, num_sigchld): + def check_after_call(self, num_sigchld): after_call = self.sigchld_no.GetValueAsSigned(-1) - self.assertTrue (after_call - self.start_sigchld_no == num_sigchld, "Really got %d SIGCHLD signals through the call."%(num_sigchld)) + self.assertTrue( + after_call - + self.start_sigchld_no == num_sigchld, + "Really got %d SIGCHLD signals through the call." % + (num_sigchld)) self.start_sigchld_no = after_call # Check that we are back where we were before: frame = self.thread.GetFrameAtIndex(0) - self.assertTrue (self.orig_frame_pc == frame.GetPC(), "Restored the zeroth frame correctly") + self.assertTrue( + self.orig_frame_pc == frame.GetPC(), + "Restored the zeroth frame correctly") def call_function(self): exe_name = "a.out" @@ -46,95 +52,133 @@ class ExprCommandThatRestartsTestCase(TestBase): target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) empty = lldb.SBFileSpec() - breakpoint = target.BreakpointCreateBySourceRegex('Stop here in main.',self.main_source_spec) + breakpoint = target.BreakpointCreateBySourceRegex( + 'Stop here in main.', self.main_source_spec) self.assertTrue(breakpoint.GetNumLocations() > 0, VALID_BREAKPOINT) # Launch the process, and do not stop at the entry point. - process = target.LaunchSimple (None, None, self.get_process_working_directory()) + process = target.LaunchSimple( + None, None, self.get_process_working_directory()) self.assertTrue(process, PROCESS_IS_VALID) # Frame #0 should be at our breakpoint. - threads = lldbutil.get_threads_stopped_at_breakpoint (process, breakpoint) - + threads = lldbutil.get_threads_stopped_at_breakpoint( + process, breakpoint) + self.assertTrue(len(threads) == 1) self.thread = threads[0] - + # Make sure the SIGCHLD behavior is pass/no-stop/no-notify: return_obj = lldb.SBCommandReturnObject() - self.dbg.GetCommandInterpreter().HandleCommand("process handle SIGCHLD -s 0 -p 1 -n 0", return_obj) - self.assertTrue (return_obj.Succeeded() == True, "Set SIGCHLD to pass, no-stop") + self.dbg.GetCommandInterpreter().HandleCommand( + "process handle SIGCHLD -s 0 -p 1 -n 0", return_obj) + self.assertTrue(return_obj.Succeeded(), "Set SIGCHLD to pass, no-stop") # The sigchld_no variable should be 0 at this point. self.sigchld_no = target.FindFirstGlobalVariable("sigchld_no") - self.assertTrue (self.sigchld_no.IsValid(), "Got a value for sigchld_no") + self.assertTrue( + self.sigchld_no.IsValid(), + "Got a value for sigchld_no") - self.start_sigchld_no = self.sigchld_no.GetValueAsSigned (-1) - self.assertTrue (self.start_sigchld_no != -1, "Got an actual value for sigchld_no") + self.start_sigchld_no = self.sigchld_no.GetValueAsSigned(-1) + self.assertTrue( + self.start_sigchld_no != -1, + "Got an actual value for sigchld_no") options = lldb.SBExpressionOptions() - # processing 30 signals takes a while, increase the expression timeout a bit - options.SetTimeoutInMicroSeconds(3000000) # 3s + # processing 30 signals takes a while, increase the expression timeout + # a bit + options.SetTimeoutInMicroSeconds(3000000) # 3s options.SetUnwindOnError(True) frame = self.thread.GetFrameAtIndex(0) - # Store away the PC to check that the functions unwind to the right place after calls + # Store away the PC to check that the functions unwind to the right + # place after calls self.orig_frame_pc = frame.GetPC() num_sigchld = 30 - value = frame.EvaluateExpression ("call_me (%d)"%(num_sigchld), options) - self.assertTrue (value.IsValid()) - self.assertTrue (value.GetError().Success() == True) - self.assertTrue (value.GetValueAsSigned(-1) == num_sigchld) + value = frame.EvaluateExpression( + "call_me (%d)" % + (num_sigchld), options) + self.assertTrue(value.IsValid()) + self.assertTrue(value.GetError().Success()) + self.assertTrue(value.GetValueAsSigned(-1) == num_sigchld) self.check_after_call(num_sigchld) # Okay, now try with a breakpoint in the called code in the case where # we are ignoring breakpoint hits. - handler_bkpt = target.BreakpointCreateBySourceRegex("Got sigchld %d.", self.main_source_spec) - self.assertTrue (handler_bkpt.GetNumLocations() > 0) + handler_bkpt = target.BreakpointCreateBySourceRegex( + "Got sigchld %d.", self.main_source_spec) + self.assertTrue(handler_bkpt.GetNumLocations() > 0) options.SetIgnoreBreakpoints(True) options.SetUnwindOnError(True) - value = frame.EvaluateExpression("call_me (%d)"%(num_sigchld), options) + value = frame.EvaluateExpression( + "call_me (%d)" % + (num_sigchld), options) - self.assertTrue (value.IsValid() and value.GetError().Success() == True) - self.assertTrue (value.GetValueAsSigned(-1) == num_sigchld) + self.assertTrue(value.IsValid() and value.GetError().Success()) + self.assertTrue(value.GetValueAsSigned(-1) == num_sigchld) self.check_after_call(num_sigchld) - # Now set the signal to print but not stop and make sure that calling still works: - self.dbg.GetCommandInterpreter().HandleCommand("process handle SIGCHLD -s 0 -p 1 -n 1", return_obj) - self.assertTrue (return_obj.Succeeded() == True, "Set SIGCHLD to pass, no-stop, notify") + # Now set the signal to print but not stop and make sure that calling + # still works: + self.dbg.GetCommandInterpreter().HandleCommand( + "process handle SIGCHLD -s 0 -p 1 -n 1", return_obj) + self.assertTrue( + return_obj.Succeeded(), + "Set SIGCHLD to pass, no-stop, notify") - value = frame.EvaluateExpression("call_me (%d)"%(num_sigchld), options) + value = frame.EvaluateExpression( + "call_me (%d)" % + (num_sigchld), options) - self.assertTrue (value.IsValid() and value.GetError().Success() == True) - self.assertTrue (value.GetValueAsSigned(-1) == num_sigchld) + self.assertTrue(value.IsValid() and value.GetError().Success()) + self.assertTrue(value.GetValueAsSigned(-1) == num_sigchld) self.check_after_call(num_sigchld) - # Now set this unwind on error to false, and make sure that we still complete the call: + # Now set this unwind on error to false, and make sure that we still + # complete the call: options.SetUnwindOnError(False) - value = frame.EvaluateExpression("call_me (%d)"%(num_sigchld), options) + value = frame.EvaluateExpression( + "call_me (%d)" % + (num_sigchld), options) - self.assertTrue (value.IsValid() and value.GetError().Success() == True) - self.assertTrue (value.GetValueAsSigned(-1) == num_sigchld) + self.assertTrue(value.IsValid() and value.GetError().Success()) + self.assertTrue(value.GetValueAsSigned(-1) == num_sigchld) self.check_after_call(num_sigchld) # Okay, now set UnwindOnError to true, and then make the signal behavior to stop # and see that now we do stop at the signal point: - - self.dbg.GetCommandInterpreter().HandleCommand("process handle SIGCHLD -s 1 -p 1 -n 1", return_obj) - self.assertTrue (return_obj.Succeeded() == True, "Set SIGCHLD to pass, stop, notify") - - value = frame.EvaluateExpression("call_me (%d)"%(num_sigchld), options) - self.assertTrue (value.IsValid() and value.GetError().Success() == False) - - # Set signal handling back to no-stop, and continue and we should end up back in out starting frame: - self.dbg.GetCommandInterpreter().HandleCommand("process handle SIGCHLD -s 0 -p 1 -n 1", return_obj) - self.assertTrue (return_obj.Succeeded() == True, "Set SIGCHLD to pass, no-stop, notify") + + self.dbg.GetCommandInterpreter().HandleCommand( + "process handle SIGCHLD -s 1 -p 1 -n 1", return_obj) + self.assertTrue( + return_obj.Succeeded(), + "Set SIGCHLD to pass, stop, notify") + + value = frame.EvaluateExpression( + "call_me (%d)" % + (num_sigchld), options) + self.assertTrue( + value.IsValid() and value.GetError().Success() == False) + + # Set signal handling back to no-stop, and continue and we should end + # up back in out starting frame: + self.dbg.GetCommandInterpreter().HandleCommand( + "process handle SIGCHLD -s 0 -p 1 -n 1", return_obj) + self.assertTrue( + return_obj.Succeeded(), + "Set SIGCHLD to pass, no-stop, notify") error = process.Continue() - self.assertTrue (error.Success(), "Continuing after stopping for signal succeeds.") - + self.assertTrue( + error.Success(), + "Continuing after stopping for signal succeeds.") + frame = self.thread.GetFrameAtIndex(0) - self.assertTrue (frame.GetPC() == self.orig_frame_pc, "Continuing returned to the place we started.") + self.assertTrue( + frame.GetPC() == self.orig_frame_pc, + "Continuing returned to the place we started.") |