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 <string> 13 14 #include "lldb/Host/Config.h" 15 16 #if LLDB_ENABLE_PYTHON 17 18 #include "lldb/lldb-forward.h" 19 #include "lldb/lldb-types.h" 20 21 namespace lldb_private { 22 23 // GetPythonValueFormatString provides a system independent type safe way to 24 // convert a variable's type into a python value format. Python value formats 25 // are defined in terms of builtin C types and could change from system to as 26 // the underlying typedef for uint* types, size_t, off_t and other values 27 // change. 28 29 template <typename T> const char *GetPythonValueFormatString(T t); 30 template <> const char *GetPythonValueFormatString(char *); 31 template <> const char *GetPythonValueFormatString(char); 32 template <> const char *GetPythonValueFormatString(unsigned char); 33 template <> const char *GetPythonValueFormatString(short); 34 template <> const char *GetPythonValueFormatString(unsigned short); 35 template <> const char *GetPythonValueFormatString(int); 36 template <> const char *GetPythonValueFormatString(unsigned int); 37 template <> const char *GetPythonValueFormatString(long); 38 template <> const char *GetPythonValueFormatString(unsigned long); 39 template <> const char *GetPythonValueFormatString(long long); 40 template <> const char *GetPythonValueFormatString(unsigned long long); 41 template <> const char *GetPythonValueFormatString(float t); 42 template <> const char *GetPythonValueFormatString(double t); 43 44 extern "C" void *LLDBSwigPythonCreateScriptedProcess( 45 const char *python_class_name, const char *session_dictionary_name, 46 const lldb::TargetSP &target_sp, StructuredDataImpl *args_impl, 47 std::string &error_string); 48 49 extern "C" void *LLDBSWIGPython_CastPyObjectToSBData(void *data); 50 extern "C" void *LLDBSWIGPython_CastPyObjectToSBError(void *data); 51 extern "C" void *LLDBSWIGPython_CastPyObjectToSBValue(void *data); 52 53 } // namespace lldb_private 54 55 #endif // LLDB_ENABLE_PYTHON 56 #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SWIGPYTHONBRIDGE_H 57