summaryrefslogtreecommitdiffstats
path: root/lldb/test/functionalities/command_script
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test/functionalities/command_script')
-rw-r--r--lldb/test/functionalities/command_script/TestCommandScript.py26
-rw-r--r--lldb/test/functionalities/command_script/import/TestImport.py1
-rw-r--r--lldb/test/functionalities/command_script/main.cpp9
-rw-r--r--lldb/test/functionalities/command_script/mysto.py21
-rw-r--r--lldb/test/functionalities/command_script/py_import4
-rw-r--r--lldb/test/functionalities/command_script/welcome.py9
6 files changed, 68 insertions, 2 deletions
diff --git a/lldb/test/functionalities/command_script/TestCommandScript.py b/lldb/test/functionalities/command_script/TestCommandScript.py
index 5064377b842..c381e4985a9 100644
--- a/lldb/test/functionalities/command_script/TestCommandScript.py
+++ b/lldb/test/functionalities/command_script/TestCommandScript.py
@@ -33,6 +33,10 @@ class CmdPythonTestCase(TestBase):
self.runCmd('command script delete welcome', check=False)
self.runCmd('command script delete targetname', check=False)
self.runCmd('command script delete longwait', check=False)
+ self.runCmd('command script delete mysto', check=False)
+ 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)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
@@ -83,12 +87,34 @@ class CmdPythonTestCase(TestBase):
self.expect("longwait",
substrs = ['Done; if you saw the delays I am doing OK'])
+ self.runCmd("b main")
+ self.runCmd("run")
+ self.runCmd("mysto 3")
+ self.expect("frame variable array",
+ substrs = ['[0] = 79630','[1] = 388785018','[2] = 0'])
+ self.runCmd("mysto 3")
+ self.expect("frame variable array",
+ substrs = ['[0] = 79630','[4] = 388785018','[5] = 0'])
+
+# we cannot use the stepover command to check for async execution mode since LLDB
+# seems to get confused when events start to queue up
+ self.expect("tell_sync",
+ substrs = ['running sync'])
+ self.expect("tell_async",
+ substrs = ['running async'])
+ self.expect("tell_curr",
+ substrs = ['I am running','sync'])
+
+
self.runCmd("command script clear")
self.expect('command script list', matching=False,
substrs = ['targetname',
'longwait'])
+ self.expect('command script add -f foobar frame', error=True,
+ substrs = ['cannot add command'])
+
if __name__ == '__main__':
import atexit
lldb.SBDebugger.Initialize()
diff --git a/lldb/test/functionalities/command_script/import/TestImport.py b/lldb/test/functionalities/command_script/import/TestImport.py
index a983e285c39..1e949efd31f 100644
--- a/lldb/test/functionalities/command_script/import/TestImport.py
+++ b/lldb/test/functionalities/command_script/import/TestImport.py
@@ -48,6 +48,7 @@ class ImportTestCase(TestBase):
self.runCmd("script import dummymodule")
self.expect("command script import ./dummymodule.py",
error=True, startstr='error: module importing failed')
+ self.runCmd("command script import --allow-reload ./dummymodule.py")
self.runCmd("command script add -f foo.foo_function foocmd")
self.runCmd("command script add -f foobar.foo_function foobarcmd")
diff --git a/lldb/test/functionalities/command_script/main.cpp b/lldb/test/functionalities/command_script/main.cpp
index 7af4e3de2d0..3b245c93cac 100644
--- a/lldb/test/functionalities/command_script/main.cpp
+++ b/lldb/test/functionalities/command_script/main.cpp
@@ -52,11 +52,18 @@ int
main(int argc, char const *argv[])
{
- int array[3];
+ int array[9];
+ memset(array,0,9*sizeof(int));
array[0] = foo (1238, 78392);
array[1] = foo (379265, 23674);
array[2] = foo (872934, 234);
+ array[3] = foo (1238, 78392);
+ array[4] = foo (379265, 23674);
+ array[5] = foo (872934, 234);
+ array[6] = foo (1238, 78392);
+ array[7] = foo (379265, 23674);
+ array[8] = foo (872934, 234);
return 0;
}
diff --git a/lldb/test/functionalities/command_script/mysto.py b/lldb/test/functionalities/command_script/mysto.py
new file mode 100644
index 00000000000..4ad3d425592
--- /dev/null
+++ b/lldb/test/functionalities/command_script/mysto.py
@@ -0,0 +1,21 @@
+import lldb
+import sys
+import os
+import time
+
+def StepOver(debugger, args, result, dict):
+ """
+ Step over a given number of times instead of only just once
+ """
+ arg_split = args.split(" ")
+ print type(arg_split)
+ count = int(arg_split[0])
+ for i in range(0,count):
+ lldb.thread.StepOver(lldb.eOnlyThisThread)
+ print "step<%d>"%i
+
+def __lldb_init_module(debugger, session_dict):
+ # by default, --synchronicity is set to synchronous
+ debugger.HandleCommand("command script add -f mysto.StepOver mysto")
+ return None
+
diff --git a/lldb/test/functionalities/command_script/py_import b/lldb/test/functionalities/command_script/py_import
index 9f36a7f8996..0ce2d79ba4e 100644
--- a/lldb/test/functionalities/command_script/py_import
+++ b/lldb/test/functionalities/command_script/py_import
@@ -4,3 +4,7 @@ script import welcome
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
+command script import mysto.py --allow-reload
+command script add tell_sync --function welcome.check_for_synchro --synchronicity sync
+command script add tell_async --function welcome.check_for_synchro --synchronicity async
+command script add tell_curr --function welcome.check_for_synchro --synchronicity curr
diff --git a/lldb/test/functionalities/command_script/welcome.py b/lldb/test/functionalities/command_script/welcome.py
index 3b63c702327..29bbbc4b57e 100644
--- a/lldb/test/functionalities/command_script/welcome.py
+++ b/lldb/test/functionalities/command_script/welcome.py
@@ -24,4 +24,11 @@ def print_wait_impl(debugger, args, result, dict):
print 'Still doing long task..';
time.sleep(1)
result.PutCString('Done; if you saw the delays I am doing OK')
- return None \ No newline at end of file
+ return None
+
+def check_for_synchro(debugger, args, result, dict):
+ if debugger.GetAsync() == True:
+ result.PutCString('I am running async')
+ if debugger.GetAsync() == False:
+ result.PutCString('I am running sync')
+ return None
OpenPOWER on IntegriCloud