9#ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SWIGPYTHONBRIDGE_H
10#define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SWIGPYTHONBRIDGE_H
15#include "lldb/Host/Config.h"
25#include "llvm/Support/Error.h"
41typedef struct swig_type_info swig_type_info;
43python::PythonObject ToSWIGHelper(
void *obj, swig_type_info *info);
47template <
typename T>
class ScopedPythonObject : PythonObject {
49 ScopedPythonObject(T *sb, swig_type_info *info)
50 : PythonObject(ToSWIGHelper(sb, info)), m_sb(sb) {}
51 ~ScopedPythonObject() {
55 ScopedPythonObject(ScopedPythonObject &&rhs)
56 : PythonObject(std::move(rhs)), m_sb(std::exchange(rhs.m_sb, nullptr)) {}
57 ScopedPythonObject(
const ScopedPythonObject &) =
delete;
58 ScopedPythonObject &operator=(
const ScopedPythonObject &) =
delete;
59 ScopedPythonObject &operator=(ScopedPythonObject &&) =
delete;
61 const PythonObject &obj()
const {
return *
this; }
83 static PythonObject ToSWIGWrapper(std::unique_ptr<lldb::SBValue> value_sb);
89 static PythonObject ToSWIGWrapper(
const Status &status);
90 static PythonObject ToSWIGWrapper(
const StructuredDataImpl &data_impl);
98 static PythonObject ToSWIGWrapper(
const TypeSummaryOptions &summary_options);
99 static PythonObject ToSWIGWrapper(
const SymbolContext &sym_ctx);
100 static PythonObject ToSWIGWrapper(
const Stream *stream);
101 static PythonObject ToSWIGWrapper(std::shared_ptr<lldb::SBStream> stream_sb);
102 static PythonObject ToSWIGWrapper(Event *event);
109 ToSWIGWrapper(std::unique_ptr<lldb::SBStructuredData> data_sb);
111 ToSWIGWrapper(std::unique_ptr<lldb::SBFileSpec> file_spec_sb);
113 ToSWIGWrapper(std::unique_ptr<lldb::SBModuleSpec> module_spec_sb);
115 static python::ScopedPythonObject<lldb::SBCommandReturnObject>
116 ToSWIGWrapper(CommandReturnObject &cmd_retobj);
121 static llvm::Expected<bool> LLDBSwigPythonBreakpointCallbackFunction(
122 const char *python_function_name,
const char *session_dictionary_name,
127 static bool LLDBSwigPythonWatchpointCallbackFunction(
128 const char *python_function_name,
const char *session_dictionary_name,
132 LLDBSwigPythonFormatterCallbackFunction(
const char *python_function_name,
133 const char *session_dictionary_name,
136 static bool LLDBSwigPythonCallTypeScript(
137 const char *python_function_name,
const void *session_dictionary,
141 static python::PythonObject
142 LLDBSwigPythonCreateSyntheticProvider(
const char *python_class_name,
143 const char *session_dictionary_name,
146 static python::PythonObject
147 LLDBSwigPythonCreateCommandObject(
const char *python_class_name,
148 const char *session_dictionary_name,
151 static python::PythonObject LLDBSwigPythonCreateScriptedBreakpointResolver(
152 const char *python_class_name,
const char *session_dictionary_name,
156 LLDBSwigPythonCallBreakpointResolver(
void *implementor,
157 const char *method_name,
160 static python::PythonObject LLDBSwigPythonCreateScriptedStopHook(
162 const char *session_dictionary_name,
const StructuredDataImpl &args,
166 LLDBSwigPythonStopHookCallHandleStop(
void *implementor,
170 static size_t LLDBSwigPython_CalculateNumChildren(PyObject *implementor,
173 static PyObject *LLDBSwigPython_GetChildAtIndex(PyObject *implementor,
176 static int LLDBSwigPython_GetIndexOfChildWithName(PyObject *implementor,
177 const char *child_name);
180 LLDBSWIGPython_GetValueObjectSPFromSBValue(
void *data);
182 static bool LLDBSwigPython_UpdateSynthProviderInstance(PyObject *implementor);
185 LLDBSwigPython_MightHaveChildrenSynthProviderInstance(PyObject *implementor);
188 LLDBSwigPython_GetValueSynthProviderInstance(PyObject *implementor);
191 LLDBSwigPythonCallCommand(
const char *python_function_name,
192 const char *session_dictionary_name,
198 LLDBSwigPythonCallCommandObject(PyObject *implementor,
203 LLDBSwigPythonCallParsedCommandObject(PyObject *implementor,
205 StructuredDataImpl &args_impl,
209 static std::optional<std::string>
210 LLDBSwigPythonGetRepeatCommandForScriptedCommand(PyObject *implementor,
211 std::string &command);
213 static bool LLDBSwigPythonCallModuleInit(
const char *python_module_name,
214 const char *session_dictionary_name,
217 static python::PythonObject
218 LLDBSWIGPythonCreateOSPlugin(
const char *python_class_name,
219 const char *session_dictionary_name,
222 static python::PythonObject
223 LLDBSWIGPython_CreateFrameRecognizer(
const char *python_class_name,
224 const char *session_dictionary_name);
227 LLDBSwigPython_GetRecognizedArguments(PyObject *implementor,
230 static bool LLDBSwigPython_ShouldHide(PyObject *implementor,
233 static bool LLDBSWIGPythonRunScriptKeywordProcess(
234 const char *python_function_name,
const char *session_dictionary_name,
237 static std::optional<std::string>
238 LLDBSWIGPythonRunScriptKeywordThread(
const char *python_function_name,
239 const char *session_dictionary_name,
242 static bool LLDBSWIGPythonRunScriptKeywordTarget(
243 const char *python_function_name,
const char *session_dictionary_name,
246 static std::optional<std::string>
247 LLDBSWIGPythonRunScriptKeywordFrame(
const char *python_function_name,
248 const char *session_dictionary_name,
251 static bool LLDBSWIGPythonRunScriptKeywordValue(
252 const char *python_function_name,
const char *session_dictionary_name,
256 LLDBSWIGPython_GetDynamicSetting(
void *module,
const char *setting,
260void *LLDBSWIGPython_CastPyObjectToSBData(PyObject *data);
261void *LLDBSWIGPython_CastPyObjectToSBBreakpoint(PyObject *data);
262void *LLDBSWIGPython_CastPyObjectToSBAttachInfo(PyObject *data);
263void *LLDBSWIGPython_CastPyObjectToSBLaunchInfo(PyObject *data);
264void *LLDBSWIGPython_CastPyObjectToSBError(PyObject *data);
265void *LLDBSWIGPython_CastPyObjectToSBEvent(PyObject *data);
266void *LLDBSWIGPython_CastPyObjectToSBStream(PyObject *data);
267void *LLDBSWIGPython_CastPyObjectToSBValue(PyObject *data);
268void *LLDBSWIGPython_CastPyObjectToSBMemoryRegionInfo(PyObject *data);
static llvm::raw_ostream & error(Stream &strm)
Set the output file path.
Defines a symbol context baton that can be handed other debug core functions.
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::ThreadPlan > ThreadPlanSP
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::BreakpointLocation > BreakpointLocationSP
class LLDB_API SBStructuredData
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::ProcessAttachInfo > ProcessAttachInfoSP
std::shared_ptr< lldb_private::TypeSummaryOptions > TypeSummaryOptionsSP
std::shared_ptr< lldb_private::Stream > StreamSP
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::Debugger > DebuggerSP
std::shared_ptr< lldb_private::Watchpoint > WatchpointSP
class LLDB_API SBStringList
std::shared_ptr< lldb_private::TypeImpl > TypeImplSP
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::DataExtractor > DataExtractorSP
std::shared_ptr< lldb_private::ProcessLaunchInfo > ProcessLaunchInfoSP
class LLDB_API SBModuleSpec
class LLDB_API SBCommandReturnObject
std::shared_ptr< lldb_private::ExecutionContextRef > ExecutionContextRefSP