brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 7b7578d Raw
54 lines · python
1import lldb2import sys3 4 5class WelcomeCommand(object):6    def __init__(self, debugger, session_dict):7        pass8 9    def get_short_help(self):10        return (11            "Just a docstring for welcome_impl\nA command that says hello to LLDB users"12        )13 14    def __call__(self, debugger, args, exe_ctx, result):15        print("Hello " + args + ", welcome to LLDB", file=result)16        return None17 18 19class TargetnameCommand(object):20    def __init__(self, debugger, session_dict):21        pass22 23    def __call__(self, debugger, args, exe_ctx, result):24        target = debugger.GetSelectedTarget()25        file = target.GetExecutable()26        print("Current target " + file.GetFilename(), file=result)27        if args == "fail":28            result.SetError("a test for error in command")29 30    def get_flags(self):31        return lldb.eCommandRequiresTarget32 33 34def print_wait_impl(debugger, args, result, dict):35    result.SetImmediateOutputFile(sys.stdout)36    print("Trying to do long task..", file=result)37    import time38 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 not debugger.GetAsync():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