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