diff options
| author | Alex Langford <alangford@apple.com> | 2023-01-26 17:33:33 -0800 |
|---|---|---|
| committer | Alex Langford <alangford@apple.com> | 2023-02-16 11:18:04 -0800 |
| commit | 662548c82683bd8657a3179afee693c4965a3dfd (patch) | |
| tree | f1d6df4e4ed17672c186e0d5df551bc5916e8d10 /lldb/bindings/python | |
| parent | 23d43e6977576ed318a9c81cec256d75f5d49ded (diff) | |
| download | llvm-662548c82683bd8657a3179afee693c4965a3dfd.tar.gz llvm-662548c82683bd8657a3179afee693c4965a3dfd.tar.bz2 llvm-662548c82683bd8657a3179afee693c4965a3dfd.zip | |
[lldb] Replace SB swig interfaces with API headers
Instead of maintaining separate swig interface files, we can use the API
headers directly. They implement the exact same C++ APIs and we can
conditionally include the python extensions as needed. To remove the
swig extensions from the API headers when building the LLDB
framework, we can use the unifdef tool when it is available. Otherwise
we just copy them as-is.
Differential Revision: https://reviews.llvm.org/D142926
Diffstat (limited to 'lldb/bindings/python')
| -rw-r--r-- | lldb/bindings/python/python-typemaps.swig | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lldb/bindings/python/python-typemaps.swig b/lldb/bindings/python/python-typemaps.swig index b321cc24c9af..2057aa6b42b6 100644 --- a/lldb/bindings/python/python-typemaps.swig +++ b/lldb/bindings/python/python-typemaps.swig @@ -525,3 +525,30 @@ template <> bool SetNumberFromPyObject<double>(double &number, PyObject *obj) { %pybuffer_binary(const uint8_t *buf, size_t num_bytes); %pybuffer_mutable_binary(uint8_t *buf, size_t num_bytes); + +%typemap(in) (const char **symbol_name, uint32_t num_names) { + using namespace lldb_private; + /* Check if is a list */ + if (PythonList::Check($input)) { + PythonList list(PyRefType::Borrowed, $input); + $2 = list.GetSize(); + int i = 0; + $1 = (char**)malloc(($2+1)*sizeof(char*)); + for (i = 0; i < $2; i++) { + PythonString py_str = list.GetItemAtIndex(i).AsType<PythonString>(); + if (!py_str.IsAllocated()) { + PyErr_SetString(PyExc_TypeError,"list must contain strings and blubby"); + free($1); + return nullptr; + } + + $1[i] = const_cast<char*>(py_str.GetString().data()); + } + $1[i] = 0; + } else if ($input == Py_None) { + $1 = NULL; + } else { + PyErr_SetString(PyExc_TypeError,"not a list"); + return NULL; + } +} |
