1 //===-- ScriptInterpreterPython.h -------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SWIGPYTHONBRIDGE_H 10 #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SWIGPYTHONBRIDGE_H 11 12 #include "lldb/Host/Config.h" 13 14 #if LLDB_ENABLE_PYTHON 15 16 #include "lldb/lldb-forward.h" 17 #include "lldb/lldb-types.h" 18 19 namespace lldb_private { 20 21 // GetPythonValueFormatString provides a system independent type safe way to 22 // convert a variable's type into a python value format. Python value formats 23 // are defined in terms of builtin C types and could change from system to as 24 // the underlying typedef for uint* types, size_t, off_t and other values 25 // change. 26 27 template <typename T> const char *GetPythonValueFormatString(T t); 28 template <> const char *GetPythonValueFormatString(char *); 29 template <> const char *GetPythonValueFormatString(char); 30 template <> const char *GetPythonValueFormatString(unsigned char); 31 template <> const char *GetPythonValueFormatString(short); 32 template <> const char *GetPythonValueFormatString(unsigned short); 33 template <> const char *GetPythonValueFormatString(int); 34 template <> const char *GetPythonValueFormatString(unsigned int); 35 template <> const char *GetPythonValueFormatString(long); 36 template <> const char *GetPythonValueFormatString(unsigned long); 37 template <> const char *GetPythonValueFormatString(long long); 38 template <> const char *GetPythonValueFormatString(unsigned long long); 39 template <> const char *GetPythonValueFormatString(float t); 40 template <> const char *GetPythonValueFormatString(double t); 41 42 extern "C" void *LLDBSwigPythonCreateScriptedProcess( 43 const char *python_class_name, const char *session_dictionary_name, 44 const lldb::TargetSP &target_sp, StructuredDataImpl *args_impl, 45 std::string &error_string); 46 47 extern "C" void *LLDBSWIGPython_CastPyObjectToSBData(void *data); 48 extern "C" void *LLDBSWIGPython_CastPyObjectToSBError(void *data); 49 extern "C" void *LLDBSWIGPython_CastPyObjectToSBValue(void *data); 50 51 }; // namespace lldb_private 52 53 #endif // LLDB_ENABLE_PYTHON 54 #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SWIGPYTHONBRIDGE_H 55