• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1from __future__ import print_function
2import lldb
3import sys
4
5
6class WelcomeCommand(object):
7
8    def __init__(self, debugger, session_dict):
9        pass
10
11    def get_short_help(self):
12        return "Just a docstring for welcome_impl\nA command that says hello to LLDB users"
13
14    def __call__(self, debugger, args, exe_ctx, result):
15        print('Hello ' + args + ', welcome to LLDB', file=result)
16        return None
17
18
19class TargetnameCommand(object):
20
21    def __init__(self, debugger, session_dict):
22        pass
23
24    def __call__(self, debugger, args, exe_ctx, result):
25        target = debugger.GetSelectedTarget()
26        file = target.GetExecutable()
27        print('Current target ' + file.GetFilename(), file=result)
28        if args == 'fail':
29            result.SetError('a test for error in command')
30
31    def get_flags(self):
32        return lldb.eCommandRequiresTarget
33
34
35def print_wait_impl(debugger, args, result, dict):
36    result.SetImmediateOutputFile(sys.stdout)
37    print('Trying to do long task..', file=result)
38    import time
39    time.sleep(1)
40    print('Still doing long task..', file=result)
41    time.sleep(1)
42    print('Done; if you saw the delays I am doing OK', file=result)
43
44
45def check_for_synchro(debugger, args, result, dict):
46    if debugger.GetAsync():
47        print('I am running async', file=result)
48    if debugger.GetAsync() == False:
49        print('I am running sync', file=result)
50
51
52def takes_exe_ctx(debugger, args, exe_ctx, result, dict):
53    print(str(exe_ctx.GetTarget()), file=result)
54