[Lldb-commits] [PATCH] D68366: Parametrize scripted ThreadPlans using SBStructuredData

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 2 17:58:11 PDT 2019


jingham created this revision.
jingham added reviewers: labath, JDevlieghere, aprantl.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
jingham added a parent revision: D68363: Segregate the Python class + key/value dictionary into a separate OptionGroup.

It is trivial to write a ScriptedThreadPlan to do "step until the variable 'foo' changes value".  It is equally easy to write one that does "step until the variable 'bar' changes value".  But you would have to write a different Python class for each of these tasks, since there's no way to pass parameters into the ThreadPlan on creation.

This patch adds that ability.  You can say:

(lldb) thread step-scripted -C Module.ThreadPlan -k variable_name -v foo

lldb will package the key and value into an SBStructuredData dictionary, and pass that to the __init__ method of the ThreadPlan class.  Then the ThreadPlan can fetch the value for that key from the dictionary and watch that variable.

I also added an SB API that allows you to pass any SBStructuredData to SBThread.StepUsingScriptedThreadPlan, if you need to pass in something more complex than a simple key/value dictionary.

This revision depends on:

https://reviews.llvm.org/D68363

Not sure who to put on to review this, most of the folks who worked actively on the PythonObjects aren't really active anymore...  I added folks who touched some of the relevant files recently...


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D68366

Files:
  lldb/include/lldb/API/SBStructuredData.h
  lldb/include/lldb/API/SBThread.h
  lldb/include/lldb/API/SBThreadPlan.h
  lldb/include/lldb/Interpreter/ScriptInterpreter.h
  lldb/include/lldb/Target/Thread.h
  lldb/include/lldb/Target/ThreadPlanPython.h
  lldb/packages/Python/lldbsuite/test/functionalities/step_scripted/Steps.py
  lldb/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py
  lldb/scripts/Python/python-wrapper.swig
  lldb/scripts/interface/SBThread.i
  lldb/scripts/interface/SBThreadPlan.i
  lldb/source/API/SBThread.cpp
  lldb/source/API/SBThreadPlan.cpp
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
  lldb/source/Target/Thread.cpp
  lldb/source/Target/ThreadPlanPython.cpp
  lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68366.222941.patch
Type: text/x-patch
Size: 34665 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191003/03cef838/attachment-0001.bin>


More information about the lldb-commits mailing list