1 2 3import lldb 4 5# bunch of different kinds of python callables that should 6# all work as commands. 7 8def check(debugger, command, context, result, internal_dict): 9 if (not isinstance(debugger, lldb.SBDebugger) or 10 not isinstance(command, str) or 11 not isinstance(result, lldb.SBCommandReturnObject) or 12 not isinstance(internal_dict, dict) or 13 (not context is None and 14 not isinstance(context, lldb.SBExecutionContext))): 15 raise Exception() 16 result.AppendMessage("All good.") 17 18def vfoobar(*args): 19 check(*args) 20 21def v5foobar(debugger, command, context, result, internal_dict, *args): 22 check(debugger, command, context, result, internal_dict) 23 24def foobar(debugger, command, context, result, internal_dict): 25 check(debugger, command, context, result, internal_dict) 26 27def foobar4(debugger, command, result, internal_dict): 28 check(debugger, command, None, result, internal_dict) 29 30class FooBar: 31 @staticmethod 32 def sfoobar(debugger, command, context, result, internal_dict): 33 check(debugger, command, context, result, internal_dict) 34 35 @classmethod 36 def cfoobar(cls, debugger, command, context, result, internal_dict): 37 check(debugger, command, context, result, internal_dict) 38 39 def ifoobar(self, debugger, command, context, result, internal_dict): 40 check(debugger, command, context, result, internal_dict) 41 42 def __call__(self, debugger, command, context, result, internal_dict): 43 check(debugger, command, context, result, internal_dict) 44 45 @staticmethod 46 def sfoobar4(debugger, command, result, internal_dict): 47 check(debugger, command, None, result, internal_dict) 48 49 @classmethod 50 def cfoobar4(cls, debugger, command, result, internal_dict): 51 check(debugger, command, None, result, internal_dict) 52 53 def ifoobar4(self, debugger, command, result, internal_dict): 54 check(debugger, command, None, result, internal_dict) 55 56class FooBar4: 57 def __call__(self, debugger, command, result, internal_dict): 58 check(debugger, command, None, result, internal_dict) 59 60FooBarObj = FooBar() 61 62FooBar4Obj = FooBar4()