[all-commits] [llvm/llvm-project] 57bd88: [lldb] Convert script native types to StructuredDa...

Med Ismail Bennani via All-commits all-commits at lists.llvm.org
Fri Jul 21 18:48:14 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 57bd882343f8e4cca598b6ad47da93476cffb987
      https://github.com/llvm/llvm-project/commit/57bd882343f8e4cca598b6ad47da93476cffb987
  Author: Med Ismail Bennani <ismail at bennani.ma>
  Date:   2023-07-21 (Fri, 21 Jul 2023)

  Changed paths:
    M lldb/bindings/headers.swig
    A lldb/bindings/interface/SBScriptObjectExtensions.i
    M lldb/bindings/interfaces.swig
    M lldb/bindings/python/python-typemaps.swig
    M lldb/include/lldb/API/SBDebugger.h
    M lldb/include/lldb/API/SBDefines.h
    M lldb/include/lldb/API/SBProcess.h
    A lldb/include/lldb/API/SBScriptObject.h
    M lldb/include/lldb/API/SBStructuredData.h
    M lldb/include/lldb/Core/StructuredDataImpl.h
    M lldb/include/lldb/Interpreter/ScriptInterpreter.h
    A lldb/include/lldb/Interpreter/ScriptObject.h
    M lldb/include/lldb/lldb-types.h
    M lldb/source/API/CMakeLists.txt
    M lldb/source/API/SBProcess.cpp
    A lldb/source/API/SBScriptObject.cpp
    M lldb/source/API/SBStructuredData.cpp
    M lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
    M lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
    M lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
    M lldb/test/API/python_api/sbstructureddata/TestStructuredDataAPI.py

  Log Message:
  -----------
  [lldb] Convert script native types to StructuredData counterpart

This patch adds the ability to pass native types from the script
interpreter to methods that use a {SB,}StructuredData argument.

To do so, this patch changes the `ScriptedObject` struture that holds
the pointer to the script object as well as the originating script
interpreter language. It also exposes that to the SB API via a new class
called `SBScriptObject`.

This structure allows the debugger to parse the script object and
convert it to a StructuredData object. If the type is not compatible
with the StructuredData types, we will store its pointer in a
`StructuredData::Generic` object.

This patch also adds some SWIG typemaps that checks the input argument to
ensure it's either an SBStructuredData object, in which case it just
passes it throught, or a python object that is NOT another SB type, to
provide some guardrails for the user.

rdar://111467140

Differential Revision: https://reviews.llvm.org/D155161

Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>




More information about the All-commits mailing list