teak-llvm/lldb/packages/Python/lldbsuite/test/commands/command/script/welcome.py
Raphael Isemann 29872606d2 [lldb] Restructure test folders to match LLDB command hierarchy
Summary:
As discussed on lldb-dev, this patch moves some LLDB tests into a hierarchy that more closely
resembles the commands we use in the LLDB interpreter. This patch should only move tests
that use the command interpreter and shouldn't touch any tests that primarily test the SB API.

Reviewers: #lldb, jfb, JDevlieghere

Reviewed By: #lldb, JDevlieghere

Subscribers: dexonsmith, arphaman, JDevlieghere, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D67033

llvm-svn: 370605
2019-09-01 09:12:37 +00:00

54 lines
1.5 KiB
Python

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)