summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/commands/command/script/TestCommandScript.py
diff options
context:
space:
mode:
authorLawrence D'Anna <lawrence_danna@apple.com>2019-10-19 07:05:33 +0000
committerLawrence D'Anna <lawrence_danna@apple.com>2019-10-19 07:05:33 +0000
commit2386537c2469a97501a305c6b3138231b907a67f (patch)
tree71e2db86167d02ef38f7c1d0646356841b44435d /lldb/packages/Python/lldbsuite/test/commands/command/script/TestCommandScript.py
parent4a5df7312ec2c14360e4e12596a1ef63be39a480 (diff)
downloadbcm5719-llvm-2386537c2469a97501a305c6b3138231b907a67f.tar.gz
bcm5719-llvm-2386537c2469a97501a305c6b3138231b907a67f.zip
[LLDB] bugfix: command script add -f doesn't work for some callables
Summary: When users define a debugger command from python, they provide a callable object. Because the signature of the function has been extended, LLDB needs to inspect the number of parameters the callable can take. The rule it was using to decide was weird, apparently not tested, and giving wrong results for some kinds of python callables. This patch replaces the weird rule with a simple one: if the callable can take 5 arguments, it gets the 5 argument version of the signature. Otherwise it gets the old 4 argument version. It also adds tests with a bunch of different kinds of python callables with both 4 and 5 arguments. Reviewers: JDevlieghere, clayborg, labath, jingham Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D69014 llvm-svn: 375333
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/commands/command/script/TestCommandScript.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/commands/command/script/TestCommandScript.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/TestCommandScript.py b/lldb/packages/Python/lldbsuite/test/commands/command/script/TestCommandScript.py
index 6531cd67279..9542d0264a6 100644
--- a/lldb/packages/Python/lldbsuite/test/commands/command/script/TestCommandScript.py
+++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/TestCommandScript.py
@@ -4,7 +4,7 @@ Test lldb Python commands.
from __future__ import print_function
-
+import sys
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
@@ -22,6 +22,21 @@ class CmdPythonTestCase(TestBase):
def pycmd_tests(self):
self.runCmd("command source py_import")
+ # Test a bunch of different kinds of python callables with
+ # both 4 and 5 positional arguments.
+ self.expect("foobar", substrs=["All good"])
+ self.expect("foobar4", substrs=["All good"])
+ self.expect("vfoobar", substrs=["All good"])
+ self.expect("v5foobar", substrs=["All good"])
+ self.expect("sfoobar", substrs=["All good"])
+ self.expect("cfoobar", substrs=["All good"])
+ self.expect("ifoobar", substrs=["All good"])
+ self.expect("sfoobar4", substrs=["All good"])
+ self.expect("cfoobar4", substrs=["All good"])
+ self.expect("ifoobar4", substrs=["All good"])
+ self.expect("ofoobar", substrs=["All good"])
+ self.expect("ofoobar4", substrs=["All good"])
+
# Verify command that specifies eCommandRequiresTarget returns failure
# without a target.
self.expect('targetname',
OpenPOWER on IntegriCloud