diff options
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/commands/command/script')
25 files changed, 568 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/.categories b/lldb/packages/Python/lldbsuite/test/commands/command/script/.categories new file mode 100644 index 00000000000..3a3f4df6416 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/.categories @@ -0,0 +1 @@ +cmdline diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/Makefile b/lldb/packages/Python/lldbsuite/test/commands/command/script/Makefile new file mode 100644 index 00000000000..8a7102e347a --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/TestCommandScript.py b/lldb/packages/Python/lldbsuite/test/commands/command/script/TestCommandScript.py new file mode 100644 index 00000000000..6531cd67279 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/TestCommandScript.py @@ -0,0 +1,153 @@ +""" +Test lldb Python commands. +""" + +from __future__ import print_function + + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * + + +class CmdPythonTestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + NO_DEBUG_INFO_TESTCASE = True + + def test(self): + self.build() + self.pycmd_tests() + + def pycmd_tests(self): + self.runCmd("command source py_import") + + # Verify command that specifies eCommandRequiresTarget returns failure + # without a target. + self.expect('targetname', + substrs=['a.out'], matching=False, error=True) + + exe = self.getBuildArtifact("a.out") + self.expect("file " + exe, + patterns=["Current executable set to .*a.out"]) + + self.expect('targetname', + substrs=['a.out'], matching=True, error=False) + + # This is the function to remove the custom commands in order to have a + # clean slate for the next test case. + def cleanup(): + 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) + self.runCmd('command script delete bug11569', check=False) + self.runCmd('command script delete takes_exe_ctx', check=False) + self.runCmd('command script delete decorated', check=False) + + # Execute the cleanup function during test case tear down. + self.addTearDownHook(cleanup) + + # Interact with debugger in synchronous mode + self.setAsync(False) + + # We don't want to display the stdout if not in TraceOn() mode. + if not self.TraceOn(): + self.HideStdout() + + self.expect('welcome Enrico', + substrs=['Hello Enrico, welcome to LLDB']) + + self.expect("help welcome", + substrs=['Just a docstring for welcome_impl', + 'A command that says hello to LLDB users']) + + decorated_commands = ["decorated" + str(n) for n in range(1, 5)] + for name in decorated_commands: + self.expect(name, substrs=["hello from " + name]) + self.expect("help " + name, + substrs=["Python command defined by @lldb.command"]) + + self.expect("help", + substrs=['For more information run', + 'welcome'] + decorated_commands) + + self.expect("help -a", + substrs=['For more information run', + 'welcome'] + decorated_commands) + + self.expect("help -u", matching=False, + substrs=['For more information run']) + + self.runCmd("command script delete welcome") + + self.expect('welcome Enrico', matching=False, error=True, + substrs=['Hello Enrico, welcome to LLDB']) + + self.expect('targetname fail', error=True, + substrs=['a test for error in command']) + + self.expect('command script list', + substrs=['targetname', + 'For more information run']) + + self.expect("help targetname", + substrs=['Expects', '\'raw\'', 'input', + 'help', 'raw-input']) + + 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']) + +# check that the execution context is passed in to commands that ask for it + self.expect("takes_exe_ctx", substrs=["a.out"]) + + # Test that a python command can redefine itself + self.expect('command script add -f foobar welcome -h "just some help"') + + self.runCmd("command script clear") + + # Test that re-defining an existing command works + self.runCmd( + 'command script add my_command --class welcome.WelcomeCommand') + self.expect('my_command Blah', substrs=['Hello Blah, welcome to LLDB']) + + self.runCmd( + 'command script add my_command --class welcome.TargetnameCommand') + self.expect('my_command', substrs=['a.out']) + + 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']) + + # 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) diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/bug11569.py b/lldb/packages/Python/lldbsuite/test/commands/command/script/bug11569.py new file mode 100644 index 00000000000..3c124de79bf --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/bug11569.py @@ -0,0 +1,6 @@ +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/packages/Python/lldbsuite/test/commands/command/script/decorated.py b/lldb/packages/Python/lldbsuite/test/commands/command/script/decorated.py new file mode 100644 index 00000000000..f9707a5706a --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/decorated.py @@ -0,0 +1,35 @@ +from __future__ import print_function + +import lldb + + +@lldb.command() +def decorated1(debugger, args, exe_ctx, result, dict): + """ + Python command defined by @lldb.command + """ + print("hello from decorated1", file=result) + + +@lldb.command(doc="Python command defined by @lldb.command") +def decorated2(debugger, args, exe_ctx, result, dict): + """ + This docstring is overridden. + """ + print("hello from decorated2", file=result) + + +@lldb.command() +def decorated3(debugger, args, result, dict): + """ + Python command defined by @lldb.command + """ + print("hello from decorated3", file=result) + + +@lldb.command("decorated4") +def _decorated4(debugger, args, exe_ctx, result, dict): + """ + Python command defined by @lldb.command + """ + print("hello from decorated4", file=result) diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/import/Makefile b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/Makefile new file mode 100644 index 00000000000..9374aef487f --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/Makefile @@ -0,0 +1,6 @@ +LEVEL = ../../../make + +C_SOURCES := main.c +EXE := hello_world + +include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/import/TestImport.py b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/TestImport.py new file mode 100644 index 00000000000..bbeee1a5e32 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/TestImport.py @@ -0,0 +1,76 @@ +"""Test custom import command to import files by path.""" + +from __future__ import print_function + + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class ImportTestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + @add_test_categories(['pyapi']) + @no_debug_info_test + def test_import_command(self): + """Import some Python scripts by path and test them""" + self.run_test() + + def setUp(self): + # Call super's setUp(). + TestBase.setUp(self) + + def run_test(self): + """Import some Python scripts by path and test them.""" + + # This is the function to remove the custom commands in order to have a + # clean slate for the next test case. + def cleanup(): + self.runCmd('command script delete foo2cmd', check=False) + self.runCmd('command script delete foocmd', check=False) + self.runCmd('command script delete foobarcmd', check=False) + self.runCmd('command script delete barcmd', check=False) + self.runCmd('command script delete barothercmd', check=False) + self.runCmd('command script delete TPcommandA', check=False) + self.runCmd('command script delete TPcommandB', check=False) + + # Execute the cleanup function during test case tear down. + self.addTearDownHook(cleanup) + + self.runCmd("command script import ./foo/foo.py --allow-reload") + self.runCmd("command script import ./foo/foo2.py --allow-reload") + self.runCmd("command script import ./foo/bar/foobar.py --allow-reload") + self.runCmd("command script import ./bar/bar.py --allow-reload") + + self.expect("command script import ./nosuchfile.py", + error=True, startstr='error: module importing failed') + self.expect("command script import ./nosuchfolder/", + error=True, startstr='error: module importing failed') + self.expect("command script import ./foo/foo.py", error=False) + + self.runCmd("command script import --allow-reload ./thepackage") + self.expect("TPcommandA", substrs=["hello world A"]) + self.expect("TPcommandB", substrs=["hello world B"]) + + self.runCmd("script import dummymodule") + self.expect("command script import ./dummymodule.py", error=False) + self.expect( + "command script import --allow-reload ./dummymodule.py", + error=False) + + self.runCmd("command script add -f foo.foo_function foocmd") + self.runCmd("command script add -f foobar.foo_function foobarcmd") + self.runCmd("command script add -f bar.bar_function barcmd") + self.expect("foocmd hello", + substrs=['foo says', 'hello']) + self.expect("foo2cmd hello", + substrs=['foo2 says', 'hello']) + self.expect("barcmd hello", + substrs=['barutil says', 'bar told me', 'hello']) + self.expect("barothercmd hello", + substrs=['barutil says', 'bar told me', 'hello']) + self.expect("foobarcmd hello", + substrs=['foobar says', 'hello']) diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/import/bar/bar.py b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/bar/bar.py new file mode 100644 index 00000000000..444e00976ad --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/bar/bar.py @@ -0,0 +1,15 @@ +from __future__ import print_function + + +def bar_function(debugger, args, result, dict): + global UtilityModule + print(UtilityModule.barutil_function("bar told me " + args), file=result) + return None + + +def __lldb_init_module(debugger, session_dict): + global UtilityModule + UtilityModule = __import__("barutil") + debugger.HandleCommand( + "command script add -f bar.bar_function barothercmd") + return None diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/import/bar/barutil.py b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/bar/barutil.py new file mode 100644 index 00000000000..70ecea30057 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/bar/barutil.py @@ -0,0 +1,2 @@ +def barutil_function(x): + return "barutil says: " + x diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/import/dummymodule.py b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/dummymodule.py new file mode 100644 index 00000000000..668a5b90ea4 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/dummymodule.py @@ -0,0 +1,2 @@ +def no_useful_code(foo): + return foo diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/import/foo/bar/foobar.py b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/foo/bar/foobar.py new file mode 100644 index 00000000000..6ef71064c9a --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/foo/bar/foobar.py @@ -0,0 +1,6 @@ +from __future__ import print_function + + +def foo_function(debugger, args, result, dict): + print("foobar says " + args, file=result) + return None diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/import/foo/foo.py b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/foo/foo.py new file mode 100644 index 00000000000..1ccc3892939 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/foo/foo.py @@ -0,0 +1,6 @@ +from __future__ import print_function + + +def foo_function(debugger, args, result, dict): + print("foo says " + args, file=result) + return None diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/import/foo/foo2.py b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/foo/foo2.py new file mode 100644 index 00000000000..71657c299c2 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/foo/foo2.py @@ -0,0 +1,11 @@ +from __future__ import print_function + + +def foo2_function(debugger, args, result, dict): + print("foo2 says " + args, file=result) + return None + + +def __lldb_init_module(debugger, session_dict): + debugger.HandleCommand("command script add -f foo2.foo2_function foo2cmd") + return None diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/import/main.c b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/main.c new file mode 100644 index 00000000000..dffc8c77b04 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/main.c @@ -0,0 +1,15 @@ +#include <stdio.h> + +int main(int argc, char const *argv[]) { + printf("Hello world.\n"); // Set break point at this line. + if (argc == 1) + return 0; + + // Waiting to be attached by the debugger, otherwise. + char line[100]; + while (fgets(line, sizeof(line), stdin)) { // Waiting to be attached... + printf("input line=>%s\n", line); + } + + printf("Exiting now\n"); +} diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/import/rdar-12586188/Makefile b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/rdar-12586188/Makefile new file mode 100644 index 00000000000..7913aaa4b74 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/rdar-12586188/Makefile @@ -0,0 +1,3 @@ +LEVEL = ../../../../make + +include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/import/rdar-12586188/TestRdar12586188.py b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/rdar-12586188/TestRdar12586188.py new file mode 100644 index 00000000000..fdcf8764e67 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/rdar-12586188/TestRdar12586188.py @@ -0,0 +1,36 @@ +"""Check that we handle an ImportError in a special way when command script importing files.""" + +from __future__ import print_function + + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class Rdar12586188TestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + @add_test_categories(['pyapi']) + @no_debug_info_test + def test_rdar12586188_command(self): + """Check that we handle an ImportError in a special way when command script importing files.""" + self.run_test() + + def setUp(self): + # Call super's setUp(). + TestBase.setUp(self) + + def run_test(self): + """Check that we handle an ImportError in a special way when command script importing files.""" + + self.expect( + "command script import ./fail12586188.py --allow-reload", + error=True, + substrs=['raise ImportError("I do not want to be imported")']) + self.expect( + "command script import ./fail212586188.py --allow-reload", + error=True, + substrs=['raise ValueError("I do not want to be imported")']) diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/import/rdar-12586188/fail12586188.py b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/rdar-12586188/fail12586188.py new file mode 100644 index 00000000000..ea385e03e04 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/rdar-12586188/fail12586188.py @@ -0,0 +1,4 @@ +def f(x): + return x + 1 + +raise ImportError("I do not want to be imported") diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/import/rdar-12586188/fail212586188.py b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/rdar-12586188/fail212586188.py new file mode 100644 index 00000000000..8dbc0e67ba1 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/rdar-12586188/fail212586188.py @@ -0,0 +1,4 @@ +def f(x): + return x + 1 + +raise ValueError("I do not want to be imported") diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/import/thepackage/TPunitA.py b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/thepackage/TPunitA.py new file mode 100644 index 00000000000..9694b084295 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/thepackage/TPunitA.py @@ -0,0 +1,7 @@ + +import six + + +def command(debugger, command, result, internal_dict): + result.PutCString(six.u("hello world A")) + return None diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/import/thepackage/TPunitB.py b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/thepackage/TPunitB.py new file mode 100644 index 00000000000..94a333bc696 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/thepackage/TPunitB.py @@ -0,0 +1,7 @@ + +import six + + +def command(debugger, command, result, internal_dict): + result.PutCString(six.u("hello world B")) + return None diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/import/thepackage/__init__.py b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/thepackage/__init__.py new file mode 100644 index 00000000000..24cdea60f2c --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/import/thepackage/__init__.py @@ -0,0 +1,11 @@ +from __future__ import absolute_import + +from . import TPunitA +from . import TPunitB + + +def __lldb_init_module(debugger, *args): + debugger.HandleCommand( + "command script add -f thepackage.TPunitA.command TPcommandA") + debugger.HandleCommand( + "command script add -f thepackage.TPunitB.command TPcommandB") diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/main.cpp b/lldb/packages/Python/lldbsuite/test/commands/command/script/main.cpp new file mode 100644 index 00000000000..a0e9efd6ee0 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/main.cpp @@ -0,0 +1,69 @@ +//===-- main.cpp ------------------------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include <cstdlib> +#include <cstring> +#include <string> +#include <fstream> +#include <iostream> + +int +product (int x, int y) +{ + int result = x * y; + return result; +} + +int +sum (int a, int b) +{ + int result = a + b; + return result; +} + +int +strange_max (int m, int n) +{ + if (m > n) + return m; + else if (n > m) + return n; + else + return 0; +} + +int +foo (int i, int j) +{ + if (strange_max (i, j) == i) + return product (i, j); + else if (strange_max (i, j) == j) + return sum (i, j); + else + return product (sum (i, i), sum (j, j)); +} + +int +main(int argc, char const *argv[]) +{ + + 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/packages/Python/lldbsuite/test/commands/command/script/mysto.py b/lldb/packages/Python/lldbsuite/test/commands/command/script/mysto.py new file mode 100644 index 00000000000..04eceb7eb93 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/mysto.py @@ -0,0 +1,22 @@ +from __future__ import print_function + +import lldb + + +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): + debugger.GetSelectedTarget().GetProcess( + ).GetSelectedThread().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/packages/Python/lldbsuite/test/commands/command/script/py_import b/lldb/packages/Python/lldbsuite/test/commands/command/script/py_import new file mode 100644 index 00000000000..6c1f7b8185f --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/py_import @@ -0,0 +1,13 @@ +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 --class welcome.WelcomeCommand +command script add targetname --class welcome.TargetnameCommand +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 +command script add takes_exe_ctx --function welcome.takes_exe_ctx +command script import decorated.py diff --git a/lldb/packages/Python/lldbsuite/test/commands/command/script/welcome.py b/lldb/packages/Python/lldbsuite/test/commands/command/script/welcome.py new file mode 100644 index 00000000000..0539d7c1721 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/command/script/welcome.py @@ -0,0 +1,53 @@ +from __future__ import print_function +import lldb +import sys + + +class WelcomeCommand(object): + + def __init__(self, debugger, session_dict): + pass + + def get_short_help(self): + return "Just a docstring for welcome_impl\nA command that says hello to LLDB users" + + def __call__(self, debugger, args, exe_ctx, result): + print('Hello ' + args + ', welcome to LLDB', file=result) + return None + + +class TargetnameCommand(object): + + def __init__(self, debugger, session_dict): + pass + + def __call__(self, debugger, args, exe_ctx, result): + target = debugger.GetSelectedTarget() + file = target.GetExecutable() + print('Current target ' + file.GetFilename(), file=result) + if args == 'fail': + result.SetError('a test for error in command') + + def get_flags(self): + return lldb.eCommandRequiresTarget + + +def print_wait_impl(debugger, args, result, dict): + result.SetImmediateOutputFile(sys.stdout) + print('Trying to do long task..', file=result) + import time + time.sleep(1) + print('Still doing long task..', file=result) + time.sleep(1) + print('Done; if you saw the delays I am doing OK', file=result) + + +def check_for_synchro(debugger, args, result, dict): + if debugger.GetAsync(): + print('I am running async', file=result) + if debugger.GetAsync() == False: + print('I am running sync', file=result) + + +def takes_exe_ctx(debugger, args, exe_ctx, result, dict): + print(str(exe_ctx.GetTarget()), file=result) |