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/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp | |
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/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp')
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp index fedd8f66a1f..1862bbd9298 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp @@ -887,6 +887,23 @@ void PythonCallable::Reset(PyRefType type, PyObject *py_obj) { PythonObject::Reset(PyRefType::Borrowed, result.get()); } +PythonCallable::ArgInfo PythonCallable::GetNumInitArguments() const { + ArgInfo result = {0, false, false, false}; + if (!IsValid()) + return result; + PyObject *py_func_obj = m_py_obj; + if (!PyClass_Check(m_py_obj)) + return result; + + PythonObject __init__ = GetAttributeValue("__init__"); + if (__init__.IsValid() ) { + auto __init_callable__ = __init__.AsType<PythonCallable>(); + if (__init_callable__.IsValid()) + return __init_callable__.GetNumArguments(); + } + return result; +} + PythonCallable::ArgInfo PythonCallable::GetNumArguments() const { ArgInfo result = {0, false, false, false}; if (!IsValid()) |