diff options
author | Enrico Granata <egranata@apple.com> | 2016-06-24 02:07:15 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2016-06-24 02:07:15 +0000 |
commit | a5d6765cb04214b10b5b5b550e554c5411c03b43 (patch) | |
tree | 23ea54790d247d50d16323a95ee044b9d5bbd0cf /lldb/scripts/Python/python-extensions.swig | |
parent | 68f7f1cf00a0405446fe765d2ed6e583a6e5947b (diff) | |
download | bcm5719-llvm-a5d6765cb04214b10b5b5b550e554c5411c03b43.tar.gz bcm5719-llvm-a5d6765cb04214b10b5b5b550e554c5411c03b43.zip |
Fix an issue where the @lldb.command marker would not work with the new 5-argument version of the Python command function
This:
a) teaches PythonCallable to look inside a callable object
b) teaches PythonCallable to discover whether a callable method is bound
c) teaches lldb.command to dispatch to either the older 4 argument version or the newer 5 argument version
llvm-svn: 273640
Diffstat (limited to 'lldb/scripts/Python/python-extensions.swig')
-rw-r--r-- | lldb/scripts/Python/python-extensions.swig | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lldb/scripts/Python/python-extensions.swig b/lldb/scripts/Python/python-extensions.swig index 1e43e53a514..487bf1e3599 100644 --- a/lldb/scripts/Python/python-extensions.swig +++ b/lldb/scripts/Python/python-extensions.swig @@ -810,6 +810,7 @@ def command(*args, **kwargs): import lldb + import inspect """A decorator function that registers an LLDB command line command that is bound to the function it is attached to.""" class obj(object): @@ -821,11 +822,15 @@ def command(*args, **kwargs): command = "command script add -f %s.%s %s" % (function.__module__, function.__name__, command_name) lldb.debugger.HandleCommand(command) self.function = function - def __call__(self, *args, **kwargs): - self.function(*args, **kwargs) + def __call__(self, debugger, command, exe_ctx, result, dict): + if len(inspect.getargspec(self.function).args) == 5: + self.function(debugger, command, exe_ctx, result, dict) + else: + self.function(debugger, command, result, dict) def callable(function): """Creates a callable object that gets used.""" - return obj(function, *args, **kwargs) + f = obj(function, *args, **kwargs) + return f.__call__ return callable class declaration(object): @@ -1129,4 +1134,4 @@ def is_numeric_type(basic_type): #if basic_type == eBasicTypeOther: return (False,False) -%}
\ No newline at end of file +%} |