diff options
author | Jim Ingham <jingham@apple.com> | 2019-10-03 22:50:18 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2019-10-03 22:50:18 +0000 |
commit | 27a14f19c810f494adddb8aaff960336ab4492e7 (patch) | |
tree | a7eae222175b77917ee9ccfd1b0f21555d7118f4 /lldb/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py | |
parent | 145cdad11925194ec41949b5c8f0cb037f9e7941 (diff) | |
download | bcm5719-llvm-27a14f19c810f494adddb8aaff960336ab4492e7.tar.gz bcm5719-llvm-27a14f19c810f494adddb8aaff960336ab4492e7.zip |
Pass an SBStructuredData to scripted ThreadPlans on use.
This will allow us to write reusable scripted ThreadPlans, since
you can use key/value pairs with known keys in the plan to parametrize
its behavior.
Differential Revision: https://reviews.llvm.org/D68366
llvm-svn: 373675
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py b/lldb/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py index cadadde9677..eb1b5822580 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py @@ -63,7 +63,14 @@ class StepScriptedTestCase(TestBase): self.assertEqual(stop_id, process.GetStopID(), "Process didn't run") def test_checking_variable(self): - """Test that we can call SBValue API's from a scripted thread plan""" + """Test that we can call SBValue API's from a scripted thread plan - using SBAPI's to step""" + self.do_test_checking_variable(False) + + def test_checking_variable_cli(self): + """Test that we can call SBValue API's from a scripted thread plan - using cli to step""" + self.do_test_checking_variable(True) + + def do_test_checking_variable(self, use_cli): self.build() (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, "Set a breakpoint here", @@ -75,8 +82,21 @@ class StepScriptedTestCase(TestBase): self.assertTrue(foo_val.GetError().Success(), "Got the foo variable") self.assertEqual(foo_val.GetValueAsUnsigned(), 10, "foo starts at 10") - err = thread.StepUsingScriptedThreadPlan("Steps.StepUntil") - self.assertTrue(err.Success(), err.GetCString()) + if use_cli: + result = lldb.SBCommandReturnObject() + self.dbg.GetCommandInterpreter().HandleCommand( + "thread step-scripted -C Steps.StepUntil -k variable_name -v foo", + result) + self.assertTrue(result.Succeeded()) + else: + args_data = lldb.SBStructuredData() + data = lldb.SBStream() + data.Print('{"variable_name" : "foo"}') + error = args_data.SetFromJSON(data) + self.assertTrue(error.Success(), "Made the args_data correctly") + + err = thread.StepUsingScriptedThreadPlan("Steps.StepUntil", args_data, True) + self.assertTrue(err.Success(), err.GetCString()) # We should not have exited: self.assertEqual(process.GetState(), lldb.eStateStopped, "We are stopped") |