diff options
| author | Jim Ingham <jingham@apple.com> | 2016-05-03 00:14:52 +0000 |
|---|---|---|
| committer | Jim Ingham <jingham@apple.com> | 2016-05-03 00:14:52 +0000 |
| commit | c7468b7b9657963fe8279f133f46753fddece7a9 (patch) | |
| tree | 9f95e6f6a6e5a0d58b2d177c402e440af57eb181 /lldb/examples | |
| parent | 091d8fd95194160103e27364734ed29786bc8af6 (diff) | |
| download | bcm5719-llvm-c7468b7b9657963fe8279f133f46753fddece7a9.tar.gz bcm5719-llvm-c7468b7b9657963fe8279f133f46753fddece7a9.zip | |
Another little example use of scripted thread plans.
llvm-svn: 268338
Diffstat (limited to 'lldb/examples')
| -rw-r--r-- | lldb/examples/python/scripted_step.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lldb/examples/python/scripted_step.py b/lldb/examples/python/scripted_step.py index 8affb9e8322..6be39718872 100644 --- a/lldb/examples/python/scripted_step.py +++ b/lldb/examples/python/scripted_step.py @@ -184,3 +184,28 @@ class StepCheckingCondition: def should_step (self): return True +# Here's an example that steps out of the current frame, gathers some information +# and then continues. The information in this case is rax. Currently the thread +# plans are not a safe place to call lldb command-line commands, so the information +# is gathered through SB API calls. + +class FinishPrintAndContinue: + def __init__ (self, thread_plan, dict): + self.thread_plan = thread_plan + self.step_out_thread_plan = thread_plan.QueueThreadPlanForStepOut(0, True) + self.thread = self.thread_plan.GetThread() + + def explains_stop (self, event): + return False + + def should_stop (self, event): + if self.step_out_thread_plan.IsPlanComplete(): + frame_0 = self.thread.frames[0] + rax_value = frame_0.FindRegister("rax") + if rax_value.GetError().Success(): + print "RAX on exit: ", rax_value.GetValue() + else: + print "Couldn't get rax value:", rax_value.GetError().GetCString() + + self.thread_plan.SetPlanComplete(True) + return False |

