From 0a21144614950ce063d8dac6394307bd3be604cd Mon Sep 17 00:00:00 2001 From: Med Ismail Bennani Date: Tue, 7 Nov 2023 22:01:21 -0800 Subject: [lldb] Check for abstract methods implementation in Scripted Plugin Objects (#71260) This patch enforces that every scripted object implements all the necessary abstract methods. Every scripted affordance language interface can implement a list of abstract methods name that checked when the object is instanciated. Since some scripting affordances implementations can be derived from template base classes, we can't check the object dictionary since it will contain the definition of the base class, so instead, this checks the scripting class dictionary. Previously, for the various python interfaces, we used `ABC.abstractmethod` decorators but this is too language specific and doesn't work for scripting affordances that are not derived from template base classes (i.e OperatingSystem, ScriptedThreadPlan, ...), so this patch provides generic/language-agnostic checks for every scripted affordance. Signed-off-by: Med Ismail Bennani --- .../missing_methods_scripted_process.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lldb/test/API/functionalities/scripted_process/missing_methods_scripted_process.py (limited to 'lldb/test/API/functionalities/scripted_process/missing_methods_scripted_process.py') diff --git a/lldb/test/API/functionalities/scripted_process/missing_methods_scripted_process.py b/lldb/test/API/functionalities/scripted_process/missing_methods_scripted_process.py new file mode 100644 index 000000000000..a1db0640033e --- /dev/null +++ b/lldb/test/API/functionalities/scripted_process/missing_methods_scripted_process.py @@ -0,0 +1,19 @@ +import os + + +class MissingMethodsScriptedProcess: + def __init__(self, exe_ctx, args): + pass + + +def __lldb_init_module(debugger, dict): + if not "SKIP_SCRIPTED_PROCESS_LAUNCH" in os.environ: + debugger.HandleCommand( + "process launch -C %s.%s" + % (__name__, MissingMethodsScriptedProcess.__name__) + ) + else: + print( + "Name of the class that will manage the scripted process: '%s.%s'" + % (__name__, MissingMethodsScriptedProcess.__name__) + ) -- cgit v1.2.3