2015-10-23 17:04:29 +00:00
|
|
|
from __future__ import print_function
|
2016-09-06 20:57:50 +00:00
|
|
|
import lldb
|
|
|
|
|
import sys
|
|
|
|
|
|
2011-08-16 16:49:25 +00:00
|
|
|
|
2015-03-13 22:22:28 +00:00
|
|
|
class WelcomeCommand(object):
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2015-03-13 22:22:28 +00:00
|
|
|
def __init__(self, debugger, session_dict):
|
|
|
|
|
pass
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2015-03-13 22:22:28 +00:00
|
|
|
def get_short_help(self):
|
|
|
|
|
return "Just a docstring for welcome_impl\nA command that says hello to LLDB users"
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2015-03-13 22:22:28 +00:00
|
|
|
def __call__(self, debugger, args, exe_ctx, result):
|
2016-09-06 20:57:50 +00:00
|
|
|
print('Hello ' + args + ', welcome to LLDB', file=result)
|
|
|
|
|
return None
|
|
|
|
|
|
2011-08-16 16:49:25 +00:00
|
|
|
|
2015-05-27 05:04:35 +00:00
|
|
|
class TargetnameCommand(object):
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2015-05-27 05:04:35 +00:00
|
|
|
def __init__(self, debugger, session_dict):
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def __call__(self, debugger, args, exe_ctx, result):
|
2015-05-28 14:22:57 +00:00
|
|
|
target = debugger.GetSelectedTarget()
|
|
|
|
|
file = target.GetExecutable()
|
2015-10-23 17:04:29 +00:00
|
|
|
print('Current target ' + file.GetFilename(), file=result)
|
2015-05-28 15:58:10 +00:00
|
|
|
if args == 'fail':
|
|
|
|
|
result.SetError('a test for error in command')
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2015-05-27 05:04:35 +00:00
|
|
|
def get_flags(self):
|
|
|
|
|
return lldb.eCommandRequiresTarget
|
2011-08-16 23:24:13 +00:00
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2011-08-16 23:24:13 +00:00
|
|
|
def print_wait_impl(debugger, args, result, dict):
|
2012-10-16 20:57:12 +00:00
|
|
|
result.SetImmediateOutputFile(sys.stdout)
|
2015-10-23 17:04:29 +00:00
|
|
|
print('Trying to do long task..', file=result)
|
2011-08-16 23:24:13 +00:00
|
|
|
import time
|
|
|
|
|
time.sleep(1)
|
2015-10-23 17:04:29 +00:00
|
|
|
print('Still doing long task..', file=result)
|
2011-08-16 23:24:13 +00:00
|
|
|
time.sleep(1)
|
2015-10-23 17:04:29 +00:00
|
|
|
print('Done; if you saw the delays I am doing OK', file=result)
|
2011-11-07 22:57:04 +00:00
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2011-11-07 22:57:04 +00:00
|
|
|
def check_for_synchro(debugger, args, result, dict):
|
2016-09-06 20:57:50 +00:00
|
|
|
if debugger.GetAsync():
|
2015-10-23 17:04:29 +00:00
|
|
|
print('I am running async', file=result)
|
2011-11-07 22:57:04 +00:00
|
|
|
if debugger.GetAsync() == False:
|
2015-10-23 17:04:29 +00:00
|
|
|
print('I am running sync', file=result)
|
2013-07-09 20:14:26 +00:00
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2014-10-01 21:47:29 +00:00
|
|
|
def takes_exe_ctx(debugger, args, exe_ctx, result, dict):
|
2015-10-23 17:04:29 +00:00
|
|
|
print(str(exe_ctx.GetTarget()), file=result)
|