diff options
Diffstat (limited to 'lldb/bindings')
-rw-r--r-- | lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i | 15 | ||||
-rw-r--r-- | lldb/bindings/interface/SBThreadExtensions.i | 4 | ||||
-rw-r--r-- | lldb/bindings/python/python-extensions.swig | 1 | ||||
-rw-r--r-- | lldb/bindings/python/python-wrapper.swig | 84 |
4 files changed, 31 insertions, 73 deletions
diff --git a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i index d7c68baf..99fe91b 100644 --- a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i +++ b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i @@ -1,5 +1,10 @@ %feature("docstring", -"API clients can get information about memory regions in processes." +"API clients can get information about memory regions in processes. + +For Python users, `len()` is overriden to output the size of the memory region in bytes. +For Python users, `str()` is overriden with the results of the GetDescription function- + produces a formatted string that describes a memory range in the form: + [Hex start - Hex End) with associated permissions (RWX)" ) lldb::SBMemoryRegionInfo; %feature("docstring", " @@ -29,3 +34,11 @@ Return the size of pages in this memory region. 0 will be returned if this information was unavailable." ) lldb::SBMemoryRegionInfo::GetPageSize(); + +%feature("docstring", " + Takes an SBStream parameter to write output to, + formatted [Hex start - Hex End) with associated permissions (RWX). + If the function results false, no output will be written. + If results true, the output will be written to the stream. + " +) lldb::SBMemoryRegionInfo::GetDescription;
\ No newline at end of file diff --git a/lldb/bindings/interface/SBThreadExtensions.i b/lldb/bindings/interface/SBThreadExtensions.i index 267faad..4ec9f10 100644 --- a/lldb/bindings/interface/SBThreadExtensions.i +++ b/lldb/bindings/interface/SBThreadExtensions.i @@ -45,6 +45,9 @@ STRING_EXTENSION_OUTSIDE(SBThread) frames.append(frame) return frames + def get_stop_description(self): + return self.GetStopDescription(1024) + def get_stop_reason_data(self): return [ self.GetStopReasonDataAtIndex(idx) @@ -69,6 +72,7 @@ STRING_EXTENSION_OUTSIDE(SBThread) name = property(GetName, None, doc='''A read only property that returns the name of this thread as a string.''') queue = property(GetQueueName, None, doc='''A read only property that returns the dispatch queue name of this thread as a string.''') queue_id = property(GetQueueID, None, doc='''A read only property that returns the dispatch queue id of this thread as an integer.''') + stop_description = property(get_stop_description, None, doc='''A read only property that returns a string describing the reason this thread stopped.''') stop_reason = property(GetStopReason, None, doc='''A read only property that returns an lldb enumeration value (see enumerations that start with "lldb.eStopReason") that represents the reason this thread stopped.''') stop_reason_data = property(get_stop_reason_data, None, doc='''A read only property that returns the stop reason data as a list.''') is_suspended = property(IsSuspended, None, doc='''A read only property that returns a boolean value that indicates if this thread is suspended.''') diff --git a/lldb/bindings/python/python-extensions.swig b/lldb/bindings/python/python-extensions.swig index 4ba1607..40fa768 100644 --- a/lldb/bindings/python/python-extensions.swig +++ b/lldb/bindings/python/python-extensions.swig @@ -594,6 +594,7 @@ def is_numeric_type(basic_type): if basic_type == eBasicTypeFloat: return (True,True) if basic_type == eBasicTypeDouble: return (True,True) if basic_type == eBasicTypeLongDouble: return (True,True) + if basic_type == eBasicTypeFloat128: return (True,True) if basic_type == eBasicTypeFloatComplex: return (True,True) if basic_type == eBasicTypeDoubleComplex: return (True,True) if basic_type == eBasicTypeLongDoubleComplex: return (True,True) diff --git a/lldb/bindings/python/python-wrapper.swig b/lldb/bindings/python/python-wrapper.swig index 3d1d04e..2c30d53 100644 --- a/lldb/bindings/python/python-wrapper.swig +++ b/lldb/bindings/python/python-wrapper.swig @@ -229,78 +229,6 @@ PythonObject lldb_private::python::SWIGBridge::LLDBSwigPythonCreateCommandObject return pfunc(SWIGBridge::ToSWIGWrapper(std::move(debugger_sp)), dict); } -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) { - - if (python_class_name == NULL || python_class_name[0] == '\0' || - !session_dictionary_name) - return PythonObject(); - - PyErr_Cleaner py_err_cleaner(true); - - auto dict = PythonModule::MainModule().ResolveName<PythonDictionary>( - session_dictionary_name); - auto pfunc = PythonObject::ResolveNameWithDictionary<PythonCallable>( - python_class_name, dict); - - if (!pfunc.IsAllocated()) - return PythonObject(); - - PythonObject result = - 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. - - if (result.IsAllocated()) { - // Check that __callback__ is defined: - auto callback_func = result.ResolveName<PythonCallable>("__callback__"); - if (callback_func.IsAllocated()) - return result; - } - return PythonObject(); -} - -unsigned int lldb_private::python::SWIGBridge::LLDBSwigPythonCallBreakpointResolver( - void *implementor, const char *method_name, - lldb_private::SymbolContext *sym_ctx) { - PyErr_Cleaner py_err_cleaner(false); - PythonObject self(PyRefType::Borrowed, static_cast<PyObject *>(implementor)); - auto pfunc = self.ResolveName<PythonCallable>(method_name); - - if (!pfunc.IsAllocated()) - return 0; - - PythonObject result = sym_ctx ? pfunc(SWIGBridge::ToSWIGWrapper(*sym_ctx)) : pfunc(); - - if (PyErr_Occurred()) { - PyErr_Print(); - PyErr_Clear(); - return 0; - } - - // The callback will return a bool, but we're need to also return ints - // so we're squirrelling the bool through as an int... And if you return - // nothing, we'll continue. - if (strcmp(method_name, "__callback__") == 0) { - if (result.get() == Py_False) - return 0; - else - return 1; - } - - long long ret_val = unwrapOrSetPythonException(As<long long>(result)); - - if (PyErr_Occurred()) { - PyErr_Print(); - PyErr_Clear(); - return 0; - } - - return ret_val; -} - // wrapper that calls an optional instance member of an object taking no // arguments static PyObject *LLDBSwigPython_CallOptionalMember( @@ -554,6 +482,18 @@ void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBStream(PyObject * dat return sb_ptr; } +void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBSymbolContext(PyObject * data) { + lldb::SBSymbolContext *sb_ptr = nullptr; + + int valid_cast = + SWIG_ConvertPtr(data, (void **)&sb_ptr, SWIGTYPE_p_lldb__SBSymbolContext, 0); + + if (valid_cast == -1) + return NULL; + + return sb_ptr; +} + void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBValue(PyObject * data) { lldb::SBValue *sb_ptr = NULL; |