blob: 5dbf09fbbec2722f3ef6c3d9192e6957adb71bc1 [file] [log] [blame]
Zachary Turner35d017f2015-10-23 17:04:29 +00001from __future__ import print_function
Enrico Granatae87764f2015-05-27 05:04:35 +00002import lldb, sys
Enrico Granatabe93a352011-08-16 16:49:25 +00003
Enrico Granata6f79bb22015-03-13 22:22:28 +00004class WelcomeCommand(object):
5 def __init__(self, debugger, session_dict):
6 pass
7
8 def get_short_help(self):
9 return "Just a docstring for welcome_impl\nA command that says hello to LLDB users"
10
11 def __call__(self, debugger, args, exe_ctx, result):
Zachary Turner35d017f2015-10-23 17:04:29 +000012 print('Hello ' + args + ', welcome to LLDB', file=result);
Enrico Granata6f79bb22015-03-13 22:22:28 +000013 return None;
Enrico Granatabe93a352011-08-16 16:49:25 +000014
Enrico Granatae87764f2015-05-27 05:04:35 +000015class TargetnameCommand(object):
16 def __init__(self, debugger, session_dict):
17 pass
18
19 def __call__(self, debugger, args, exe_ctx, result):
Ed Maste7daee532015-05-28 14:22:57 +000020 target = debugger.GetSelectedTarget()
21 file = target.GetExecutable()
Zachary Turner35d017f2015-10-23 17:04:29 +000022 print('Current target ' + file.GetFilename(), file=result)
Ed Maste8e453712015-05-28 15:58:10 +000023 if args == 'fail':
24 result.SetError('a test for error in command')
Enrico Granatae87764f2015-05-27 05:04:35 +000025
26 def get_flags(self):
27 return lldb.eCommandRequiresTarget
Enrico Granata223383e2011-08-16 23:24:13 +000028
29def print_wait_impl(debugger, args, result, dict):
Enrico Granatacd4d24d2012-10-16 20:57:12 +000030 result.SetImmediateOutputFile(sys.stdout)
Zachary Turner35d017f2015-10-23 17:04:29 +000031 print('Trying to do long task..', file=result)
Enrico Granata223383e2011-08-16 23:24:13 +000032 import time
33 time.sleep(1)
Zachary Turner35d017f2015-10-23 17:04:29 +000034 print('Still doing long task..', file=result)
Enrico Granata223383e2011-08-16 23:24:13 +000035 time.sleep(1)
Zachary Turner35d017f2015-10-23 17:04:29 +000036 print('Done; if you saw the delays I am doing OK', file=result)
Enrico Granata0a305db2011-11-07 22:57:04 +000037
38def check_for_synchro(debugger, args, result, dict):
39 if debugger.GetAsync() == True:
Zachary Turner35d017f2015-10-23 17:04:29 +000040 print('I am running async', file=result)
Enrico Granata0a305db2011-11-07 22:57:04 +000041 if debugger.GetAsync() == False:
Zachary Turner35d017f2015-10-23 17:04:29 +000042 print('I am running sync', file=result)
Enrico Granataeff81a42013-07-09 20:14:26 +000043
Enrico Granata06be0592014-10-01 21:47:29 +000044def takes_exe_ctx(debugger, args, exe_ctx, result, dict):
Zachary Turner35d017f2015-10-23 17:04:29 +000045 print(str(exe_ctx.GetTarget()), file=result)
Enrico Granata06be0592014-10-01 21:47:29 +000046