[all-commits] [llvm/llvm-project] d76566: [lldb] Add matching based on Python callbacks for ...
Jorge Gorbe Moya via All-commits
all-commits at lists.llvm.org
Wed Oct 19 12:54:33 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d76566417e592cfac9c710f82575473b1b4a9285
https://github.com/llvm/llvm-project/commit/d76566417e592cfac9c710f82575473b1b4a9285
Author: Jorge Gorbe Moya <jgorbe at google.com>
Date: 2022-10-19 (Wed, 19 Oct 2022)
Changed paths:
M lldb/bindings/python/python-swigsafecast.swig
M lldb/bindings/python/python-wrapper.swig
M lldb/include/lldb/API/SBType.h
M lldb/include/lldb/DataFormatters/DataVisualization.h
M lldb/include/lldb/DataFormatters/FormatClasses.h
M lldb/include/lldb/DataFormatters/FormatManager.h
M lldb/include/lldb/DataFormatters/FormattersContainer.h
M lldb/include/lldb/DataFormatters/TypeCategory.h
M lldb/include/lldb/DataFormatters/TypeCategoryMap.h
M lldb/include/lldb/Interpreter/ScriptInterpreter.h
M lldb/include/lldb/Target/Language.h
M lldb/include/lldb/lldb-enumerations.h
M lldb/source/API/SBTypeNameSpecifier.cpp
M lldb/source/Commands/CommandObjectType.cpp
M lldb/source/DataFormatters/DataVisualization.cpp
M lldb/source/DataFormatters/FormatManager.cpp
M lldb/source/DataFormatters/TypeCategory.cpp
M lldb/source/DataFormatters/TypeCategoryMap.cpp
M lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
M lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
M lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
M lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
M lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
M lldb/source/Target/Language.cpp
A lldb/test/API/functionalities/data-formatter/callback-matching/Makefile
A lldb/test/API/functionalities/data-formatter/callback-matching/TestDataFormatterCallbackMatching.py
A lldb/test/API/functionalities/data-formatter/callback-matching/formatters_with_callback.py
A lldb/test/API/functionalities/data-formatter/callback-matching/main.cpp
M lldb/unittests/DataFormatter/FormattersContainerTest.cpp
M lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
Log Message:
-----------
[lldb] Add matching based on Python callbacks for data formatters.
This patch adds a new matching method for data formatters, in addition
to the existing exact typename and regex-based matching. The new method
allows users to specify the name of a Python callback function that
takes a `SBType` object and decides whether the type is a match or not.
Here is an overview of the changes performed:
- Add a new `eFormatterMatchCallback` matching type, and logic to handle
it in `TypeMatcher` and `SBTypeNameSpecifier`.
- Extend `FormattersMatchCandidate` instances with a pointer to the
current `ScriptInterpreter` and the `TypeImpl` corresponding to the
candidate type, so we can run registered callbacks and pass the type
to them. All matcher search functions now receive a
`FormattersMatchCandidate` instead of a type name.
- Add some glue code to ScriptInterpreterPython and the SWIG bindings to
allow calling a formatter matching callback. Most of this code is
modeled after the equivalent code for watchpoint callback functions.
- Add an API test for the new callback-based matching feature.
For more context, please check the RFC thread where this feature was
originally discussed:
https://discourse.llvm.org/t/rfc-python-callback-for-data-formatters-type-matching/64204/11
Differential Revision: https://reviews.llvm.org/D135648
More information about the All-commits
mailing list