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