[all-commits] [llvm/llvm-project] 288843: [lldb/Python] Make use of PythonObject and PythonF...

Med Ismail Bennani via All-commits all-commits at lists.llvm.org
Fri Nov 18 13:58:30 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 288843a161f71148d7028e5153038006dd87e363
      https://github.com/llvm/llvm-project/commit/288843a161f71148d7028e5153038006dd87e363
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2022-11-18 (Fri, 18 Nov 2022)

  Changed paths:
    M lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
    M lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

  Log Message:
  -----------
  [lldb/Python] Make use of PythonObject and PythonFormat in callbacks (NFC)

This patch extends the template specialization of PythonFormat structs
and makes use of the pre-existing PythonObject class to format arguments
and pass them to the right method, before calling it.

This is a preparatory patch to merge PythonFormat with SWIGPythonBridge's
GetPythonValueFormatString methods.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>


  Commit: 7e01924e4e5634a6fa7d500574aeca58c8f36873
      https://github.com/llvm/llvm-project/commit/7e01924e4e5634a6fa7d500574aeca58c8f36873
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2022-11-18 (Fri, 18 Nov 2022)

  Changed paths:
    M lldb/bindings/python/python-swigsafecast.swig
    M lldb/examples/python/scripted_process/crashlog_scripted_process.py
    M lldb/examples/python/scripted_process/scripted_process.py
    M lldb/include/lldb/API/SBError.h
    M lldb/source/API/SBError.cpp
    M lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
    M lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
    M lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
    M lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
    M lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
    M lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
    M lldb/test/API/functionalities/scripted_process/invalid_scripted_process.py
    M lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py
    M lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp

  Log Message:
  -----------
  [lldb/Plugins] Improve error reporting with reading memory in Scripted Process

This patch improves the ScriptedPythonInterface::Dispatch method to
support passing lldb_private types to the python implementation.

This will allow, for instance, the Scripted Process python implementation
to report errors when reading memory back to lldb.

To do so, the Dispatch method will transform the private types in the
parameter pack into `PythonObject`s to be able to pass them down to the
python methods.

Then, if the call succeeded, the transformed arguments will be converted
back to their original type and re-assigned in the parameter pack, to
ensure pointers and references behaviours are preserved.

This patch also updates various scripted process python class and tests
to reflect this change.

rdar://100030995

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

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>


  Commit: 27a26e7ab7d8a8b47c63f68bd1801fc2f9342637
      https://github.com/llvm/llvm-project/commit/27a26e7ab7d8a8b47c63f68bd1801fc2f9342637
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2022-11-18 (Fri, 18 Nov 2022)

  Changed paths:
    M lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
    R lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.cpp
    M lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h

  Log Message:
  -----------
  [lldb/Python] Unify PythonFormat & GetPythonValueFormatString (NFC)

This patch removes all occurences to GetPythonValueFormatString and
use the template specialization of PythonFormat structs instead.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>


Compare: https://github.com/llvm/llvm-project/compare/7c96f61aaa4c...27a26e7ab7d8


More information about the All-commits mailing list