summaryrefslogtreecommitdiffstats
path: root/lldb/test/functionalities/command_script
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-12-14 20:40:27 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-12-14 20:40:27 +0000
commit1d9cb8a1844baa3ca3a8912a667364726cf3931e (patch)
treed1013e63589c3388645c5e990c3acb54449e122c /lldb/test/functionalities/command_script
parentda103bf9ecfcdeb4292b2920c908a416a8b105b4 (diff)
downloadbcm5719-llvm-1d9cb8a1844baa3ca3a8912a667364726cf3931e.tar.gz
bcm5719-llvm-1d9cb8a1844baa3ca3a8912a667364726cf3931e.zip
http://llvm.org/bugs/show_bug.cgi?id=11569
LLDBSwigPythonCallCommand crashes when a command script returns an object Add more robustness to LLDBSwigPythonCallCommand. It should check whether the returned Python object is a string, and only assign it as the error msg when the check holds. Also add a regression test. llvm-svn: 146584
Diffstat (limited to 'lldb/test/functionalities/command_script')
-rw-r--r--lldb/test/functionalities/command_script/TestCommandScript.py7
-rw-r--r--lldb/test/functionalities/command_script/bug11569.py7
-rw-r--r--lldb/test/functionalities/command_script/py_import1
3 files changed, 15 insertions, 0 deletions
diff --git a/lldb/test/functionalities/command_script/TestCommandScript.py b/lldb/test/functionalities/command_script/TestCommandScript.py
index c381e4985a9..bc20285b872 100644
--- a/lldb/test/functionalities/command_script/TestCommandScript.py
+++ b/lldb/test/functionalities/command_script/TestCommandScript.py
@@ -37,6 +37,7 @@ class CmdPythonTestCase(TestBase):
self.runCmd('command script delete tell_sync', check=False)
self.runCmd('command script delete tell_async', check=False)
self.runCmd('command script delete tell_curr', check=False)
+ self.runCmd('command script delete bug11569', check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
@@ -115,6 +116,12 @@ class CmdPythonTestCase(TestBase):
self.expect('command script add -f foobar frame', error=True,
substrs = ['cannot add command'])
+ # http://llvm.org/bugs/show_bug.cgi?id=11569
+ # LLDBSwigPythonCallCommand crashes when a command script returns an object
+ self.runCmd('command script add -f bug11569 bug11569')
+ # This should not crash.
+ self.runCmd('bug11569', check=False)
+
if __name__ == '__main__':
import atexit
lldb.SBDebugger.Initialize()
diff --git a/lldb/test/functionalities/command_script/bug11569.py b/lldb/test/functionalities/command_script/bug11569.py
new file mode 100644
index 00000000000..93897d88098
--- /dev/null
+++ b/lldb/test/functionalities/command_script/bug11569.py
@@ -0,0 +1,7 @@
+def bug11569(debugger, args, result, dict):
+ """
+ http://llvm.org/bugs/show_bug.cgi?id=11569
+ LLDBSwigPythonCallCommand crashes when a command script returns an object.
+ """
+ return ["return", "a", "non-string", "should", "not", "crash", "LLDB"];
+
diff --git a/lldb/test/functionalities/command_script/py_import b/lldb/test/functionalities/command_script/py_import
index 0ce2d79ba4e..8cb112d884d 100644
--- a/lldb/test/functionalities/command_script/py_import
+++ b/lldb/test/functionalities/command_script/py_import
@@ -1,6 +1,7 @@
script import sys, os
script sys.path.append(os.path.join(os.getcwd(), os.pardir))
script import welcome
+script import bug11569
command script add welcome --function welcome.welcome_impl
command script add targetname --function welcome.target_name_impl
command script add longwait --function welcome.print_wait_impl
OpenPOWER on IntegriCloud