[lldb] Mark most SBAPI methods involving private types as protected or private

Many SB classes have public constructors or methods involving types that
are private. Some are more obvious (e.g. containing lldb_private in the
name) than others (lldb::FooSP is usually std::shared_pointer<lldb_private::Foo>).

This commit explicitly does not address FileSP, so I'm leaving that one
alone for now.

Some of these were for other SB classes to use and should have been made
protected/private with a friend class entry added. Some of these were
public for some of the swig python helpers to use. I put all of those
functions into a class and made them static methods. The relevant SB
classes mark that class as a friend so they can access those
private/protected members.

I've also removed an outdated SBStructuredData test (can you guess which
constructor it was using?) and updated the other relevant tests.

Differential Revision: https://reviews.llvm.org/D150157
This commit is contained in:
Alex Langford
2023-05-08 16:31:27 -07:00
parent b09953a4a3
commit 27b6a4e63a
38 changed files with 737 additions and 598 deletions

View File

@@ -5,117 +5,117 @@ PythonObject ToSWIGHelper(void *obj, swig_type_info *info) {
return {PyRefType::Owned, SWIG_NewPointerObj(obj, info, SWIG_POINTER_OWN)};
}
PythonObject ToSWIGWrapper(std::unique_ptr<lldb::SBValue> value_sb) {
PythonObject SWIGBridge::ToSWIGWrapper(std::unique_ptr<lldb::SBValue> value_sb) {
return ToSWIGHelper(value_sb.release(), SWIGTYPE_p_lldb__SBValue);
}
PythonObject ToSWIGWrapper(lldb::ValueObjectSP value_sp) {
return ToSWIGWrapper(std::make_unique<lldb::SBValue>(std::move(value_sp)));
PythonObject SWIGBridge::ToSWIGWrapper(lldb::ValueObjectSP value_sp) {
return ToSWIGWrapper(std::unique_ptr<lldb::SBValue>(new lldb::SBValue(value_sp)));
}
PythonObject ToSWIGWrapper(lldb::TargetSP target_sp) {
PythonObject SWIGBridge::ToSWIGWrapper(lldb::TargetSP target_sp) {
return ToSWIGHelper(new lldb::SBTarget(std::move(target_sp)),
SWIGTYPE_p_lldb__SBTarget);
}
PythonObject ToSWIGWrapper(lldb::ProcessSP process_sp) {
PythonObject SWIGBridge::ToSWIGWrapper(lldb::ProcessSP process_sp) {
return ToSWIGHelper(new lldb::SBProcess(std::move(process_sp)),
SWIGTYPE_p_lldb__SBProcess);
}
PythonObject ToSWIGWrapper(lldb::ThreadPlanSP thread_plan_sp) {
PythonObject SWIGBridge::ToSWIGWrapper(lldb::ThreadPlanSP thread_plan_sp) {
return ToSWIGHelper(new lldb::SBThreadPlan(std::move(thread_plan_sp)),
SWIGTYPE_p_lldb__SBThreadPlan);
}
PythonObject ToSWIGWrapper(lldb::BreakpointSP breakpoint_sp) {
PythonObject SWIGBridge::ToSWIGWrapper(lldb::BreakpointSP breakpoint_sp) {
return ToSWIGHelper(new lldb::SBBreakpoint(std::move(breakpoint_sp)),
SWIGTYPE_p_lldb__SBBreakpoint);
}
PythonObject ToSWIGWrapper(const Status& status) {
PythonObject SWIGBridge::ToSWIGWrapper(const Status& status) {
return ToSWIGHelper(new lldb::SBError(status), SWIGTYPE_p_lldb__SBError);
}
PythonObject ToSWIGWrapper(std::unique_ptr<lldb::SBStream> stream_sb) {
PythonObject SWIGBridge::ToSWIGWrapper(std::unique_ptr<lldb::SBStream> stream_sb) {
return ToSWIGHelper(stream_sb.release(), SWIGTYPE_p_lldb__SBStream);
}
PythonObject ToSWIGWrapper(std::unique_ptr<lldb::SBStructuredData> data_sb) {
PythonObject SWIGBridge::ToSWIGWrapper(std::unique_ptr<lldb::SBStructuredData> data_sb) {
return ToSWIGHelper(data_sb.release(), SWIGTYPE_p_lldb__SBStructuredData);
}
PythonObject ToSWIGWrapper(const StructuredDataImpl &data_impl) {
return ToSWIGWrapper(std::make_unique<lldb::SBStructuredData>(data_impl));
PythonObject SWIGBridge::ToSWIGWrapper(const StructuredDataImpl &data_impl) {
return ToSWIGWrapper(std::unique_ptr<lldb::SBStructuredData>(new lldb::SBStructuredData(data_impl)));
}
PythonObject ToSWIGWrapper(lldb::ThreadSP thread_sp) {
PythonObject SWIGBridge::ToSWIGWrapper(lldb::ThreadSP thread_sp) {
return ToSWIGHelper(new lldb::SBThread(std::move(thread_sp)),
SWIGTYPE_p_lldb__SBThread);
}
PythonObject ToSWIGWrapper(lldb::StackFrameSP frame_sp) {
PythonObject SWIGBridge::ToSWIGWrapper(lldb::StackFrameSP frame_sp) {
return ToSWIGHelper(new lldb::SBFrame(std::move(frame_sp)),
SWIGTYPE_p_lldb__SBFrame);
}
PythonObject ToSWIGWrapper(lldb::DebuggerSP debugger_sp) {
PythonObject SWIGBridge::ToSWIGWrapper(lldb::DebuggerSP debugger_sp) {
return ToSWIGHelper(new lldb::SBDebugger(std::move(debugger_sp)),
SWIGTYPE_p_lldb__SBDebugger);
}
PythonObject ToSWIGWrapper(lldb::WatchpointSP watchpoint_sp) {
PythonObject SWIGBridge::ToSWIGWrapper(lldb::WatchpointSP watchpoint_sp) {
return ToSWIGHelper(new lldb::SBWatchpoint(std::move(watchpoint_sp)),
SWIGTYPE_p_lldb__SBWatchpoint);
}
PythonObject ToSWIGWrapper(lldb::BreakpointLocationSP bp_loc_sp) {
PythonObject SWIGBridge::ToSWIGWrapper(lldb::BreakpointLocationSP bp_loc_sp) {
return ToSWIGHelper(new lldb::SBBreakpointLocation(std::move(bp_loc_sp)),
SWIGTYPE_p_lldb__SBBreakpointLocation);
}
PythonObject ToSWIGWrapper(lldb::ExecutionContextRefSP ctx_sp) {
PythonObject SWIGBridge::ToSWIGWrapper(lldb::ExecutionContextRefSP ctx_sp) {
return ToSWIGHelper(new lldb::SBExecutionContext(std::move(ctx_sp)),
SWIGTYPE_p_lldb__SBExecutionContext);
}
PythonObject ToSWIGWrapper(lldb::TypeImplSP type_impl_sp) {
PythonObject SWIGBridge::ToSWIGWrapper(lldb::TypeImplSP type_impl_sp) {
return ToSWIGHelper(new lldb::SBType(type_impl_sp), SWIGTYPE_p_lldb__SBType);
}
PythonObject ToSWIGWrapper(const TypeSummaryOptions &summary_options) {
PythonObject SWIGBridge::ToSWIGWrapper(const TypeSummaryOptions &summary_options) {
return ToSWIGHelper(new lldb::SBTypeSummaryOptions(summary_options),
SWIGTYPE_p_lldb__SBTypeSummaryOptions);
}
PythonObject ToSWIGWrapper(const SymbolContext &sym_ctx) {
PythonObject SWIGBridge::ToSWIGWrapper(const SymbolContext &sym_ctx) {
return ToSWIGHelper(new lldb::SBSymbolContext(sym_ctx),
SWIGTYPE_p_lldb__SBSymbolContext);
}
PythonObject ToSWIGWrapper(lldb::ProcessLaunchInfoSP launch_info_sp) {
PythonObject SWIGBridge::ToSWIGWrapper(lldb::ProcessLaunchInfoSP launch_info_sp) {
return ToSWIGHelper(new lldb::ProcessLaunchInfoSP(std::move(launch_info_sp)),
SWIGTYPE_p_lldb__SBLaunchInfo);
}
PythonObject ToSWIGWrapper(lldb::ProcessAttachInfoSP attach_info_sp) {
PythonObject SWIGBridge::ToSWIGWrapper(lldb::ProcessAttachInfoSP attach_info_sp) {
return ToSWIGHelper(new lldb::ProcessAttachInfoSP(std::move(attach_info_sp)),
SWIGTYPE_p_lldb__SBAttachInfo);
}
PythonObject ToSWIGWrapper(lldb::DataExtractorSP data_sp) {
PythonObject SWIGBridge::ToSWIGWrapper(lldb::DataExtractorSP data_sp) {
return ToSWIGHelper(new lldb::DataExtractorSP(std::move(data_sp)),
SWIGTYPE_p_lldb__SBData);
}
ScopedPythonObject<lldb::SBCommandReturnObject>
ToSWIGWrapper(CommandReturnObject &cmd_retobj) {
SWIGBridge::ToSWIGWrapper(CommandReturnObject &cmd_retobj) {
return ScopedPythonObject<lldb::SBCommandReturnObject>(
new lldb::SBCommandReturnObject(cmd_retobj),
SWIGTYPE_p_lldb__SBCommandReturnObject);
}
ScopedPythonObject<lldb::SBEvent> ToSWIGWrapper(Event *event) {
ScopedPythonObject<lldb::SBEvent> SWIGBridge::ToSWIGWrapper(Event *event) {
return ScopedPythonObject<lldb::SBEvent>(new lldb::SBEvent(event),
SWIGTYPE_p_lldb__SBEvent);
}

View File

@@ -16,7 +16,7 @@ private:
bool m_print;
};
llvm::Expected<bool> lldb_private::LLDBSwigPythonBreakpointCallbackFunction(
llvm::Expected<bool> lldb_private::python::SWIGBridge::LLDBSwigPythonBreakpointCallbackFunction(
const char *python_function_name, const char *session_dictionary_name,
const lldb::StackFrameSP &frame_sp,
const lldb::BreakpointLocationSP &bp_loc_sp,
@@ -37,13 +37,13 @@ llvm::Expected<bool> lldb_private::LLDBSwigPythonBreakpointCallbackFunction(
else
return arg_info.takeError();
PythonObject frame_arg = ToSWIGWrapper(frame_sp);
PythonObject bp_loc_arg = ToSWIGWrapper(bp_loc_sp);
PythonObject frame_arg = SWIGBridge::ToSWIGWrapper(frame_sp);
PythonObject bp_loc_arg = SWIGBridge::ToSWIGWrapper(bp_loc_sp);
auto result =
max_positional_args < 4
? pfunc.Call(frame_arg, bp_loc_arg, dict)
: pfunc.Call(frame_arg, bp_loc_arg, ToSWIGWrapper(args_impl), dict);
: pfunc.Call(frame_arg, bp_loc_arg, SWIGBridge::ToSWIGWrapper(args_impl), dict);
if (!result)
return result.takeError();
@@ -65,7 +65,7 @@ llvm::Expected<bool> lldb_private::LLDBSwigPythonBreakpointCallbackFunction(
// lldb_private::ScriptInterpreterPython::WatchpointCallbackFunction(...) and is
// used when a script command is attached to a watchpoint for execution.
bool lldb_private::LLDBSwigPythonWatchpointCallbackFunction(
bool lldb_private::python::SWIGBridge::LLDBSwigPythonWatchpointCallbackFunction(
const char *python_function_name, const char *session_dictionary_name,
const lldb::StackFrameSP &frame_sp, const lldb::WatchpointSP &wp_sp) {
@@ -82,7 +82,7 @@ bool lldb_private::LLDBSwigPythonWatchpointCallbackFunction(
return stop_at_watchpoint;
PythonObject result =
pfunc(ToSWIGWrapper(frame_sp), ToSWIGWrapper(wp_sp), dict);
pfunc(SWIGBridge::ToSWIGWrapper(frame_sp), SWIGBridge::ToSWIGWrapper(wp_sp), dict);
if (result.get() == Py_False)
stop_at_watchpoint = false;
@@ -94,7 +94,7 @@ bool lldb_private::LLDBSwigPythonWatchpointCallbackFunction(
// ScriptInterpreterPython::FormatterMatchingCallbackFunction and it's used when
// a data formatter provides the name of a callback to inspect a candidate type
// before considering a match.
bool lldb_private::LLDBSwigPythonFormatterCallbackFunction(
bool lldb_private::python::SWIGBridge::LLDBSwigPythonFormatterCallbackFunction(
const char *python_function_name, const char *session_dictionary_name,
lldb::TypeImplSP type_impl_sp) {
@@ -109,14 +109,14 @@ bool lldb_private::LLDBSwigPythonFormatterCallbackFunction(
return false;
PythonObject result =
pfunc(ToSWIGWrapper(type_impl_sp), dict);
pfunc(SWIGBridge::ToSWIGWrapper(type_impl_sp), dict);
// Only if everything goes okay and the function returns True we'll consider
// it a match.
return result.get() == Py_True;
}
bool lldb_private::LLDBSwigPythonCallTypeScript(
bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallTypeScript(
const char *python_function_name, const void *session_dictionary,
const lldb::ValueObjectSP &valobj_sp, void **pyfunct_wrapper,
const lldb::TypeSummaryOptionsSP &options_sp, std::string &retval) {
@@ -166,19 +166,19 @@ bool lldb_private::LLDBSwigPythonCallTypeScript(
return false;
}
PythonObject value_arg = ToSWIGWrapper(valobj_sp);
PythonObject value_arg = SWIGBridge::ToSWIGWrapper(valobj_sp);
if (argc.get().max_positional_args < 3)
result = pfunc(value_arg, dict);
else
result = pfunc(value_arg, dict, ToSWIGWrapper(*options_sp));
result = pfunc(value_arg, dict, SWIGBridge::ToSWIGWrapper(*options_sp));
retval = result.Str().GetString().str();
return true;
}
PythonObject lldb_private::LLDBSwigPythonCreateSyntheticProvider(
PythonObject lldb_private::python::SWIGBridge::LLDBSwigPythonCreateSyntheticProvider(
const char *python_class_name, const char *session_dictionary_name,
const lldb::ValueObjectSP &valobj_sp) {
if (python_class_name == NULL || python_class_name[0] == '\0' ||
@@ -195,10 +195,10 @@ PythonObject lldb_private::LLDBSwigPythonCreateSyntheticProvider(
if (!pfunc.IsAllocated())
return PythonObject();
auto sb_value = std::make_unique<lldb::SBValue>(valobj_sp);
auto sb_value = std::unique_ptr<lldb::SBValue>(new lldb::SBValue(valobj_sp));
sb_value->SetPreferSyntheticValue(false);
PythonObject val_arg = ToSWIGWrapper(std::move(sb_value));
PythonObject val_arg = SWIGBridge::ToSWIGWrapper(std::move(sb_value));
if (!val_arg.IsAllocated())
return PythonObject();
@@ -210,7 +210,7 @@ PythonObject lldb_private::LLDBSwigPythonCreateSyntheticProvider(
return PythonObject();
}
PythonObject lldb_private::LLDBSwigPythonCreateCommandObject(
PythonObject lldb_private::python::SWIGBridge::LLDBSwigPythonCreateCommandObject(
const char *python_class_name, const char *session_dictionary_name,
lldb::DebuggerSP debugger_sp) {
if (python_class_name == NULL || python_class_name[0] == '\0' ||
@@ -226,10 +226,10 @@ PythonObject lldb_private::LLDBSwigPythonCreateCommandObject(
if (!pfunc.IsAllocated())
return PythonObject();
return pfunc(ToSWIGWrapper(std::move(debugger_sp)), dict);
return pfunc(SWIGBridge::ToSWIGWrapper(std::move(debugger_sp)), dict);
}
PythonObject lldb_private::LLDBSwigPythonCreateScriptedObject(
PythonObject lldb_private::python::SWIGBridge::LLDBSwigPythonCreateScriptedObject(
const char *python_class_name, const char *session_dictionary_name,
lldb::ExecutionContextRefSP exe_ctx_sp,
const lldb_private::StructuredDataImpl &args_impl,
@@ -264,7 +264,7 @@ PythonObject lldb_private::LLDBSwigPythonCreateScriptedObject(
PythonObject result = {};
if (arg_info.get().max_positional_args == 2) {
result = pfunc(ToSWIGWrapper(exe_ctx_sp), ToSWIGWrapper(args_impl));
result = pfunc(SWIGBridge::ToSWIGWrapper(exe_ctx_sp), SWIGBridge::ToSWIGWrapper(args_impl));
} else {
error_string.assign("wrong number of arguments in __init__, should be 2 "
"(not including self)");
@@ -272,7 +272,7 @@ PythonObject lldb_private::LLDBSwigPythonCreateScriptedObject(
return result;
}
PythonObject lldb_private::LLDBSwigPythonCreateScriptedThreadPlan(
PythonObject lldb_private::python::SWIGBridge::LLDBSwigPythonCreateScriptedThreadPlan(
const char *python_class_name, const char *session_dictionary_name,
const lldb_private::StructuredDataImpl &args_impl,
std::string &error_string, const lldb::ThreadPlanSP &thread_plan_sp) {
@@ -293,7 +293,7 @@ PythonObject lldb_private::LLDBSwigPythonCreateScriptedThreadPlan(
return PythonObject();
}
PythonObject tp_arg = ToSWIGWrapper(thread_plan_sp);
PythonObject tp_arg = SWIGBridge::ToSWIGWrapper(thread_plan_sp);
llvm::Expected<PythonCallable::ArgInfo> arg_info = pfunc.GetArgInfo();
if (!arg_info) {
@@ -307,7 +307,7 @@ PythonObject lldb_private::LLDBSwigPythonCreateScriptedThreadPlan(
}
PythonObject result = {};
auto args_sb = std::make_unique<lldb::SBStructuredData>(args_impl);
auto args_sb = std::unique_ptr<lldb::SBStructuredData>(new lldb::SBStructuredData(args_impl));
if (arg_info.get().max_positional_args == 2) {
if (args_sb->IsValid()) {
error_string.assign(
@@ -316,7 +316,7 @@ PythonObject lldb_private::LLDBSwigPythonCreateScriptedThreadPlan(
}
result = pfunc(tp_arg, dict);
} else if (arg_info.get().max_positional_args >= 3) {
result = pfunc(tp_arg, ToSWIGWrapper(std::move(args_sb)), dict);
result = pfunc(tp_arg, SWIGBridge::ToSWIGWrapper(std::move(args_sb)), dict);
} else {
error_string.assign("wrong number of arguments in __init__, should be 2 or "
"3 (not including self)");
@@ -329,7 +329,7 @@ PythonObject lldb_private::LLDBSwigPythonCreateScriptedThreadPlan(
return result;
}
bool lldb_private::LLDBSWIGPythonCallThreadPlan(
bool lldb_private::python::SWIGBridge::LLDBSWIGPythonCallThreadPlan(
void *implementor, const char *method_name, lldb_private::Event *event,
bool &got_error) {
got_error = false;
@@ -343,7 +343,7 @@ bool lldb_private::LLDBSWIGPythonCallThreadPlan(
PythonObject result;
if (event != nullptr) {
ScopedPythonObject<SBEvent> event_arg = ToSWIGWrapper(event);
ScopedPythonObject<SBEvent> event_arg = SWIGBridge::ToSWIGWrapper(event);
result = pfunc(event_arg.obj());
} else
result = pfunc();
@@ -367,7 +367,7 @@ bool lldb_private::LLDBSWIGPythonCallThreadPlan(
return false;
}
bool lldb_private::LLDBSWIGPythonCallThreadPlan(
bool lldb_private::python::SWIGBridge::LLDBSWIGPythonCallThreadPlan(
void *implementor, const char *method_name, lldb_private::Stream *stream,
bool &got_error) {
got_error = false;
@@ -381,7 +381,7 @@ bool lldb_private::LLDBSWIGPythonCallThreadPlan(
auto *sb_stream = new lldb::SBStream();
PythonObject sb_stream_arg =
ToSWIGWrapper(std::unique_ptr<lldb::SBStream>(sb_stream));
SWIGBridge::ToSWIGWrapper(std::unique_ptr<lldb::SBStream>(sb_stream));
PythonObject result;
result = pfunc(sb_stream_arg);
@@ -399,7 +399,7 @@ bool lldb_private::LLDBSWIGPythonCallThreadPlan(
}
PythonObject lldb_private::LLDBSwigPythonCreateScriptedBreakpointResolver(
PythonObject lldb_private::python::SWIGBridge::LLDBSwigPythonCreateScriptedBreakpointResolver(
const char *python_class_name, const char *session_dictionary_name,
const StructuredDataImpl &args_impl,
const lldb::BreakpointSP &breakpoint_sp) {
@@ -419,7 +419,7 @@ PythonObject lldb_private::LLDBSwigPythonCreateScriptedBreakpointResolver(
return PythonObject();
PythonObject result =
pfunc(ToSWIGWrapper(breakpoint_sp), ToSWIGWrapper(args_impl), dict);
pfunc(SWIGBridge::ToSWIGWrapper(breakpoint_sp), SWIGBridge::ToSWIGWrapper(args_impl), dict);
// FIXME: At this point we should check that the class we found supports all
// the methods that we need.
@@ -432,7 +432,7 @@ PythonObject lldb_private::LLDBSwigPythonCreateScriptedBreakpointResolver(
return PythonObject();
}
unsigned int lldb_private::LLDBSwigPythonCallBreakpointResolver(
unsigned int lldb_private::python::SWIGBridge::LLDBSwigPythonCallBreakpointResolver(
void *implementor, const char *method_name,
lldb_private::SymbolContext *sym_ctx) {
PyErr_Cleaner py_err_cleaner(false);
@@ -442,7 +442,7 @@ unsigned int lldb_private::LLDBSwigPythonCallBreakpointResolver(
if (!pfunc.IsAllocated())
return 0;
PythonObject result = sym_ctx ? pfunc(ToSWIGWrapper(*sym_ctx)) : pfunc();
PythonObject result = sym_ctx ? pfunc(SWIGBridge::ToSWIGWrapper(*sym_ctx)) : pfunc();
if (PyErr_Occurred()) {
PyErr_Print();
@@ -471,7 +471,7 @@ unsigned int lldb_private::LLDBSwigPythonCallBreakpointResolver(
return ret_val;
}
PythonObject lldb_private::LLDBSwigPythonCreateScriptedStopHook(
PythonObject lldb_private::python::SWIGBridge::LLDBSwigPythonCreateScriptedStopHook(
lldb::TargetSP target_sp, const char *python_class_name,
const char *session_dictionary_name, const StructuredDataImpl &args_impl,
Status &error) {
@@ -498,7 +498,7 @@ PythonObject lldb_private::LLDBSwigPythonCreateScriptedStopHook(
}
PythonObject result =
pfunc(ToSWIGWrapper(target_sp), ToSWIGWrapper(args_impl), dict);
pfunc(SWIGBridge::ToSWIGWrapper(target_sp), SWIGBridge::ToSWIGWrapper(args_impl), dict);
if (result.IsAllocated()) {
// Check that the handle_stop callback is defined:
@@ -529,7 +529,7 @@ PythonObject lldb_private::LLDBSwigPythonCreateScriptedStopHook(
return PythonObject();
}
bool lldb_private::LLDBSwigPythonStopHookCallHandleStop(
bool lldb_private::python::SWIGBridge::LLDBSwigPythonStopHookCallHandleStop(
void *implementor, lldb::ExecutionContextRefSP exc_ctx_sp,
lldb::StreamSP stream) {
// handle_stop will return a bool with the meaning "should_stop"...
@@ -545,9 +545,9 @@ bool lldb_private::LLDBSwigPythonStopHookCallHandleStop(
auto *sb_stream = new lldb::SBStream();
PythonObject sb_stream_arg =
ToSWIGWrapper(std::unique_ptr<lldb::SBStream>(sb_stream));
SWIGBridge::ToSWIGWrapper(std::unique_ptr<lldb::SBStream>(sb_stream));
PythonObject result =
pfunc(ToSWIGWrapper(std::move(exc_ctx_sp)), sb_stream_arg);
pfunc(SWIGBridge::ToSWIGWrapper(std::move(exc_ctx_sp)), sb_stream_arg);
if (PyErr_Occurred()) {
stream->PutCString("Python error occurred handling stop-hook.");
@@ -591,7 +591,7 @@ static PyObject *LLDBSwigPython_CallOptionalMember(
return result.release();
}
size_t lldb_private::LLDBSwigPython_CalculateNumChildren(PyObject * implementor,
size_t lldb_private::python::SWIGBridge::LLDBSwigPython_CalculateNumChildren(PyObject * implementor,
uint32_t max) {
PythonObject self(PyRefType::Borrowed, implementor);
auto pfunc = self.ResolveName<PythonCallable>("num_children");
@@ -624,7 +624,7 @@ size_t lldb_private::LLDBSwigPython_CalculateNumChildren(PyObject * implementor,
return ret_val;
}
PyObject *lldb_private::LLDBSwigPython_GetChildAtIndex(PyObject * implementor,
PyObject *lldb_private::python::SWIGBridge::LLDBSwigPython_GetChildAtIndex(PyObject * implementor,
uint32_t idx) {
PyErr_Cleaner py_err_cleaner(true);
@@ -650,7 +650,7 @@ PyObject *lldb_private::LLDBSwigPython_GetChildAtIndex(PyObject * implementor,
return result.release();
}
int lldb_private::LLDBSwigPython_GetIndexOfChildWithName(
int lldb_private::python::SWIGBridge::LLDBSwigPython_GetIndexOfChildWithName(
PyObject * implementor, const char *child_name) {
PyErr_Cleaner py_err_cleaner(true);
@@ -676,7 +676,7 @@ int lldb_private::LLDBSwigPython_GetIndexOfChildWithName(
return UINT32_MAX;
}
bool lldb_private::LLDBSwigPython_UpdateSynthProviderInstance(PyObject *
bool lldb_private::python::SWIGBridge::LLDBSwigPython_UpdateSynthProviderInstance(PyObject *
implementor) {
bool ret_val = false;
@@ -693,7 +693,7 @@ bool lldb_private::LLDBSwigPython_UpdateSynthProviderInstance(PyObject *
return ret_val;
}
bool lldb_private::LLDBSwigPython_MightHaveChildrenSynthProviderInstance(
bool lldb_private::python::SWIGBridge::LLDBSwigPython_MightHaveChildrenSynthProviderInstance(
PyObject * implementor) {
bool ret_val = false;
@@ -710,7 +710,7 @@ bool lldb_private::LLDBSwigPython_MightHaveChildrenSynthProviderInstance(
return ret_val;
}
PyObject *lldb_private::LLDBSwigPython_GetValueSynthProviderInstance(
PyObject *lldb_private::python::SWIGBridge::LLDBSwigPython_GetValueSynthProviderInstance(
PyObject * implementor) {
PyObject *ret_val = nullptr;
@@ -736,7 +736,7 @@ PyObject *lldb_private::LLDBSwigPython_GetValueSynthProviderInstance(
return ret_val;
}
void *lldb_private::LLDBSWIGPython_CastPyObjectToSBData(PyObject * data) {
void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBData(PyObject * data) {
lldb::SBData *sb_ptr = nullptr;
int valid_cast =
@@ -748,7 +748,7 @@ void *lldb_private::LLDBSWIGPython_CastPyObjectToSBData(PyObject * data) {
return sb_ptr;
}
void *lldb_private::LLDBSWIGPython_CastPyObjectToSBBreakpoint(PyObject * data) {
void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBBreakpoint(PyObject * data) {
lldb::SBBreakpoint *sb_ptr = nullptr;
int valid_cast =
@@ -760,7 +760,7 @@ void *lldb_private::LLDBSWIGPython_CastPyObjectToSBBreakpoint(PyObject * data) {
return sb_ptr;
}
void *lldb_private::LLDBSWIGPython_CastPyObjectToSBAttachInfo(PyObject * data) {
void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBAttachInfo(PyObject * data) {
lldb::SBAttachInfo *sb_ptr = nullptr;
int valid_cast =
@@ -772,7 +772,7 @@ void *lldb_private::LLDBSWIGPython_CastPyObjectToSBAttachInfo(PyObject * data) {
return sb_ptr;
}
void *lldb_private::LLDBSWIGPython_CastPyObjectToSBLaunchInfo(PyObject * data) {
void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBLaunchInfo(PyObject * data) {
lldb::SBLaunchInfo *sb_ptr = nullptr;
int valid_cast =
@@ -784,7 +784,7 @@ void *lldb_private::LLDBSWIGPython_CastPyObjectToSBLaunchInfo(PyObject * data) {
return sb_ptr;
}
void *lldb_private::LLDBSWIGPython_CastPyObjectToSBError(PyObject * data) {
void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBError(PyObject * data) {
lldb::SBError *sb_ptr = nullptr;
int valid_cast =
@@ -796,7 +796,7 @@ void *lldb_private::LLDBSWIGPython_CastPyObjectToSBError(PyObject * data) {
return sb_ptr;
}
void *lldb_private::LLDBSWIGPython_CastPyObjectToSBValue(PyObject * data) {
void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBValue(PyObject * data) {
lldb::SBValue *sb_ptr = NULL;
int valid_cast =
@@ -808,7 +808,7 @@ void *lldb_private::LLDBSWIGPython_CastPyObjectToSBValue(PyObject * data) {
return sb_ptr;
}
void *lldb_private::LLDBSWIGPython_CastPyObjectToSBMemoryRegionInfo(PyObject *
void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBMemoryRegionInfo(PyObject *
data) {
lldb::SBMemoryRegionInfo *sb_ptr = NULL;
@@ -821,7 +821,7 @@ void *lldb_private::LLDBSWIGPython_CastPyObjectToSBMemoryRegionInfo(PyObject *
return sb_ptr;
}
bool lldb_private::LLDBSwigPythonCallCommand(
bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallCommand(
const char *python_function_name, const char *session_dictionary_name,
lldb::DebuggerSP debugger, const char *args,
lldb_private::CommandReturnObject &cmd_retobj,
@@ -841,19 +841,19 @@ bool lldb_private::LLDBSwigPythonCallCommand(
llvm::consumeError(argc.takeError());
return false;
}
PythonObject debugger_arg = ToSWIGWrapper(std::move(debugger));
auto cmd_retobj_arg = ToSWIGWrapper(cmd_retobj);
PythonObject debugger_arg = SWIGBridge::ToSWIGWrapper(std::move(debugger));
auto cmd_retobj_arg = SWIGBridge::ToSWIGWrapper(cmd_retobj);
if (argc.get().max_positional_args < 5u)
pfunc(debugger_arg, PythonString(args), cmd_retobj_arg.obj(), dict);
else
pfunc(debugger_arg, PythonString(args),
ToSWIGWrapper(std::move(exe_ctx_ref_sp)), cmd_retobj_arg.obj(), dict);
SWIGBridge::ToSWIGWrapper(std::move(exe_ctx_ref_sp)), cmd_retobj_arg.obj(), dict);
return true;
}
bool lldb_private::LLDBSwigPythonCallCommandObject(
bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallCommandObject(
PyObject *implementor, lldb::DebuggerSP debugger, const char *args,
lldb_private::CommandReturnObject &cmd_retobj,
lldb::ExecutionContextRefSP exe_ctx_ref_sp) {
@@ -866,15 +866,15 @@ bool lldb_private::LLDBSwigPythonCallCommandObject(
if (!pfunc.IsAllocated())
return false;
auto cmd_retobj_arg = ToSWIGWrapper(cmd_retobj);
auto cmd_retobj_arg = SWIGBridge::ToSWIGWrapper(cmd_retobj);
pfunc(ToSWIGWrapper(std::move(debugger)), PythonString(args),
ToSWIGWrapper(exe_ctx_ref_sp), cmd_retobj_arg.obj());
pfunc(SWIGBridge::ToSWIGWrapper(std::move(debugger)), PythonString(args),
SWIGBridge::ToSWIGWrapper(exe_ctx_ref_sp), cmd_retobj_arg.obj());
return true;
}
PythonObject lldb_private::LLDBSWIGPythonCreateOSPlugin(
PythonObject lldb_private::python::SWIGBridge::LLDBSWIGPythonCreateOSPlugin(
const char *python_class_name, const char *session_dictionary_name,
const lldb::ProcessSP &process_sp) {
if (python_class_name == NULL || python_class_name[0] == '\0' ||
@@ -891,10 +891,10 @@ PythonObject lldb_private::LLDBSWIGPythonCreateOSPlugin(
if (!pfunc.IsAllocated())
return PythonObject();
return pfunc(ToSWIGWrapper(process_sp));
return pfunc(SWIGBridge::ToSWIGWrapper(process_sp));
}
PythonObject lldb_private::LLDBSWIGPython_CreateFrameRecognizer(
PythonObject lldb_private::python::SWIGBridge::LLDBSWIGPython_CreateFrameRecognizer(
const char *python_class_name, const char *session_dictionary_name) {
if (python_class_name == NULL || python_class_name[0] == '\0' ||
!session_dictionary_name)
@@ -913,11 +913,11 @@ PythonObject lldb_private::LLDBSWIGPython_CreateFrameRecognizer(
return pfunc();
}
PyObject *lldb_private::LLDBSwigPython_GetRecognizedArguments(
PyObject *lldb_private::python::SWIGBridge::LLDBSwigPython_GetRecognizedArguments(
PyObject * implementor, const lldb::StackFrameSP &frame_sp) {
static char callee_name[] = "get_recognized_arguments";
PythonObject arg = ToSWIGWrapper(frame_sp);
PythonObject arg = SWIGBridge::ToSWIGWrapper(frame_sp);
PythonString str(callee_name);
PyObject *result =
@@ -925,7 +925,7 @@ PyObject *lldb_private::LLDBSwigPython_GetRecognizedArguments(
return result;
}
void *lldb_private::LLDBSWIGPython_GetDynamicSetting(
void *lldb_private::python::SWIGBridge::LLDBSWIGPython_GetDynamicSetting(
void *module, const char *setting, const lldb::TargetSP &target_sp) {
if (!module || !setting)
Py_RETURN_NONE;
@@ -937,12 +937,12 @@ void *lldb_private::LLDBSWIGPython_GetDynamicSetting(
if (!pfunc.IsAllocated())
Py_RETURN_NONE;
auto result = pfunc(ToSWIGWrapper(target_sp), PythonString(setting));
auto result = pfunc(SWIGBridge::ToSWIGWrapper(target_sp), PythonString(setting));
return result.release();
}
bool lldb_private::LLDBSWIGPythonRunScriptKeywordProcess(
bool lldb_private::python::SWIGBridge::LLDBSWIGPythonRunScriptKeywordProcess(
const char *python_function_name, const char *session_dictionary_name,
const lldb::ProcessSP &process, std::string &output) {
@@ -960,14 +960,14 @@ bool lldb_private::LLDBSWIGPythonRunScriptKeywordProcess(
if (!pfunc.IsAllocated())
return false;
auto result = pfunc(ToSWIGWrapper(process), dict);
auto result = pfunc(SWIGBridge::ToSWIGWrapper(process), dict);
output = result.Str().GetString().str();
return true;
}
std::optional<std::string> lldb_private::LLDBSWIGPythonRunScriptKeywordThread(
std::optional<std::string> lldb_private::python::SWIGBridge::LLDBSWIGPythonRunScriptKeywordThread(
const char *python_function_name, const char *session_dictionary_name,
lldb::ThreadSP thread) {
if (python_function_name == NULL || python_function_name[0] == '\0' ||
@@ -984,12 +984,12 @@ std::optional<std::string> lldb_private::LLDBSWIGPythonRunScriptKeywordThread(
if (!pfunc.IsAllocated())
return std::nullopt;
auto result = pfunc(ToSWIGWrapper(std::move(thread)), dict);
auto result = pfunc(SWIGBridge::ToSWIGWrapper(std::move(thread)), dict);
return result.Str().GetString().str();
}
bool lldb_private::LLDBSWIGPythonRunScriptKeywordTarget(
bool lldb_private::python::SWIGBridge::LLDBSWIGPythonRunScriptKeywordTarget(
const char *python_function_name, const char *session_dictionary_name,
const lldb::TargetSP &target, std::string &output) {
@@ -1007,14 +1007,14 @@ bool lldb_private::LLDBSWIGPythonRunScriptKeywordTarget(
if (!pfunc.IsAllocated())
return false;
auto result = pfunc(ToSWIGWrapper(target), dict);
auto result = pfunc(SWIGBridge::ToSWIGWrapper(target), dict);
output = result.Str().GetString().str();
return true;
}
std::optional<std::string> lldb_private::LLDBSWIGPythonRunScriptKeywordFrame(
std::optional<std::string> lldb_private::python::SWIGBridge::LLDBSWIGPythonRunScriptKeywordFrame(
const char *python_function_name, const char *session_dictionary_name,
lldb::StackFrameSP frame) {
if (python_function_name == NULL || python_function_name[0] == '\0' ||
@@ -1031,12 +1031,12 @@ std::optional<std::string> lldb_private::LLDBSWIGPythonRunScriptKeywordFrame(
if (!pfunc.IsAllocated())
return std::nullopt;
auto result = pfunc(ToSWIGWrapper(std::move(frame)), dict);
auto result = pfunc(SWIGBridge::ToSWIGWrapper(std::move(frame)), dict);
return result.Str().GetString().str();
}
bool lldb_private::LLDBSWIGPythonRunScriptKeywordValue(
bool lldb_private::python::SWIGBridge::LLDBSWIGPythonRunScriptKeywordValue(
const char *python_function_name, const char *session_dictionary_name,
const lldb::ValueObjectSP &value, std::string &output) {
@@ -1054,14 +1054,14 @@ bool lldb_private::LLDBSWIGPythonRunScriptKeywordValue(
if (!pfunc.IsAllocated())
return false;
auto result = pfunc(ToSWIGWrapper(value), dict);
auto result = pfunc(SWIGBridge::ToSWIGWrapper(value), dict);
output = result.Str().GetString().str();
return true;
}
bool lldb_private::LLDBSwigPythonCallModuleInit(
bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallModuleInit(
const char *python_module_name, const char *session_dictionary_name,
lldb::DebuggerSP debugger) {
std::string python_function_name_string = python_module_name;
@@ -1080,12 +1080,12 @@ bool lldb_private::LLDBSwigPythonCallModuleInit(
if (!pfunc.IsAllocated())
return true;
pfunc(ToSWIGWrapper(std::move(debugger)), dict);
pfunc(SWIGBridge::ToSWIGWrapper(std::move(debugger)), dict);
return true;
}
lldb::ValueObjectSP lldb_private::LLDBSWIGPython_GetValueObjectSPFromSBValue(
lldb::ValueObjectSP lldb_private::python::SWIGBridge::LLDBSWIGPython_GetValueObjectSPFromSBValue(
void *data) {
lldb::ValueObjectSP valobj_sp;
if (data) {

View File

@@ -15,7 +15,10 @@ class SBBreakpointListImpl;
namespace lldb_private {
class ScriptInterpreter;
namespace python {
class SWIGBridge;
}
} // namespace lldb_private
namespace lldb {
@@ -26,10 +29,6 @@ public:
SBBreakpoint(const lldb::SBBreakpoint &rhs);
#ifndef SWIG
SBBreakpoint(const lldb::BreakpointSP &bp_sp);
#endif
~SBBreakpoint();
const lldb::SBBreakpoint &operator=(const lldb::SBBreakpoint &rhs);
@@ -160,6 +159,9 @@ private:
friend class SBTarget;
friend class lldb_private::ScriptInterpreter;
friend class lldb_private::python::SWIGBridge;
SBBreakpoint(const lldb::BreakpointSP &bp_sp);
lldb::BreakpointSP GetSP() const;

View File

@@ -12,6 +12,12 @@
#include "lldb/API/SBBreakpoint.h"
#include "lldb/API/SBDefines.h"
namespace lldb_private {
namespace python {
class SWIGBridge;
}
} // namespace lldb_private
namespace lldb {
class LLDB_API SBBreakpointLocation {
@@ -90,9 +96,9 @@ public:
SBBreakpoint GetBreakpoint();
#ifndef SWIG
protected:
friend class lldb_private::python::SWIGBridge;
SBBreakpointLocation(const lldb::BreakpointLocationSP &break_loc_sp);
#endif
private:
friend class SBBreakpoint;

View File

@@ -14,6 +14,10 @@
#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBDefines.h"
namespace lldb_private {
class CommandPluginInterfaceImplementation;
}
namespace lldb {
class SBCommandInterpreter {
@@ -263,9 +267,6 @@ public:
bool SetCommandOverrideCallback(const char *command_name,
lldb::CommandOverrideCallback callback,
void *baton);
SBCommandInterpreter(
lldb_private::CommandInterpreter *interpreter_ptr =
nullptr); // Access using SBDebugger::GetCommandInterpreter();
#endif
/// Return true if the command interpreter is the active IO handler.
@@ -314,6 +315,11 @@ public:
void ResolveCommand(const char *command_line, SBCommandReturnObject &result);
protected:
friend class lldb_private::CommandPluginInterfaceImplementation;
SBCommandInterpreter(
lldb_private::CommandInterpreter *interpreter_ptr =
nullptr); // Access using SBDebugger::GetCommandInterpreter();
lldb_private::CommandInterpreter &ref();
lldb_private::CommandInterpreter *get();

View File

@@ -16,8 +16,12 @@
#include "lldb/API/SBDefines.h"
namespace lldb_private {
class CommandPluginInterfaceImplementation;
class SBCommandReturnObjectImpl;
namespace python {
class SWIGBridge;
}
} // namespace lldb_private
namespace lldb {
@@ -25,10 +29,6 @@ class LLDB_API SBCommandReturnObject {
public:
SBCommandReturnObject();
#ifndef SWIG
SBCommandReturnObject(lldb_private::CommandReturnObject &ref);
#endif
// rvalue ctor+assignment are incompatible with Reproducers.
SBCommandReturnObject(const lldb::SBCommandReturnObject &rhs);
@@ -119,6 +119,11 @@ protected:
friend class SBCommandInterpreter;
friend class SBOptions;
friend class lldb_private::CommandPluginInterfaceImplementation;
friend class lldb_private::python::SWIGBridge;
SBCommandReturnObject(lldb_private::CommandReturnObject &ref);
lldb_private::CommandReturnObject *operator->() const;
lldb_private::CommandReturnObject *get() const;

View File

@@ -14,6 +14,13 @@
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBPlatform.h"
namespace lldb_private {
class CommandPluginInterfaceImplementation;
namespace python {
class SWIGBridge;
}
} // namespace lldb_private
namespace lldb {
#ifndef SWIG
@@ -45,10 +52,6 @@ public:
SBDebugger(const lldb::SBDebugger &rhs);
#ifndef SWIG
SBDebugger(const lldb::DebuggerSP &debugger_sp);
#endif
~SBDebugger();
static const char *GetBroadcasterClass();
@@ -464,6 +467,12 @@ public:
SBTrace LoadTraceFromFile(SBError &error,
const SBFileSpec &trace_description_file);
protected:
friend class lldb_private::CommandPluginInterfaceImplementation;
friend class lldb_private::python::SWIGBridge;
SBDebugger(const lldb::DebuggerSP &debugger_sp);
private:
friend class SBCommandInterpreter;
friend class SBInputReader;

View File

@@ -13,6 +13,9 @@
namespace lldb_private {
class ScriptInterpreter;
namespace python {
class SWIGBridge;
}
} // namespace lldb_private
namespace lldb {
@@ -25,10 +28,6 @@ public:
SBError(const char *message);
#ifndef SWIG
SBError(const lldb_private::Status &error);
#endif
~SBError();
const SBError &operator=(const lldb::SBError &rhs);
@@ -94,6 +93,9 @@ protected:
friend class SBWatchpoint;
friend class lldb_private::ScriptInterpreter;
friend class lldb_private::python::SWIGBridge;
SBError(const lldb_private::Status &error);
lldb_private::Status *get();

View File

@@ -14,6 +14,12 @@
#include <cstdio>
#include <vector>
namespace lldb_private {
namespace python {
class SWIGBridge;
}
} // namespace lldb_private
namespace lldb {
class SBBroadcaster;
@@ -27,12 +33,6 @@ public:
// Make an event that contains a C string.
SBEvent(uint32_t event, const char *cstr, uint32_t cstr_len);
#ifndef SWIG
SBEvent(lldb::EventSP &event_sp);
SBEvent(lldb_private::Event *event_sp);
#endif
~SBEvent();
const SBEvent &operator=(const lldb::SBEvent &rhs);
@@ -73,6 +73,12 @@ protected:
friend class SBThread;
friend class SBWatchpoint;
friend class lldb_private::python::SWIGBridge;
SBEvent(lldb::EventSP &event_sp);
SBEvent(lldb_private::Event *event_sp);
lldb::EventSP &GetSP() const;
void reset(lldb::EventSP &event_sp);

View File

@@ -15,6 +15,12 @@
#include <cstdio>
#include <vector>
namespace lldb_private {
namespace python {
class SWIGBridge;
}
} // namespace lldb_private
namespace lldb {
class LLDB_API SBExecutionContext {
@@ -25,10 +31,6 @@ public:
SBExecutionContext(const lldb::SBExecutionContext &rhs);
#ifndef SWIG
SBExecutionContext(lldb::ExecutionContextRefSP exe_ctx_ref_sp);
#endif
SBExecutionContext(const lldb::SBTarget &target);
SBExecutionContext(const lldb::SBProcess &process);
@@ -52,8 +54,12 @@ public:
SBFrame GetFrame() const;
protected:
friend class lldb_private::python::SWIGBridge;
lldb_private::ExecutionContextRef *get() const;
SBExecutionContext(lldb::ExecutionContextRefSP exe_ctx_ref_sp);
private:
mutable lldb::ExecutionContextRefSP m_exe_ctx_sp;
};

View File

@@ -12,6 +12,12 @@
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBValueList.h"
namespace lldb_private {
namespace python {
class SWIGBridge;
}
} // namespace lldb_private
namespace lldb {
class LLDB_API SBFrame {
@@ -184,10 +190,6 @@ public:
bool GetDescription(lldb::SBStream &description);
#ifndef SWIG
SBFrame(const lldb::StackFrameSP &lldb_object_sp);
#endif
protected:
friend class SBBlock;
friend class SBExecutionContext;
@@ -195,6 +197,10 @@ protected:
friend class SBThread;
friend class SBValue;
friend class lldb_private::python::SWIGBridge;
SBFrame(const lldb::StackFrameSP &lldb_object_sp);
lldb::StackFrameSP GetFrameSP() const;
void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp);

View File

@@ -16,6 +16,12 @@
#include "lldb/API/SBTarget.h"
#include <cstdio>
namespace lldb_private {
namespace python {
class SWIGBridge;
}
} // namespace lldb_private
namespace lldb {
class SBEvent;
@@ -36,10 +42,6 @@ public:
const lldb::SBProcess &operator=(const lldb::SBProcess &rhs);
#ifndef SWIG
SBProcess(const lldb::ProcessSP &process_sp);
#endif
~SBProcess();
static const char *GetBroadcasterClassName();
@@ -440,6 +442,7 @@ public:
protected:
friend class SBAddress;
friend class SBBreakpoint;
friend class SBBreakpointCallbackBaton;
friend class SBBreakpointLocation;
friend class SBCommandInterpreter;
friend class SBDebugger;
@@ -451,6 +454,10 @@ protected:
friend class SBValue;
friend class lldb_private::QueueImpl;
friend class lldb_private::python::SWIGBridge;
SBProcess(const lldb::ProcessSP &process_sp);
lldb::ProcessSP GetSP() const;
void SetSP(const lldb::ProcessSP &process_sp);

View File

@@ -20,8 +20,6 @@ class LLDB_API SBQueue {
public:
SBQueue();
SBQueue(const QueueSP &queue_sp);
SBQueue(const SBQueue &rhs);
const SBQueue &operator=(const lldb::SBQueue &rhs);
@@ -58,6 +56,8 @@ protected:
friend class SBProcess;
friend class SBThread;
SBQueue(const QueueSP &queue_sp);
void SetQueue(const lldb::QueueSP &queue_sp);
private:

View File

@@ -12,14 +12,16 @@
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBDefines.h"
namespace lldb_private {
class QueueImpl;
}
namespace lldb {
class LLDB_API SBQueueItem {
public:
SBQueueItem();
SBQueueItem(const lldb::QueueItemSP &queue_item_sp);
~SBQueueItem();
explicit operator bool() const;
@@ -36,10 +38,15 @@ public:
void SetAddress(lldb::SBAddress addr);
void SetQueueItem(const lldb::QueueItemSP &queue_item_sp);
SBThread GetExtendedBacktraceThread(const char *type);
protected:
friend class lldb_private::QueueImpl;
SBQueueItem(const lldb::QueueItemSP &queue_item_sp);
void SetQueueItem(const lldb::QueueItemSP &queue_item_sp);
private:
lldb::QueueItemSP m_queue_item_sp;
};

View File

@@ -12,6 +12,12 @@
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBModule.h"
namespace lldb_private {
namespace python {
class SWIGBridge;
}
} // namespace lldb_private
namespace lldb {
class SBStructuredData {
@@ -20,12 +26,6 @@ public:
SBStructuredData(const lldb::SBStructuredData &rhs);
SBStructuredData(const lldb::EventSP &event_sp);
#ifndef SWIG
SBStructuredData(const lldb_private::StructuredDataImpl &impl);
#endif
~SBStructuredData();
lldb::SBStructuredData &operator=(const lldb::SBStructuredData &rhs);
@@ -103,6 +103,11 @@ protected:
friend class SBBreakpointLocation;
friend class SBBreakpointName;
friend class SBTrace;
friend class lldb_private::python::SWIGBridge;
SBStructuredData(const lldb_private::StructuredDataImpl &impl);
SBStructuredData(const lldb::EventSP &event_sp);
StructuredDataImplUP m_impl_up;
};

View File

@@ -17,6 +17,12 @@
#include "lldb/API/SBModule.h"
#include "lldb/API/SBSymbol.h"
namespace lldb_private {
namespace python {
class SWIGBridge;
}
} // namespace lldb_private
namespace lldb {
class LLDB_API SBSymbolContext {
@@ -25,10 +31,6 @@ public:
SBSymbolContext(const lldb::SBSymbolContext &rhs);
#ifndef SWIG
SBSymbolContext(const lldb_private::SymbolContext &sc_ptr);
#endif
~SBSymbolContext();
explicit operator bool() const;
@@ -64,6 +66,10 @@ protected:
friend class SBTarget;
friend class SBSymbolContextList;
friend class lldb_private::python::SWIGBridge;
SBSymbolContext(const lldb_private::SymbolContext &sc_ptr);
lldb_private::SymbolContext *operator->() const;
lldb_private::SymbolContext &operator*();

View File

@@ -22,6 +22,12 @@
#include "lldb/API/SBValue.h"
#include "lldb/API/SBWatchpoint.h"
namespace lldb_private {
namespace python {
class SWIGBridge;
}
} // namespace lldb_private
namespace lldb {
class SBPlatform;
@@ -42,10 +48,6 @@ public:
SBTarget(const lldb::SBTarget &rhs);
#ifndef SWIG
SBTarget(const lldb::TargetSP &target_sp);
#endif
// Destructor
~SBTarget();
@@ -917,10 +919,12 @@ public:
protected:
friend class SBAddress;
friend class SBBlock;
friend class SBBreakpoint;
friend class SBBreakpointList;
friend class SBBreakpointNameImpl;
friend class SBDebugger;
friend class SBExecutionContext;
friend class SBFrame;
friend class SBFunction;
friend class SBInstruction;
friend class SBModule;
@@ -932,9 +936,13 @@ protected:
friend class SBValue;
friend class SBVariablesOptions;
friend class lldb_private::python::SWIGBridge;
// Constructors are private, use static Target::Create function to create an
// instance of this class.
SBTarget(const lldb::TargetSP &target_sp);
lldb::TargetSP GetSP() const;
void SetSP(const lldb::TargetSP &target_sp);

View File

@@ -13,6 +13,12 @@
#include <cstdio>
namespace lldb_private {
namespace python {
class SWIGBridge;
}
} // namespace lldb_private
namespace lldb {
class SBFrame;
@@ -33,10 +39,6 @@ public:
SBThread(const lldb::SBThread &thread);
#ifndef SWIG
SBThread(const lldb::ThreadSP &lldb_object_sp);
#endif
~SBThread();
lldb::SBQueue GetQueue() const;
@@ -223,9 +225,14 @@ private:
friend class SBValue;
friend class lldb_private::QueueImpl;
friend class SBQueueItem;
friend class SBThreadCollection;
friend class SBThreadPlan;
friend class SBTrace;
friend class lldb_private::python::SWIGBridge;
SBThread(const lldb::ThreadSP &lldb_object_sp);
void SetThread(const lldb::ThreadSP &lldb_object_sp);
SBError ResumeNewPlan(lldb_private::ExecutionContext &exe_ctx,

View File

@@ -13,6 +13,12 @@
#include <cstdio>
namespace lldb_private {
namespace python {
class SWIGBridge;
}
} // namespace lldb_private
namespace lldb {
class LLDB_API SBThreadPlan {
@@ -22,8 +28,6 @@ public:
SBThreadPlan(const lldb::SBThreadPlan &threadPlan);
SBThreadPlan(const lldb::ThreadPlanSP &lldb_object_sp);
SBThreadPlan(lldb::SBThread &thread, const char *class_name);
SBThreadPlan(lldb::SBThread &thread, const char *class_name,
@@ -112,6 +116,11 @@ public:
lldb::SBStructuredData &args_data,
SBError &error);
protected:
friend class lldb_private::python::SWIGBridge;
SBThreadPlan(const lldb::ThreadPlanSP &lldb_object_sp);
private:
friend class SBBreakpoint;
friend class SBBreakpointLocation;

View File

@@ -20,10 +20,6 @@ public:
/// Default constructor for an invalid Trace object.
SBTrace();
#ifndef SWIG
SBTrace(const lldb::TraceSP &trace_sp);
#endif
/// See SBDebugger::LoadTraceFromFile.
static SBTrace LoadTraceFromFile(SBError &error, SBDebugger &debugger,
const SBFileSpec &trace_description_file);
@@ -139,6 +135,10 @@ public:
bool IsValid();
protected:
friend class SBTarget;
SBTrace(const lldb::TraceSP &trace_sp);
lldb::TraceSP m_opaque_sp;
/// deprecated
lldb::ProcessWP m_opaque_wp;

View File

@@ -20,10 +20,6 @@ public:
/// Default constructor for an invalid \a SBTraceCursor object.
SBTraceCursor();
/// Create a cursor that initially points to the end of the trace, i.e. the
/// most recent item.
SBTraceCursor(lldb::TraceCursorSP trace_cursor_sp);
/// Set the direction to use in the \a SBTraceCursor::Next() method.
///
/// \param[in] forwards
@@ -169,6 +165,12 @@ public:
explicit operator bool() const;
protected:
friend class SBTrace;
/// Create a cursor that initially points to the end of the trace, i.e. the
/// most recent item.
SBTraceCursor(lldb::TraceCursorSP trace_cursor_sp);
lldb::TraceCursorSP m_opaque_sp;
};
} // namespace lldb

View File

@@ -11,6 +11,12 @@
#include "lldb/API/SBDefines.h"
namespace lldb_private {
namespace python {
class SWIGBridge;
}
} // namespace lldb_private
namespace lldb {
class SBTypeList;
@@ -106,9 +112,6 @@ public:
SBType();
SBType(const lldb::SBType &rhs);
#ifndef SWIG
SBType(const lldb::TypeImplSP &);
#endif
~SBType();
@@ -241,8 +244,11 @@ protected:
friend class SBValue;
friend class SBWatchpoint;
friend class lldb_private::python::SWIGBridge;
SBType(const lldb_private::CompilerType &);
SBType(const lldb::TypeSP &);
SBType(const lldb::TypeImplSP &);
};
class SBTypeList {

View File

@@ -12,6 +12,12 @@
#include "lldb/API/SBDefines.h"
namespace lldb_private {
namespace python {
class SWIGBridge;
}
} // namespace lldb_private
namespace lldb {
class LLDB_API SBTypeSummaryOptions {
public:
@@ -19,9 +25,6 @@ public:
SBTypeSummaryOptions(const lldb::SBTypeSummaryOptions &rhs);
#ifndef SWIG
SBTypeSummaryOptions(const lldb_private::TypeSummaryOptions &lldb_object);
#endif
~SBTypeSummaryOptions();
@@ -39,6 +42,11 @@ public:
protected:
friend class SBValue;
friend class SBTypeSummary;
friend class lldb_private::python::SWIGBridge;
SBTypeSummaryOptions(const lldb_private::TypeSummaryOptions &lldb_object);
lldb_private::TypeSummaryOptions *operator->();

View File

@@ -16,6 +16,12 @@
class ValueImpl;
class ValueLocker;
namespace lldb_private {
namespace python {
class SWIGBridge;
}
} // namespace lldb_private
namespace lldb {
class LLDB_API SBValue {
@@ -309,10 +315,6 @@ public:
const SBExpressionOptions &options,
const char *name) const;
#ifndef SWIG
SBValue(const lldb::ValueObjectSP &value_sp);
#endif
/// Watch this value if it resides in memory.
///
/// Sets a watchpoint on the value.
@@ -370,7 +372,19 @@ public:
lldb::SBWatchpoint WatchPointee(bool resolve_location, bool read, bool write,
SBError &error);
#ifndef SWIG
protected:
friend class SBBlock;
friend class SBFrame;
friend class SBModule;
friend class SBTarget;
friend class SBThread;
friend class SBTypeSummary;
friend class SBValueList;
friend class lldb_private::python::SWIGBridge;
SBValue(const lldb::ValueObjectSP &value_sp);
/// Same as the protected version of GetSP that takes a locker, except that we
/// make the
/// locker locally in the function. Since the Target API mutex is recursive,
@@ -383,14 +397,6 @@ public:
/// A ValueObjectSP of the best kind (static, dynamic or synthetic) we
/// can cons up, in accordance with the SBValue's settings.
lldb::ValueObjectSP GetSP() const;
#endif
protected:
friend class SBBlock;
friend class SBFrame;
friend class SBTarget;
friend class SBThread;
friend class SBValueList;
/// Get the appropriate ValueObjectSP from this SBValue, consulting the
/// use_dynamic and use_synthetic options passed in to SetSP when the

View File

@@ -12,6 +12,12 @@
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBType.h"
namespace lldb_private {
namespace ptyhon {
class SWIGBridge;
}
} // namespace lldb_private
namespace lldb {
class LLDB_API SBWatchpoint {
@@ -20,10 +26,6 @@ public:
SBWatchpoint(const lldb::SBWatchpoint &rhs);
#ifndef SWIG
SBWatchpoint(const lldb::WatchpointSP &wp_sp);
#endif
~SBWatchpoint();
const lldb::SBWatchpoint &operator=(const lldb::SBWatchpoint &rhs);
@@ -65,12 +67,6 @@ public:
void Clear();
#ifndef SWIG
lldb::WatchpointSP GetSP() const;
void SetSP(const lldb::WatchpointSP &sp);
#endif
static bool EventIsWatchpointEvent(const lldb::SBEvent &event);
static lldb::WatchpointEventType
@@ -88,6 +84,15 @@ public:
bool IsWatchingWrites();
protected:
friend class lldb_private::python::SWIGBridge;
SBWatchpoint(const lldb::WatchpointSP &wp_sp);
lldb::WatchpointSP GetSP() const;
void SetSP(const lldb::WatchpointSP &sp);
private:
friend class SBTarget;
friend class SBValue;

View File

@@ -33,6 +33,7 @@
using namespace lldb;
using namespace lldb_private;
namespace lldb_private {
class CommandPluginInterfaceImplementation : public CommandObjectParsed {
public:
CommandPluginInterfaceImplementation(CommandInterpreter &interpreter,
@@ -73,13 +74,14 @@ protected:
SBCommandReturnObject sb_return(result);
SBCommandInterpreter sb_interpreter(&m_interpreter);
SBDebugger debugger_sb(m_interpreter.GetDebugger().shared_from_this());
bool ret = m_backend->DoExecute(
debugger_sb, command.GetArgumentVector(), sb_return);
bool ret = m_backend->DoExecute(debugger_sb, command.GetArgumentVector(),
sb_return);
return ret;
}
std::shared_ptr<lldb::SBCommandPluginInterface> m_backend;
std::optional<std::string> m_auto_repeat_command;
};
} // namespace lldb_private
SBCommandInterpreter::SBCommandInterpreter(CommandInterpreter *interpreter)
: m_opaque_ptr(interpreter) {

View File

@@ -65,42 +65,6 @@
using namespace lldb;
using namespace lldb_private;
static llvm::sys::DynamicLibrary LoadPlugin(const lldb::DebuggerSP &debugger_sp,
const FileSpec &spec,
Status &error) {
llvm::sys::DynamicLibrary dynlib =
llvm::sys::DynamicLibrary::getPermanentLibrary(spec.GetPath().c_str());
if (dynlib.isValid()) {
typedef bool (*LLDBCommandPluginInit)(lldb::SBDebugger & debugger);
lldb::SBDebugger debugger_sb(debugger_sp);
// This calls the bool lldb::PluginInitialize(lldb::SBDebugger debugger)
// function.
// TODO: mangle this differently for your system - on OSX, the first
// underscore needs to be removed and the second one stays
LLDBCommandPluginInit init_func =
(LLDBCommandPluginInit)(uintptr_t)dynlib.getAddressOfSymbol(
"_ZN4lldb16PluginInitializeENS_10SBDebuggerE");
if (init_func) {
if (init_func(debugger_sb))
return dynlib;
else
error.SetErrorString("plug-in refused to load "
"(lldb::PluginInitialize(lldb::SBDebugger) "
"returned false)");
} else {
error.SetErrorString("plug-in is missing the required initialization: "
"lldb::PluginInitialize(lldb::SBDebugger)");
}
} else {
if (FileSystem::Instance().Exists(spec))
error.SetErrorString("this file does not represent a loadable dylib");
else
error.SetErrorString("no such file");
}
return llvm::sys::DynamicLibrary();
}
static llvm::ManagedStatic<SystemLifetimeManager> g_debugger_lifetime;
SBError SBInputReader::Initialize(
@@ -214,6 +178,42 @@ void SBDebugger::Initialize() {
lldb::SBError SBDebugger::InitializeWithErrorHandling() {
LLDB_INSTRUMENT();
auto LoadPlugin = [](const lldb::DebuggerSP &debugger_sp,
const FileSpec &spec,
Status &error) -> llvm::sys::DynamicLibrary {
llvm::sys::DynamicLibrary dynlib =
llvm::sys::DynamicLibrary::getPermanentLibrary(spec.GetPath().c_str());
if (dynlib.isValid()) {
typedef bool (*LLDBCommandPluginInit)(lldb::SBDebugger & debugger);
lldb::SBDebugger debugger_sb(debugger_sp);
// This calls the bool lldb::PluginInitialize(lldb::SBDebugger debugger)
// function.
// TODO: mangle this differently for your system - on OSX, the first
// underscore needs to be removed and the second one stays
LLDBCommandPluginInit init_func =
(LLDBCommandPluginInit)(uintptr_t)dynlib.getAddressOfSymbol(
"_ZN4lldb16PluginInitializeENS_10SBDebuggerE");
if (init_func) {
if (init_func(debugger_sb))
return dynlib;
else
error.SetErrorString("plug-in refused to load "
"(lldb::PluginInitialize(lldb::SBDebugger) "
"returned false)");
} else {
error.SetErrorString("plug-in is missing the required initialization: "
"lldb::PluginInitialize(lldb::SBDebugger)");
}
} else {
if (FileSystem::Instance().Exists(spec))
error.SetErrorString("this file does not represent a loadable dylib");
else
error.SetErrorString("no such file");
}
return llvm::sys::DynamicLibrary();
};
SBError error;
if (auto e = g_debugger_lifetime->Initialize(
std::make_unique<SystemInitializerFull>(), LoadPlugin)) {

View File

@@ -61,35 +61,201 @@ private:
T *m_sb;
};
PythonObject ToSWIGWrapper(lldb::ValueObjectSP value_sp);
PythonObject ToSWIGWrapper(lldb::TargetSP target_sp);
PythonObject ToSWIGWrapper(lldb::ProcessSP process_sp);
PythonObject ToSWIGWrapper(lldb::ThreadPlanSP thread_plan_sp);
PythonObject ToSWIGWrapper(lldb::BreakpointSP breakpoint_sp);
PythonObject ToSWIGWrapper(const Status &status);
PythonObject ToSWIGWrapper(const StructuredDataImpl &data_impl);
PythonObject ToSWIGWrapper(lldb::ThreadSP thread_sp);
PythonObject ToSWIGWrapper(lldb::StackFrameSP frame_sp);
PythonObject ToSWIGWrapper(lldb::DebuggerSP debugger_sp);
PythonObject ToSWIGWrapper(lldb::WatchpointSP watchpoint_sp);
PythonObject ToSWIGWrapper(lldb::BreakpointLocationSP bp_loc_sp);
PythonObject ToSWIGWrapper(lldb::ExecutionContextRefSP ctx_sp);
PythonObject ToSWIGWrapper(const TypeSummaryOptions &summary_options);
PythonObject ToSWIGWrapper(const SymbolContext &sym_ctx);
// TODO: We may want to support other languages in the future w/ SWIG (we
// already support Lua right now, for example). We could create a generic
// SWIGBridge class and have this one specialize it, something like this:
//
// <typename T>
// class SWIGBridge {
// static T ToSWIGWrapper(...);
// };
//
// class SWIGPythonBridge : public SWIGBridge<PythonObject> {
// template<> static PythonObject ToSWIGWrapper(...);
// };
//
// And we should be able to more easily support things like Lua
class SWIGBridge {
public:
static PythonObject ToSWIGWrapper(std::unique_ptr<lldb::SBValue> value_sb);
static PythonObject ToSWIGWrapper(lldb::ValueObjectSP value_sp);
static PythonObject ToSWIGWrapper(lldb::TargetSP target_sp);
static PythonObject ToSWIGWrapper(lldb::ProcessSP process_sp);
static PythonObject ToSWIGWrapper(lldb::ThreadPlanSP thread_plan_sp);
static PythonObject ToSWIGWrapper(lldb::BreakpointSP breakpoint_sp);
static PythonObject ToSWIGWrapper(const Status &status);
static PythonObject ToSWIGWrapper(const StructuredDataImpl &data_impl);
static PythonObject ToSWIGWrapper(lldb::ThreadSP thread_sp);
static PythonObject ToSWIGWrapper(lldb::StackFrameSP frame_sp);
static PythonObject ToSWIGWrapper(lldb::DebuggerSP debugger_sp);
static PythonObject ToSWIGWrapper(lldb::WatchpointSP watchpoint_sp);
static PythonObject ToSWIGWrapper(lldb::BreakpointLocationSP bp_loc_sp);
static PythonObject ToSWIGWrapper(lldb::TypeImplSP type_impl_sp);
static PythonObject ToSWIGWrapper(lldb::ExecutionContextRefSP ctx_sp);
static PythonObject ToSWIGWrapper(const TypeSummaryOptions &summary_options);
static PythonObject ToSWIGWrapper(const SymbolContext &sym_ctx);
PythonObject ToSWIGWrapper(lldb::ProcessAttachInfoSP attach_info_sp);
PythonObject ToSWIGWrapper(lldb::ProcessLaunchInfoSP launch_info_sp);
PythonObject ToSWIGWrapper(lldb::DataExtractorSP data_extractor_sp);
static PythonObject ToSWIGWrapper(lldb::ProcessAttachInfoSP attach_info_sp);
static PythonObject ToSWIGWrapper(lldb::ProcessLaunchInfoSP launch_info_sp);
static PythonObject ToSWIGWrapper(lldb::DataExtractorSP data_extractor_sp);
PythonObject ToSWIGWrapper(std::unique_ptr<lldb::SBValue> value_sb);
PythonObject ToSWIGWrapper(std::unique_ptr<lldb::SBStream> stream_sb);
PythonObject ToSWIGWrapper(std::unique_ptr<lldb::SBStructuredData> data_sb);
static PythonObject ToSWIGWrapper(std::unique_ptr<lldb::SBStream> stream_sb);
static PythonObject
ToSWIGWrapper(std::unique_ptr<lldb::SBStructuredData> data_sb);
python::ScopedPythonObject<lldb::SBCommandReturnObject>
ToSWIGWrapper(CommandReturnObject &cmd_retobj);
python::ScopedPythonObject<lldb::SBEvent> ToSWIGWrapper(Event *event);
static python::ScopedPythonObject<lldb::SBCommandReturnObject>
ToSWIGWrapper(CommandReturnObject &cmd_retobj);
static python::ScopedPythonObject<lldb::SBEvent> ToSWIGWrapper(Event *event);
// These prototypes are the Pythonic implementations of the required
// callbacks. Although these are scripting-language specific, their definition
// depends on the public API.
} // namespace python
static python::PythonObject LLDBSwigPythonCreateScriptedObject(
const char *python_class_name, const char *session_dictionary_name,
lldb::ExecutionContextRefSP exe_ctx_sp,
const lldb_private::StructuredDataImpl &args_impl,
std::string &error_string);
static llvm::Expected<bool> LLDBSwigPythonBreakpointCallbackFunction(
const char *python_function_name, const char *session_dictionary_name,
const lldb::StackFrameSP &sb_frame,
const lldb::BreakpointLocationSP &sb_bp_loc,
const lldb_private::StructuredDataImpl &args_impl);
static bool LLDBSwigPythonWatchpointCallbackFunction(
const char *python_function_name, const char *session_dictionary_name,
const lldb::StackFrameSP &sb_frame, const lldb::WatchpointSP &sb_wp);
static bool
LLDBSwigPythonFormatterCallbackFunction(const char *python_function_name,
const char *session_dictionary_name,
lldb::TypeImplSP type_impl_sp);
static bool LLDBSwigPythonCallTypeScript(
const char *python_function_name, const void *session_dictionary,
const lldb::ValueObjectSP &valobj_sp, void **pyfunct_wrapper,
const lldb::TypeSummaryOptionsSP &options_sp, std::string &retval);
static python::PythonObject
LLDBSwigPythonCreateSyntheticProvider(const char *python_class_name,
const char *session_dictionary_name,
const lldb::ValueObjectSP &valobj_sp);
static python::PythonObject
LLDBSwigPythonCreateCommandObject(const char *python_class_name,
const char *session_dictionary_name,
lldb::DebuggerSP debugger_sp);
static python::PythonObject LLDBSwigPythonCreateScriptedThreadPlan(
const char *python_class_name, const char *session_dictionary_name,
const StructuredDataImpl &args_data, std::string &error_string,
const lldb::ThreadPlanSP &thread_plan_sp);
static bool LLDBSWIGPythonCallThreadPlan(void *implementor,
const char *method_name,
lldb_private::Event *event_sp,
bool &got_error);
static bool LLDBSWIGPythonCallThreadPlan(void *implementor,
const char *method_name,
lldb_private::Stream *stream,
bool &got_error);
static python::PythonObject LLDBSwigPythonCreateScriptedBreakpointResolver(
const char *python_class_name, const char *session_dictionary_name,
const StructuredDataImpl &args, const lldb::BreakpointSP &bkpt_sp);
static unsigned int
LLDBSwigPythonCallBreakpointResolver(void *implementor,
const char *method_name,
lldb_private::SymbolContext *sym_ctx);
static python::PythonObject LLDBSwigPythonCreateScriptedStopHook(
lldb::TargetSP target_sp, const char *python_class_name,
const char *session_dictionary_name, const StructuredDataImpl &args,
lldb_private::Status &error);
static bool
LLDBSwigPythonStopHookCallHandleStop(void *implementor,
lldb::ExecutionContextRefSP exc_ctx,
lldb::StreamSP stream);
static size_t LLDBSwigPython_CalculateNumChildren(PyObject *implementor,
uint32_t max);
static PyObject *LLDBSwigPython_GetChildAtIndex(PyObject *implementor,
uint32_t idx);
static int LLDBSwigPython_GetIndexOfChildWithName(PyObject *implementor,
const char *child_name);
static lldb::ValueObjectSP
LLDBSWIGPython_GetValueObjectSPFromSBValue(void *data);
static bool LLDBSwigPython_UpdateSynthProviderInstance(PyObject *implementor);
static bool
LLDBSwigPython_MightHaveChildrenSynthProviderInstance(PyObject *implementor);
static PyObject *
LLDBSwigPython_GetValueSynthProviderInstance(PyObject *implementor);
static bool
LLDBSwigPythonCallCommand(const char *python_function_name,
const char *session_dictionary_name,
lldb::DebuggerSP debugger, const char *args,
lldb_private::CommandReturnObject &cmd_retobj,
lldb::ExecutionContextRefSP exe_ctx_ref_sp);
static bool
LLDBSwigPythonCallCommandObject(PyObject *implementor,
lldb::DebuggerSP debugger, const char *args,
lldb_private::CommandReturnObject &cmd_retobj,
lldb::ExecutionContextRefSP exe_ctx_ref_sp);
static bool LLDBSwigPythonCallModuleInit(const char *python_module_name,
const char *session_dictionary_name,
lldb::DebuggerSP debugger);
static python::PythonObject
LLDBSWIGPythonCreateOSPlugin(const char *python_class_name,
const char *session_dictionary_name,
const lldb::ProcessSP &process_sp);
static python::PythonObject
LLDBSWIGPython_CreateFrameRecognizer(const char *python_class_name,
const char *session_dictionary_name);
static PyObject *
LLDBSwigPython_GetRecognizedArguments(PyObject *implementor,
const lldb::StackFrameSP &frame_sp);
static bool LLDBSWIGPythonRunScriptKeywordProcess(
const char *python_function_name, const char *session_dictionary_name,
const lldb::ProcessSP &process, std::string &output);
static std::optional<std::string>
LLDBSWIGPythonRunScriptKeywordThread(const char *python_function_name,
const char *session_dictionary_name,
lldb::ThreadSP thread);
static bool LLDBSWIGPythonRunScriptKeywordTarget(
const char *python_function_name, const char *session_dictionary_name,
const lldb::TargetSP &target, std::string &output);
static std::optional<std::string>
LLDBSWIGPythonRunScriptKeywordFrame(const char *python_function_name,
const char *session_dictionary_name,
lldb::StackFrameSP frame);
static bool LLDBSWIGPythonRunScriptKeywordValue(
const char *python_function_name, const char *session_dictionary_name,
const lldb::ValueObjectSP &value, std::string &output);
static void *
LLDBSWIGPython_GetDynamicSetting(void *module, const char *setting,
const lldb::TargetSP &target_sp);
};
void *LLDBSWIGPython_CastPyObjectToSBData(PyObject *data);
void *LLDBSWIGPython_CastPyObjectToSBBreakpoint(PyObject *data);
@@ -98,150 +264,7 @@ void *LLDBSWIGPython_CastPyObjectToSBLaunchInfo(PyObject *data);
void *LLDBSWIGPython_CastPyObjectToSBError(PyObject *data);
void *LLDBSWIGPython_CastPyObjectToSBValue(PyObject *data);
void *LLDBSWIGPython_CastPyObjectToSBMemoryRegionInfo(PyObject *data);
// These prototypes are the Pythonic implementations of the required callbacks.
// Although these are scripting-language specific, their definition depends on
// the public API.
python::PythonObject LLDBSwigPythonCreateScriptedObject(
const char *python_class_name, const char *session_dictionary_name,
lldb::ExecutionContextRefSP exe_ctx_sp,
const lldb_private::StructuredDataImpl &args_impl,
std::string &error_string);
llvm::Expected<bool> LLDBSwigPythonBreakpointCallbackFunction(
const char *python_function_name, const char *session_dictionary_name,
const lldb::StackFrameSP &sb_frame,
const lldb::BreakpointLocationSP &sb_bp_loc,
const lldb_private::StructuredDataImpl &args_impl);
bool LLDBSwigPythonWatchpointCallbackFunction(
const char *python_function_name, const char *session_dictionary_name,
const lldb::StackFrameSP &sb_frame, const lldb::WatchpointSP &sb_wp);
bool LLDBSwigPythonFormatterCallbackFunction(
const char *python_function_name, const char *session_dictionary_name,
lldb::TypeImplSP type_impl_sp);
bool LLDBSwigPythonCallTypeScript(const char *python_function_name,
const void *session_dictionary,
const lldb::ValueObjectSP &valobj_sp,
void **pyfunct_wrapper,
const lldb::TypeSummaryOptionsSP &options_sp,
std::string &retval);
python::PythonObject
LLDBSwigPythonCreateSyntheticProvider(const char *python_class_name,
const char *session_dictionary_name,
const lldb::ValueObjectSP &valobj_sp);
python::PythonObject
LLDBSwigPythonCreateCommandObject(const char *python_class_name,
const char *session_dictionary_name,
lldb::DebuggerSP debugger_sp);
python::PythonObject LLDBSwigPythonCreateScriptedThreadPlan(
const char *python_class_name, const char *session_dictionary_name,
const StructuredDataImpl &args_data, std::string &error_string,
const lldb::ThreadPlanSP &thread_plan_sp);
bool LLDBSWIGPythonCallThreadPlan(void *implementor, const char *method_name,
lldb_private::Event *event_sp,
bool &got_error);
bool LLDBSWIGPythonCallThreadPlan(void *implementor,
const char *method_name,
lldb_private::Stream *stream,
bool &got_error);
python::PythonObject LLDBSwigPythonCreateScriptedBreakpointResolver(
const char *python_class_name, const char *session_dictionary_name,
const StructuredDataImpl &args, const lldb::BreakpointSP &bkpt_sp);
unsigned int
LLDBSwigPythonCallBreakpointResolver(void *implementor, const char *method_name,
lldb_private::SymbolContext *sym_ctx);
python::PythonObject LLDBSwigPythonCreateScriptedStopHook(
lldb::TargetSP target_sp, const char *python_class_name,
const char *session_dictionary_name, const StructuredDataImpl &args,
lldb_private::Status &error);
bool LLDBSwigPythonStopHookCallHandleStop(void *implementor,
lldb::ExecutionContextRefSP exc_ctx,
lldb::StreamSP stream);
size_t LLDBSwigPython_CalculateNumChildren(PyObject *implementor, uint32_t max);
PyObject *LLDBSwigPython_GetChildAtIndex(PyObject *implementor, uint32_t idx);
int LLDBSwigPython_GetIndexOfChildWithName(PyObject *implementor,
const char *child_name);
lldb::ValueObjectSP LLDBSWIGPython_GetValueObjectSPFromSBValue(void *data);
bool LLDBSwigPython_UpdateSynthProviderInstance(PyObject *implementor);
bool LLDBSwigPython_MightHaveChildrenSynthProviderInstance(
PyObject *implementor);
PyObject *LLDBSwigPython_GetValueSynthProviderInstance(PyObject *implementor);
bool LLDBSwigPythonCallCommand(const char *python_function_name,
const char *session_dictionary_name,
lldb::DebuggerSP debugger, const char *args,
lldb_private::CommandReturnObject &cmd_retobj,
lldb::ExecutionContextRefSP exe_ctx_ref_sp);
bool LLDBSwigPythonCallCommandObject(
PyObject *implementor, lldb::DebuggerSP debugger, const char *args,
lldb_private::CommandReturnObject &cmd_retobj,
lldb::ExecutionContextRefSP exe_ctx_ref_sp);
bool LLDBSwigPythonCallModuleInit(const char *python_module_name,
const char *session_dictionary_name,
lldb::DebuggerSP debugger);
python::PythonObject
LLDBSWIGPythonCreateOSPlugin(const char *python_class_name,
const char *session_dictionary_name,
const lldb::ProcessSP &process_sp);
python::PythonObject
LLDBSWIGPython_CreateFrameRecognizer(const char *python_class_name,
const char *session_dictionary_name);
PyObject *
LLDBSwigPython_GetRecognizedArguments(PyObject *implementor,
const lldb::StackFrameSP &frame_sp);
bool LLDBSWIGPythonRunScriptKeywordProcess(const char *python_function_name,
const char *session_dictionary_name,
const lldb::ProcessSP &process,
std::string &output);
std::optional<std::string>
LLDBSWIGPythonRunScriptKeywordThread(const char *python_function_name,
const char *session_dictionary_name,
lldb::ThreadSP thread);
bool LLDBSWIGPythonRunScriptKeywordTarget(const char *python_function_name,
const char *session_dictionary_name,
const lldb::TargetSP &target,
std::string &output);
std::optional<std::string>
LLDBSWIGPythonRunScriptKeywordFrame(const char *python_function_name,
const char *session_dictionary_name,
lldb::StackFrameSP frame);
bool LLDBSWIGPythonRunScriptKeywordValue(const char *python_function_name,
const char *session_dictionary_name,
const lldb::ValueObjectSP &value,
std::string &output);
void *LLDBSWIGPython_GetDynamicSetting(void *module, const char *setting,
const lldb::TargetSP &target_sp);
} // namespace python
} // namespace lldb_private

View File

@@ -1463,7 +1463,7 @@ ScriptInterpreterPythonImpl::CreateFrameRecognizer(const char *class_name) {
return StructuredData::GenericSP();
Locker py_lock(this, Locker::AcquireLock | Locker::NoSTDIN, Locker::FreeLock);
PythonObject ret_val = LLDBSWIGPython_CreateFrameRecognizer(
PythonObject ret_val = SWIGBridge::LLDBSWIGPython_CreateFrameRecognizer(
class_name, m_dictionary_name.c_str());
return StructuredData::GenericSP(
@@ -1488,9 +1488,9 @@ lldb::ValueObjectListSP ScriptInterpreterPythonImpl::GetRecognizedArguments(
if (!implementor.IsAllocated())
return ValueObjectListSP();
PythonObject py_return(
PyRefType::Owned,
LLDBSwigPython_GetRecognizedArguments(implementor.get(), frame_sp));
PythonObject py_return(PyRefType::Owned,
SWIGBridge::LLDBSwigPython_GetRecognizedArguments(
implementor.get(), frame_sp));
// if it fails, print the error but otherwise go on
if (PyErr_Occurred()) {
@@ -1504,7 +1504,8 @@ lldb::ValueObjectListSP ScriptInterpreterPythonImpl::GetRecognizedArguments(
PyObject *item = result_list.GetItemAtIndex(i).get();
lldb::SBValue *sb_value_ptr =
(lldb::SBValue *)LLDBSWIGPython_CastPyObjectToSBValue(item);
auto valobj_sp = LLDBSWIGPython_GetValueObjectSPFromSBValue(sb_value_ptr);
auto valobj_sp =
SWIGBridge::LLDBSWIGPython_GetValueObjectSPFromSBValue(sb_value_ptr);
if (valobj_sp)
result->Append(valobj_sp);
}
@@ -1528,7 +1529,7 @@ ScriptInterpreterPythonImpl::OSPlugin_CreatePluginObject(
return StructuredData::GenericSP();
Locker py_lock(this, Locker::AcquireLock | Locker::NoSTDIN, Locker::FreeLock);
PythonObject ret_val = LLDBSWIGPythonCreateOSPlugin(
PythonObject ret_val = SWIGBridge::LLDBSWIGPythonCreateOSPlugin(
class_name, m_dictionary_name.c_str(), process_sp);
return StructuredData::GenericSP(
@@ -1689,7 +1690,7 @@ StructuredData::ObjectSP ScriptInterpreterPythonImpl::CreateScriptedThreadPlan(
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
PythonObject ret_val = LLDBSwigPythonCreateScriptedThreadPlan(
PythonObject ret_val = SWIGBridge::LLDBSwigPythonCreateScriptedThreadPlan(
class_name, python_interpreter->m_dictionary_name.c_str(), args_data,
error_str, thread_plan_sp);
if (!ret_val)
@@ -1708,7 +1709,7 @@ bool ScriptInterpreterPythonImpl::ScriptedThreadPlanExplainsStop(
if (generic) {
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
explains_stop = LLDBSWIGPythonCallThreadPlan(
explains_stop = SWIGBridge::LLDBSWIGPythonCallThreadPlan(
generic->GetValue(), "explains_stop", event, script_error);
if (script_error)
return true;
@@ -1725,7 +1726,7 @@ bool ScriptInterpreterPythonImpl::ScriptedThreadPlanShouldStop(
if (generic) {
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
should_stop = LLDBSWIGPythonCallThreadPlan(
should_stop = SWIGBridge::LLDBSWIGPythonCallThreadPlan(
generic->GetValue(), "should_stop", event, script_error);
if (script_error)
return true;
@@ -1742,8 +1743,8 @@ bool ScriptInterpreterPythonImpl::ScriptedThreadPlanIsStale(
if (generic) {
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
is_stale = LLDBSWIGPythonCallThreadPlan(generic->GetValue(), "is_stale",
(Event *) nullptr, script_error);
is_stale = SWIGBridge::LLDBSWIGPythonCallThreadPlan(
generic->GetValue(), "is_stale", (Event *)nullptr, script_error);
if (script_error)
return true;
}
@@ -1759,8 +1760,8 @@ lldb::StateType ScriptInterpreterPythonImpl::ScriptedThreadPlanGetRunState(
if (generic) {
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
should_step = LLDBSWIGPythonCallThreadPlan(
generic->GetValue(), "should_step", (Event *) nullptr, script_error);
should_step = SWIGBridge::LLDBSWIGPythonCallThreadPlan(
generic->GetValue(), "should_step", (Event *)nullptr, script_error);
if (script_error)
should_step = true;
}
@@ -1782,8 +1783,8 @@ ScriptInterpreterPythonImpl::ScriptedThreadPlanGetStopDescription(
}
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
return LLDBSWIGPythonCallThreadPlan(generic->GetValue(), "stop_description",
stream, script_error);
return SWIGBridge::LLDBSWIGPythonCallThreadPlan(
generic->GetValue(), "stop_description", stream, script_error);
}
@@ -1808,9 +1809,10 @@ ScriptInterpreterPythonImpl::CreateScriptedBreakpointResolver(
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
PythonObject ret_val = LLDBSwigPythonCreateScriptedBreakpointResolver(
class_name, python_interpreter->m_dictionary_name.c_str(), args_data,
bkpt_sp);
PythonObject ret_val =
SWIGBridge::LLDBSwigPythonCreateScriptedBreakpointResolver(
class_name, python_interpreter->m_dictionary_name.c_str(), args_data,
bkpt_sp);
return StructuredData::GenericSP(
new StructuredPythonObject(std::move(ret_val)));
@@ -1823,7 +1825,7 @@ bool ScriptInterpreterPythonImpl::ScriptedBreakpointResolverSearchCallback(
if (implementor_sp) {
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
should_continue = LLDBSwigPythonCallBreakpointResolver(
should_continue = SWIGBridge::LLDBSwigPythonCallBreakpointResolver(
implementor_sp->GetValue(), "__callback__", sym_ctx);
if (PyErr_Occurred()) {
PyErr_Print();
@@ -1840,7 +1842,7 @@ ScriptInterpreterPythonImpl::ScriptedBreakpointResolverSearchDepth(
if (implementor_sp) {
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
depth_as_int = LLDBSwigPythonCallBreakpointResolver(
depth_as_int = SWIGBridge::LLDBSwigPythonCallBreakpointResolver(
implementor_sp->GetValue(), "__get_depth__", nullptr);
if (PyErr_Occurred()) {
PyErr_Print();
@@ -1880,7 +1882,7 @@ StructuredData::GenericSP ScriptInterpreterPythonImpl::CreateScriptedStopHook(
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
PythonObject ret_val = LLDBSwigPythonCreateScriptedStopHook(
PythonObject ret_val = SWIGBridge::LLDBSwigPythonCreateScriptedStopHook(
target_sp, class_name, python_interpreter->m_dictionary_name.c_str(),
args_data, error);
@@ -1900,7 +1902,7 @@ bool ScriptInterpreterPythonImpl::ScriptedStopHookHandleStop(
lldb::ExecutionContextRefSP exc_ctx_ref_sp(new ExecutionContextRef(exc_ctx));
bool ret_val = LLDBSwigPythonStopHookCallHandleStop(
bool ret_val = SWIGBridge::LLDBSwigPythonStopHookCallHandleStop(
implementor_sp->GetValue(), exc_ctx_ref_sp, stream_sp);
return ret_val;
}
@@ -1937,7 +1939,7 @@ StructuredData::DictionarySP ScriptInterpreterPythonImpl::GetDynamicSettings(
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
TargetSP target_sp(target->shared_from_this());
auto setting = (PyObject *)LLDBSWIGPython_GetDynamicSetting(
auto setting = (PyObject *)SWIGBridge::LLDBSWIGPython_GetDynamicSetting(
generic->GetValue(), setting_name, target_sp);
if (!setting)
@@ -1976,7 +1978,7 @@ ScriptInterpreterPythonImpl::CreateSyntheticScriptedProvider(
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
PythonObject ret_val = LLDBSwigPythonCreateSyntheticProvider(
PythonObject ret_val = SWIGBridge::LLDBSwigPythonCreateSyntheticProvider(
class_name, python_interpreter->m_dictionary_name.c_str(), valobj);
return StructuredData::ObjectSP(
@@ -1995,7 +1997,7 @@ ScriptInterpreterPythonImpl::CreateScriptCommandObject(const char *class_name) {
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
PythonObject ret_val = LLDBSwigPythonCreateCommandObject(
PythonObject ret_val = SWIGBridge::LLDBSwigPythonCreateCommandObject(
class_name, m_dictionary_name.c_str(), debugger_sp);
if (ret_val.IsValid())
@@ -2102,7 +2104,7 @@ bool ScriptInterpreterPythonImpl::GetScriptedSummary(
static Timer::Category func_cat("LLDBSwigPythonCallTypeScript");
Timer scoped_timer(func_cat, "LLDBSwigPythonCallTypeScript");
ret_val = LLDBSwigPythonCallTypeScript(
ret_val = SWIGBridge::LLDBSwigPythonCallTypeScript(
python_function_name, GetSessionDictionary().get(), valobj,
&new_callee, options_sp, retval);
}
@@ -2126,7 +2128,7 @@ bool ScriptInterpreterPythonImpl::FormatterCallbackFunction(
const char *python_function_name, TypeImplSP type_impl_sp) {
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
return LLDBSwigPythonFormatterCallbackFunction(
return SWIGBridge::LLDBSwigPythonFormatterCallbackFunction(
python_function_name, m_dictionary_name.c_str(), type_impl_sp);
}
@@ -2166,7 +2168,7 @@ bool ScriptInterpreterPythonImpl::BreakpointCallbackFunction(
Locker::InitSession |
Locker::NoSTDIN);
Expected<bool> maybe_ret_val =
LLDBSwigPythonBreakpointCallbackFunction(
SWIGBridge::LLDBSwigPythonBreakpointCallbackFunction(
python_function_name,
python_interpreter->m_dictionary_name.c_str(), stop_frame_sp,
bp_loc_sp, bp_option_data->m_extra_args);
@@ -2227,7 +2229,7 @@ bool ScriptInterpreterPythonImpl::WatchpointCallbackFunction(
Locker py_lock(python_interpreter, Locker::AcquireLock |
Locker::InitSession |
Locker::NoSTDIN);
ret_val = LLDBSwigPythonWatchpointCallbackFunction(
ret_val = SWIGBridge::LLDBSwigPythonWatchpointCallbackFunction(
python_function_name,
python_interpreter->m_dictionary_name.c_str(), stop_frame_sp,
wp_sp);
@@ -2257,7 +2259,7 @@ size_t ScriptInterpreterPythonImpl::CalculateNumChildren(
{
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
ret_val = LLDBSwigPython_CalculateNumChildren(implementor, max);
ret_val = SWIGBridge::LLDBSwigPython_CalculateNumChildren(implementor, max);
}
return ret_val;
@@ -2279,14 +2281,16 @@ lldb::ValueObjectSP ScriptInterpreterPythonImpl::GetChildAtIndex(
{
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
PyObject *child_ptr = LLDBSwigPython_GetChildAtIndex(implementor, idx);
PyObject *child_ptr =
SWIGBridge::LLDBSwigPython_GetChildAtIndex(implementor, idx);
if (child_ptr != nullptr && child_ptr != Py_None) {
lldb::SBValue *sb_value_ptr =
(lldb::SBValue *)LLDBSWIGPython_CastPyObjectToSBValue(child_ptr);
if (sb_value_ptr == nullptr)
Py_XDECREF(child_ptr);
else
ret_val = LLDBSWIGPython_GetValueObjectSPFromSBValue(sb_value_ptr);
ret_val = SWIGBridge::LLDBSWIGPython_GetValueObjectSPFromSBValue(
sb_value_ptr);
} else {
Py_XDECREF(child_ptr);
}
@@ -2312,7 +2316,7 @@ int ScriptInterpreterPythonImpl::GetIndexOfChildWithName(
{
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
ret_val = LLDBSwigPython_GetIndexOfChildWithName(implementor, child_name);
ret_val = SWIGBridge::LLDBSwigPython_GetIndexOfChildWithName(implementor, child_name);
}
return ret_val;
@@ -2335,7 +2339,8 @@ bool ScriptInterpreterPythonImpl::UpdateSynthProviderInstance(
{
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
ret_val = LLDBSwigPython_UpdateSynthProviderInstance(implementor);
ret_val =
SWIGBridge::LLDBSwigPython_UpdateSynthProviderInstance(implementor);
}
return ret_val;
@@ -2358,8 +2363,8 @@ bool ScriptInterpreterPythonImpl::MightHaveChildrenSynthProviderInstance(
{
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
ret_val =
LLDBSwigPython_MightHaveChildrenSynthProviderInstance(implementor);
ret_val = SWIGBridge::LLDBSwigPython_MightHaveChildrenSynthProviderInstance(
implementor);
}
return ret_val;
@@ -2383,14 +2388,15 @@ lldb::ValueObjectSP ScriptInterpreterPythonImpl::GetSyntheticValue(
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
PyObject *child_ptr =
LLDBSwigPython_GetValueSynthProviderInstance(implementor);
SWIGBridge::LLDBSwigPython_GetValueSynthProviderInstance(implementor);
if (child_ptr != nullptr && child_ptr != Py_None) {
lldb::SBValue *sb_value_ptr =
(lldb::SBValue *)LLDBSWIGPython_CastPyObjectToSBValue(child_ptr);
if (sb_value_ptr == nullptr)
Py_XDECREF(child_ptr);
else
ret_val = LLDBSWIGPython_GetValueObjectSPFromSBValue(sb_value_ptr);
ret_val = SWIGBridge::LLDBSWIGPython_GetValueObjectSPFromSBValue(
sb_value_ptr);
} else {
Py_XDECREF(child_ptr);
}
@@ -2461,7 +2467,7 @@ bool ScriptInterpreterPythonImpl::RunScriptFormatKeyword(
{
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
ret_val = LLDBSWIGPythonRunScriptKeywordProcess(
ret_val = SWIGBridge::LLDBSWIGPythonRunScriptKeywordProcess(
impl_function, m_dictionary_name.c_str(), process->shared_from_this(),
output);
if (!ret_val)
@@ -2484,9 +2490,10 @@ bool ScriptInterpreterPythonImpl::RunScriptFormatKeyword(
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
if (std::optional<std::string> result = LLDBSWIGPythonRunScriptKeywordThread(
impl_function, m_dictionary_name.c_str(),
thread->shared_from_this())) {
if (std::optional<std::string> result =
SWIGBridge::LLDBSWIGPythonRunScriptKeywordThread(
impl_function, m_dictionary_name.c_str(),
thread->shared_from_this())) {
output = std::move(*result);
return true;
}
@@ -2511,7 +2518,7 @@ bool ScriptInterpreterPythonImpl::RunScriptFormatKeyword(
TargetSP target_sp(target->shared_from_this());
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
ret_val = LLDBSWIGPythonRunScriptKeywordTarget(
ret_val = SWIGBridge::LLDBSWIGPythonRunScriptKeywordTarget(
impl_function, m_dictionary_name.c_str(), target_sp, output);
if (!ret_val)
error.SetErrorString("python script evaluation failed");
@@ -2533,9 +2540,10 @@ bool ScriptInterpreterPythonImpl::RunScriptFormatKeyword(
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
if (std::optional<std::string> result = LLDBSWIGPythonRunScriptKeywordFrame(
impl_function, m_dictionary_name.c_str(),
frame->shared_from_this())) {
if (std::optional<std::string> result =
SWIGBridge::LLDBSWIGPythonRunScriptKeywordFrame(
impl_function, m_dictionary_name.c_str(),
frame->shared_from_this())) {
output = std::move(*result);
return true;
}
@@ -2559,7 +2567,7 @@ bool ScriptInterpreterPythonImpl::RunScriptFormatKeyword(
{
Locker py_lock(this,
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
ret_val = LLDBSWIGPythonRunScriptKeywordValue(
ret_val = SWIGBridge::LLDBSWIGPythonRunScriptKeywordValue(
impl_function, m_dictionary_name.c_str(), value->GetSP(), output);
if (!ret_val)
error.SetErrorString("python script evaluation failed");
@@ -2739,9 +2747,9 @@ bool ScriptInterpreterPythonImpl::LoadScriptingModule(
// if we are here, everything worked
// call __lldb_init_module(debugger,dict)
if (!LLDBSwigPythonCallModuleInit(module_name.c_str(),
m_dictionary_name.c_str(),
m_debugger.shared_from_this())) {
if (!SWIGBridge::LLDBSwigPythonCallModuleInit(
module_name.c_str(), m_dictionary_name.c_str(),
m_debugger.shared_from_this())) {
error.SetErrorString("calling __lldb_init_module failed");
return false;
}
@@ -2835,7 +2843,7 @@ bool ScriptInterpreterPythonImpl::RunScriptBasedCommand(
SynchronicityHandler synch_handler(debugger_sp, synchronicity);
std::string args_str = args.str();
ret_val = LLDBSwigPythonCallCommand(
ret_val = SWIGBridge::LLDBSwigPythonCallCommand(
impl_function, m_dictionary_name.c_str(), debugger_sp, args_str.c_str(),
cmd_retobj, exe_ctx_ref_sp);
}
@@ -2880,7 +2888,7 @@ bool ScriptInterpreterPythonImpl::RunScriptBasedCommand(
SynchronicityHandler synch_handler(debugger_sp, synchronicity);
std::string args_str = args.str();
ret_val = LLDBSwigPythonCallCommandObject(
ret_val = SWIGBridge::LLDBSwigPythonCallCommandObject(
static_cast<PyObject *>(impl_obj_sp->GetValue()), debugger_sp,
args_str.c_str(), cmd_retobj, exe_ctx_ref_sp);
}

View File

@@ -44,7 +44,7 @@ StructuredData::GenericSP ScriptedPlatformPythonInterface::CreatePluginObject(
lldb::ExecutionContextRefSP exe_ctx_ref_sp =
std::make_shared<ExecutionContextRef>(exe_ctx);
PythonObject ret_val = LLDBSwigPythonCreateScriptedObject(
PythonObject ret_val = SWIGBridge::LLDBSwigPythonCreateScriptedObject(
class_name.str().c_str(), m_interpreter.GetDictionaryName(),
exe_ctx_ref_sp, args_impl, error_string);

View File

@@ -48,7 +48,7 @@ StructuredData::GenericSP ScriptedProcessPythonInterface::CreatePluginObject(
lldb::ExecutionContextRefSP exe_ctx_ref_sp =
std::make_shared<ExecutionContextRef>(exe_ctx);
PythonObject ret_val = LLDBSwigPythonCreateScriptedObject(
PythonObject ret_val = SWIGBridge::LLDBSwigPythonCreateScriptedObject(
class_name.str().c_str(), m_interpreter.GetDictionaryName(),
exe_ctx_ref_sp, args_impl, error_string);

View File

@@ -46,7 +46,7 @@ template <>
Status ScriptedPythonInterface::ExtractValueFromPythonObject<Status>(
python::PythonObject &p, Status &error) {
if (lldb::SBError *sb_error = reinterpret_cast<lldb::SBError *>(
LLDBSWIGPython_CastPyObjectToSBError(p.get())))
python::LLDBSWIGPython_CastPyObjectToSBError(p.get())))
return m_interpreter.GetStatusFromSBError(*sb_error);
else
error.SetErrorString("Couldn't cast lldb::SBError to lldb::Status.");
@@ -59,7 +59,7 @@ lldb::DataExtractorSP
ScriptedPythonInterface::ExtractValueFromPythonObject<lldb::DataExtractorSP>(
python::PythonObject &p, Status &error) {
lldb::SBData *sb_data = reinterpret_cast<lldb::SBData *>(
LLDBSWIGPython_CastPyObjectToSBData(p.get()));
python::LLDBSWIGPython_CastPyObjectToSBData(p.get()));
if (!sb_data) {
error.SetErrorString(
@@ -75,7 +75,7 @@ lldb::BreakpointSP
ScriptedPythonInterface::ExtractValueFromPythonObject<lldb::BreakpointSP>(
python::PythonObject &p, Status &error) {
lldb::SBBreakpoint *sb_breakpoint = reinterpret_cast<lldb::SBBreakpoint *>(
LLDBSWIGPython_CastPyObjectToSBBreakpoint(p.get()));
python::LLDBSWIGPython_CastPyObjectToSBBreakpoint(p.get()));
if (!sb_breakpoint) {
error.SetErrorString(
@@ -90,7 +90,7 @@ template <>
lldb::ProcessAttachInfoSP ScriptedPythonInterface::ExtractValueFromPythonObject<
lldb::ProcessAttachInfoSP>(python::PythonObject &p, Status &error) {
lldb::SBAttachInfo *sb_attach_info = reinterpret_cast<lldb::SBAttachInfo *>(
LLDBSWIGPython_CastPyObjectToSBAttachInfo(p.get()));
python::LLDBSWIGPython_CastPyObjectToSBAttachInfo(p.get()));
if (!sb_attach_info) {
error.SetErrorString(
@@ -105,7 +105,7 @@ template <>
lldb::ProcessLaunchInfoSP ScriptedPythonInterface::ExtractValueFromPythonObject<
lldb::ProcessLaunchInfoSP>(python::PythonObject &p, Status &error) {
lldb::SBLaunchInfo *sb_launch_info = reinterpret_cast<lldb::SBLaunchInfo *>(
LLDBSWIGPython_CastPyObjectToSBLaunchInfo(p.get()));
python::LLDBSWIGPython_CastPyObjectToSBLaunchInfo(p.get()));
if (!sb_launch_info) {
error.SetErrorString(
@@ -123,7 +123,7 @@ ScriptedPythonInterface::ExtractValueFromPythonObject<
lldb::SBMemoryRegionInfo *sb_mem_reg_info =
reinterpret_cast<lldb::SBMemoryRegionInfo *>(
LLDBSWIGPython_CastPyObjectToSBMemoryRegionInfo(p.get()));
python::LLDBSWIGPython_CastPyObjectToSBMemoryRegionInfo(p.get()));
if (!sb_mem_reg_info) {
error.SetErrorString(

View File

@@ -119,19 +119,19 @@ protected:
}
python::PythonObject Transform(Status arg) {
return python::ToSWIGWrapper(arg);
return python::SWIGBridge::ToSWIGWrapper(arg);
}
python::PythonObject Transform(lldb::ProcessAttachInfoSP arg) {
return python::ToSWIGWrapper(arg);
return python::SWIGBridge::ToSWIGWrapper(arg);
}
python::PythonObject Transform(lldb::ProcessLaunchInfoSP arg) {
return python::ToSWIGWrapper(arg);
return python::SWIGBridge::ToSWIGWrapper(arg);
}
python::PythonObject Transform(lldb::DataExtractorSP arg) {
return python::ToSWIGWrapper(arg);
return python::SWIGBridge::ToSWIGWrapper(arg);
}
template <typename T, typename U>

View File

@@ -46,7 +46,7 @@ StructuredData::GenericSP ScriptedThreadPythonInterface::CreatePluginObject(
if (!script_obj) {
lldb::ExecutionContextRefSP exe_ctx_ref_sp =
std::make_shared<ExecutionContextRef>(exe_ctx);
ret_val = LLDBSwigPythonCreateScriptedObject(
ret_val = SWIGBridge::LLDBSwigPythonCreateScriptedObject(
class_name.str().c_str(), m_interpreter.GetDictionaryName(),
exe_ctx_ref_sp, args_impl, error_string);
} else

View File

@@ -1,6 +1,5 @@
add_lldb_unittest(APITests
SBCommandInterpreterTest.cpp
SBStructuredDataTest.cpp
LINK_LIBS
liblldb

View File

@@ -22,11 +22,9 @@ protected:
void SetUp() override {
SBDebugger::Initialize();
m_dbg = SBDebugger::Create(/*source_init_files=*/false);
m_interp = m_dbg.GetCommandInterpreter();
}
SBDebugger m_dbg;
SBCommandInterpreter m_interp;
};
class DummyCommand : public SBCommandPluginInterface {
@@ -47,53 +45,55 @@ private:
TEST_F(SBCommandInterpreterTest, SingleWordCommand) {
// We first test a command without autorepeat
DummyCommand dummy("It worked");
m_interp.AddCommand("dummy", &dummy, /*help=*/nullptr);
SBCommandInterpreter interp = m_dbg.GetCommandInterpreter();
interp.AddCommand("dummy", &dummy, /*help=*/nullptr);
{
SBCommandReturnObject result;
m_interp.HandleCommand("dummy", result, /*add_to_history=*/true);
interp.HandleCommand("dummy", result, /*add_to_history=*/true);
EXPECT_TRUE(result.Succeeded());
EXPECT_STREQ(result.GetOutput(), "It worked\n");
}
{
SBCommandReturnObject result;
m_interp.HandleCommand("", result);
interp.HandleCommand("", result);
EXPECT_FALSE(result.Succeeded());
EXPECT_STREQ(result.GetError(), "error: No auto repeat.\n");
}
// Now we test a command with autorepeat
m_interp.AddCommand("dummy_with_autorepeat", &dummy, /*help=*/nullptr,
/*syntax=*/nullptr, /*auto_repeat_command=*/nullptr);
interp.AddCommand("dummy_with_autorepeat", &dummy, /*help=*/nullptr,
/*syntax=*/nullptr, /*auto_repeat_command=*/nullptr);
{
SBCommandReturnObject result;
m_interp.HandleCommand("dummy_with_autorepeat", result,
/*add_to_history=*/true);
interp.HandleCommand("dummy_with_autorepeat", result,
/*add_to_history=*/true);
EXPECT_TRUE(result.Succeeded());
EXPECT_STREQ(result.GetOutput(), "It worked\n");
}
{
SBCommandReturnObject result;
m_interp.HandleCommand("", result);
interp.HandleCommand("", result);
EXPECT_TRUE(result.Succeeded());
EXPECT_STREQ(result.GetOutput(), "It worked\n");
}
}
TEST_F(SBCommandInterpreterTest, MultiWordCommand) {
auto command = m_interp.AddMultiwordCommand("multicommand", /*help=*/nullptr);
SBCommandInterpreter interp = m_dbg.GetCommandInterpreter();
auto command = interp.AddMultiwordCommand("multicommand", /*help=*/nullptr);
// We first test a subcommand without autorepeat
DummyCommand subcommand("It worked again");
command.AddCommand("subcommand", &subcommand, /*help=*/nullptr);
{
SBCommandReturnObject result;
m_interp.HandleCommand("multicommand subcommand", result,
/*add_to_history=*/true);
interp.HandleCommand("multicommand subcommand", result,
/*add_to_history=*/true);
EXPECT_TRUE(result.Succeeded());
EXPECT_STREQ(result.GetOutput(), "It worked again\n");
}
{
SBCommandReturnObject result;
m_interp.HandleCommand("", result);
interp.HandleCommand("", result);
EXPECT_FALSE(result.Succeeded());
EXPECT_STREQ(result.GetError(), "error: No auto repeat.\n");
}
@@ -104,14 +104,14 @@ TEST_F(SBCommandInterpreterTest, MultiWordCommand) {
/*auto_repeat_command=*/nullptr);
{
SBCommandReturnObject result;
m_interp.HandleCommand("multicommand subcommand_with_autorepeat", result,
/*add_to_history=*/true);
interp.HandleCommand("multicommand subcommand_with_autorepeat", result,
/*add_to_history=*/true);
EXPECT_TRUE(result.Succeeded());
EXPECT_STREQ(result.GetOutput(), "It worked again\n");
}
{
SBCommandReturnObject result;
m_interp.HandleCommand("", result);
interp.HandleCommand("", result);
EXPECT_TRUE(result.Succeeded());
EXPECT_STREQ(result.GetOutput(), "It worked again\n");
}
@@ -124,14 +124,14 @@ TEST_F(SBCommandInterpreterTest, MultiWordCommand) {
/*auto_repeat_command=*/"multicommand subcommand_with_autorepeat");
{
SBCommandReturnObject result;
m_interp.HandleCommand("multicommand subcommand_with_custom_autorepeat",
result, /*add_to_history=*/true);
interp.HandleCommand("multicommand subcommand_with_custom_autorepeat",
result, /*add_to_history=*/true);
EXPECT_TRUE(result.Succeeded());
EXPECT_STREQ(result.GetOutput(), "It worked again 2\n");
}
{
SBCommandReturnObject result;
m_interp.HandleCommand("", result);
interp.HandleCommand("", result);
EXPECT_TRUE(result.Succeeded());
EXPECT_STREQ(result.GetOutput(), "It worked again\n");
}

View File

@@ -1,35 +0,0 @@
//===-- SBStructuredDataTest.cpp ------------------------===----------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===/
#include "gtest/gtest.h"
#include "lldb/API/SBStringList.h"
#include "lldb/API/SBStructuredData.h"
#include <cstring>
#include <string>
using namespace lldb;
class SBStructuredDataTest : public testing::Test {};
TEST_F(SBStructuredDataTest, NullImpl) {
SBStructuredData data(nullptr);
EXPECT_EQ(data.GetType(), eStructuredDataTypeInvalid);
EXPECT_EQ(data.GetSize(), 0ul);
SBStringList keys;
EXPECT_FALSE(data.GetKeys(keys));
EXPECT_EQ(data.GetValueForKey("key").GetType(), eStructuredDataTypeInvalid);
EXPECT_EQ(data.GetItemAtIndex(0).GetType(), eStructuredDataTypeInvalid);
EXPECT_EQ(data.GetIntegerValue(UINT64_MAX), UINT64_MAX);
EXPECT_EQ(data.GetFloatValue(DBL_MAX), DBL_MAX);
EXPECT_TRUE(data.GetBooleanValue(true));
EXPECT_FALSE(data.GetBooleanValue(false));
char dst[1];
EXPECT_EQ(data.GetStringValue(dst, sizeof(dst)), 0ul);
}

View File

@@ -54,7 +54,8 @@ void PythonTestSuite::TearDown() {
extern "C" PyObject *PyInit__lldb(void) { return nullptr; }
llvm::Expected<bool> lldb_private::LLDBSwigPythonBreakpointCallbackFunction(
llvm::Expected<bool>
lldb_private::python::SWIGBridge::LLDBSwigPythonBreakpointCallbackFunction(
const char *python_function_name, const char *session_dictionary_name,
const lldb::StackFrameSP &sb_frame,
const lldb::BreakpointLocationSP &sb_bp_loc,
@@ -62,137 +63,147 @@ llvm::Expected<bool> lldb_private::LLDBSwigPythonBreakpointCallbackFunction(
return false;
}
bool lldb_private::LLDBSwigPythonWatchpointCallbackFunction(
bool lldb_private::python::SWIGBridge::LLDBSwigPythonWatchpointCallbackFunction(
const char *python_function_name, const char *session_dictionary_name,
const lldb::StackFrameSP &sb_frame, const lldb::WatchpointSP &sb_wp) {
return false;
}
bool lldb_private::LLDBSwigPythonFormatterCallbackFunction(
bool lldb_private::python::SWIGBridge::LLDBSwigPythonFormatterCallbackFunction(
const char *python_function_name, const char *session_dictionary_name,
lldb::TypeImplSP type_impl_sp) {
return false;
}
bool lldb_private::LLDBSwigPythonCallTypeScript(
bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallTypeScript(
const char *python_function_name, const void *session_dictionary,
const lldb::ValueObjectSP &valobj_sp, void **pyfunct_wrapper,
const lldb::TypeSummaryOptionsSP &options_sp, std::string &retval) {
return false;
}
python::PythonObject lldb_private::LLDBSwigPythonCreateSyntheticProvider(
python::PythonObject
lldb_private::python::SWIGBridge::LLDBSwigPythonCreateSyntheticProvider(
const char *python_class_name, const char *session_dictionary_name,
const lldb::ValueObjectSP &valobj_sp) {
return python::PythonObject();
}
python::PythonObject lldb_private::LLDBSwigPythonCreateCommandObject(
python::PythonObject
lldb_private::python::SWIGBridge::LLDBSwigPythonCreateCommandObject(
const char *python_class_name, const char *session_dictionary_name,
lldb::DebuggerSP debugger_sp) {
return python::PythonObject();
}
python::PythonObject lldb_private::LLDBSwigPythonCreateScriptedThreadPlan(
python::PythonObject
lldb_private::python::SWIGBridge::LLDBSwigPythonCreateScriptedThreadPlan(
const char *python_class_name, const char *session_dictionary_name,
const StructuredDataImpl &args_data, std::string &error_string,
const lldb::ThreadPlanSP &thread_plan_sp) {
return python::PythonObject();
}
bool lldb_private::LLDBSWIGPythonCallThreadPlan(void *implementor,
const char *method_name,
Event *event_sp,
bool &got_error) {
bool lldb_private::python::SWIGBridge::LLDBSWIGPythonCallThreadPlan(
void *implementor, const char *method_name, Event *event_sp,
bool &got_error) {
return false;
}
bool
lldb_private::LLDBSWIGPythonCallThreadPlan(void *implementor,
const char *method_name,
Stream *event_sp,
bool &got_error) {
bool lldb_private::python::SWIGBridge::LLDBSWIGPythonCallThreadPlan(
void *implementor, const char *method_name, Stream *event_sp,
bool &got_error) {
return false;
}
python::PythonObject
lldb_private::LLDBSwigPythonCreateScriptedBreakpointResolver(
const char *python_class_name, const char *session_dictionary_name,
const StructuredDataImpl &args, const lldb::BreakpointSP &bkpt_sp) {
python::PythonObject lldb_private::python::SWIGBridge::
LLDBSwigPythonCreateScriptedBreakpointResolver(
const char *python_class_name, const char *session_dictionary_name,
const StructuredDataImpl &args, const lldb::BreakpointSP &bkpt_sp) {
return python::PythonObject();
}
unsigned int lldb_private::LLDBSwigPythonCallBreakpointResolver(
unsigned int
lldb_private::python::SWIGBridge::LLDBSwigPythonCallBreakpointResolver(
void *implementor, const char *method_name,
lldb_private::SymbolContext *sym_ctx) {
return 0;
}
size_t lldb_private::LLDBSwigPython_CalculateNumChildren(PyObject *implementor,
uint32_t max) {
size_t lldb_private::python::SWIGBridge::LLDBSwigPython_CalculateNumChildren(
PyObject *implementor, uint32_t max) {
return 0;
}
PyObject *lldb_private::LLDBSwigPython_GetChildAtIndex(PyObject *implementor,
uint32_t idx) {
PyObject *lldb_private::python::SWIGBridge::LLDBSwigPython_GetChildAtIndex(
PyObject *implementor, uint32_t idx) {
return nullptr;
}
int lldb_private::LLDBSwigPython_GetIndexOfChildWithName(
int lldb_private::python::SWIGBridge::LLDBSwigPython_GetIndexOfChildWithName(
PyObject *implementor, const char *child_name) {
return 0;
}
void *lldb_private::LLDBSWIGPython_CastPyObjectToSBData(PyObject *data) {
void *
lldb_private::python::LLDBSWIGPython_CastPyObjectToSBData(PyObject *data) {
return nullptr;
}
void *lldb_private::LLDBSWIGPython_CastPyObjectToSBBreakpoint(PyObject *data) {
void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBBreakpoint(
PyObject *data) {
return nullptr;
}
void *lldb_private::LLDBSWIGPython_CastPyObjectToSBAttachInfo(PyObject *data) {
void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBAttachInfo(
PyObject *data) {
return nullptr;
}
void *lldb_private::LLDBSWIGPython_CastPyObjectToSBLaunchInfo(PyObject *data) {
return nullptr;
}
void *lldb_private::LLDBSWIGPython_CastPyObjectToSBError(PyObject *data) {
return nullptr;
}
void *lldb_private::LLDBSWIGPython_CastPyObjectToSBValue(PyObject *data) {
void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBLaunchInfo(
PyObject *data) {
return nullptr;
}
void *
lldb_private::LLDBSWIGPython_CastPyObjectToSBMemoryRegionInfo(PyObject *data) {
lldb_private::python::LLDBSWIGPython_CastPyObjectToSBError(PyObject *data) {
return nullptr;
}
void *
lldb_private::python::LLDBSWIGPython_CastPyObjectToSBValue(PyObject *data) {
return nullptr;
}
void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBMemoryRegionInfo(
PyObject *data) {
return nullptr;
}
lldb::ValueObjectSP
lldb_private::LLDBSWIGPython_GetValueObjectSPFromSBValue(void *data) {
lldb_private::python::SWIGBridge::LLDBSWIGPython_GetValueObjectSPFromSBValue(
void *data) {
return nullptr;
}
bool lldb_private::LLDBSwigPython_UpdateSynthProviderInstance(
PyObject *implementor) {
bool lldb_private::python::SWIGBridge::
LLDBSwigPython_UpdateSynthProviderInstance(PyObject *implementor) {
return false;
}
bool lldb_private::LLDBSwigPython_MightHaveChildrenSynthProviderInstance(
PyObject *implementor) {
bool lldb_private::python::SWIGBridge::
LLDBSwigPython_MightHaveChildrenSynthProviderInstance(
PyObject *implementor) {
return false;
}
PyObject *lldb_private::LLDBSwigPython_GetValueSynthProviderInstance(
PyObject *
lldb_private::python::SWIGBridge::LLDBSwigPython_GetValueSynthProviderInstance(
PyObject *implementor) {
return nullptr;
}
bool lldb_private::LLDBSwigPythonCallCommand(
bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallCommand(
const char *python_function_name, const char *session_dictionary_name,
lldb::DebuggerSP debugger, const char *args,
lldb_private::CommandReturnObject &cmd_retobj,
@@ -200,106 +211,113 @@ bool lldb_private::LLDBSwigPythonCallCommand(
return false;
}
bool lldb_private::LLDBSwigPythonCallCommandObject(
bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallCommandObject(
PyObject *implementor, lldb::DebuggerSP debugger, const char *args,
lldb_private::CommandReturnObject &cmd_retobj,
lldb::ExecutionContextRefSP exe_ctx_ref_sp) {
return false;
}
bool lldb_private::LLDBSwigPythonCallModuleInit(
bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallModuleInit(
const char *python_module_name, const char *session_dictionary_name,
lldb::DebuggerSP debugger) {
return false;
}
python::PythonObject
lldb_private::LLDBSWIGPythonCreateOSPlugin(const char *python_class_name,
const char *session_dictionary_name,
const lldb::ProcessSP &process_sp) {
lldb_private::python::SWIGBridge::LLDBSWIGPythonCreateOSPlugin(
const char *python_class_name, const char *session_dictionary_name,
const lldb::ProcessSP &process_sp) {
return python::PythonObject();
}
python::PythonObject lldb_private::LLDBSwigPythonCreateScriptedObject(
python::PythonObject
lldb_private::python::SWIGBridge::LLDBSwigPythonCreateScriptedObject(
const char *python_class_name, const char *session_dictionary_name,
lldb::ExecutionContextRefSP exe_ctx_sp, const StructuredDataImpl &args_impl,
std::string &error_string) {
return python::PythonObject();
}
python::PythonObject lldb_private::LLDBSWIGPython_CreateFrameRecognizer(
python::PythonObject
lldb_private::python::SWIGBridge::LLDBSWIGPython_CreateFrameRecognizer(
const char *python_class_name, const char *session_dictionary_name) {
return python::PythonObject();
}
PyObject *lldb_private::LLDBSwigPython_GetRecognizedArguments(
PyObject *
lldb_private::python::SWIGBridge::LLDBSwigPython_GetRecognizedArguments(
PyObject *implementor, const lldb::StackFrameSP &frame_sp) {
return nullptr;
}
bool lldb_private::LLDBSWIGPythonRunScriptKeywordProcess(
bool lldb_private::python::SWIGBridge::LLDBSWIGPythonRunScriptKeywordProcess(
const char *python_function_name, const char *session_dictionary_name,
const lldb::ProcessSP &process, std::string &output) {
return false;
}
std::optional<std::string> lldb_private::LLDBSWIGPythonRunScriptKeywordThread(
std::optional<std::string>
lldb_private::python::SWIGBridge::LLDBSWIGPythonRunScriptKeywordThread(
const char *python_function_name, const char *session_dictionary_name,
lldb::ThreadSP thread) {
return std::nullopt;
}
bool lldb_private::LLDBSWIGPythonRunScriptKeywordTarget(
bool lldb_private::python::SWIGBridge::LLDBSWIGPythonRunScriptKeywordTarget(
const char *python_function_name, const char *session_dictionary_name,
const lldb::TargetSP &target, std::string &output) {
return false;
}
std::optional<std::string> lldb_private::LLDBSWIGPythonRunScriptKeywordFrame(
std::optional<std::string>
lldb_private::python::SWIGBridge::LLDBSWIGPythonRunScriptKeywordFrame(
const char *python_function_name, const char *session_dictionary_name,
lldb::StackFrameSP frame) {
return std::nullopt;
}
bool lldb_private::LLDBSWIGPythonRunScriptKeywordValue(
bool lldb_private::python::SWIGBridge::LLDBSWIGPythonRunScriptKeywordValue(
const char *python_function_name, const char *session_dictionary_name,
const lldb::ValueObjectSP &value, std::string &output) {
return false;
}
void *lldb_private::LLDBSWIGPython_GetDynamicSetting(
void *lldb_private::python::SWIGBridge::LLDBSWIGPython_GetDynamicSetting(
void *module, const char *setting, const lldb::TargetSP &target_sp) {
return nullptr;
}
python::PythonObject lldb_private::LLDBSwigPythonCreateScriptedStopHook(
python::PythonObject
lldb_private::python::SWIGBridge::LLDBSwigPythonCreateScriptedStopHook(
lldb::TargetSP target_sp, const char *python_class_name,
const char *session_dictionary_name, const StructuredDataImpl &args_impl,
Status &error) {
return python::PythonObject();
}
bool lldb_private::LLDBSwigPythonStopHookCallHandleStop(
bool lldb_private::python::SWIGBridge::LLDBSwigPythonStopHookCallHandleStop(
void *implementor, lldb::ExecutionContextRefSP exc_ctx_sp,
lldb::StreamSP stream) {
return false;
}
python::PythonObject lldb_private::python::ToSWIGWrapper(const Status &status) {
python::PythonObject
lldb_private::python::SWIGBridge::ToSWIGWrapper(const Status &status) {
return python::PythonObject();
}
python::PythonObject
lldb_private::python::ToSWIGWrapper(lldb::ProcessAttachInfoSP) {
lldb_private::python::SWIGBridge::ToSWIGWrapper(lldb::ProcessAttachInfoSP) {
return python::PythonObject();
}
python::PythonObject
lldb_private::python::ToSWIGWrapper(lldb::ProcessLaunchInfoSP) {
lldb_private::python::SWIGBridge::ToSWIGWrapper(lldb::ProcessLaunchInfoSP) {
return python::PythonObject();
}
python::PythonObject
lldb_private::python::ToSWIGWrapper(lldb::DataExtractorSP) {
lldb_private::python::SWIGBridge::ToSWIGWrapper(lldb::DataExtractorSP) {
return python::PythonObject();
}