Esempio n. 1
0
    def setup():
        global server, client, target, pm, adaptor, methods

        log.info("setting up API tests")

        # set up voltron
        voltron.setup_env()
        pm = PluginManager()
        plugin = pm.debugger_plugin_for_host("lldb")
        adaptor = plugin.adaptor_class()
        voltron.debugger = adaptor

        # start up a voltron server
        server = Server()
        # import pdb;pdb.set_trace()
        server.start()

        time.sleep(0.1)

        # set up client
        client = Client()
        client.connect()

        # compile and load the test inferior
        subprocess.call("cc -o tests/inferior tests/inferior.c", shell=True)
        target = adaptor.host.CreateTargetWithFileAndArch("tests/inferior", lldb.LLDB_ARCH_DEFAULT)
        main_bp = target.BreakpointCreateByName("main", target.GetExecutable().GetFilename())
Esempio n. 2
0
    def setup():
        global server, client, target, pm, adaptor, methods

        log.info("setting up API tests")

        # set up voltron
        voltron.setup_env()
        pm = PluginManager()
        plugin = pm.debugger_plugin_for_host('lldb')
        adaptor = plugin.adaptor_class()
        voltron.debugger = adaptor

        # start up a voltron server
        server = Server()
        # import pdb;pdb.set_trace()
        server.start()

        time.sleep(0.1)

        # set up client
        client = Client()
        client.connect()

        # compile and load the test inferior
        subprocess.call("cc -o tests/inferior tests/inferior.c", shell=True)
        target = adaptor.host.CreateTargetWithFileAndArch(
            "tests/inferior", lldb.LLDB_ARCH_DEFAULT)
        main_bp = target.BreakpointCreateByName(
            "main",
            target.GetExecutable().GetFilename())
Esempio n. 3
0
def setup():
    global server, client, target, pm, adaptor, methods

    log.info("setting up API tests")

    # set up voltron
    voltron.setup_env()
    voltron.config['server'] = {
        "listen": {
            "domain": True,
            "tcp": ["127.0.0.1", 4444],
            "http": ["127.0.0.1", 5555]
        }
    }
    pm = PluginManager()
    plugin = pm.debugger_plugin_for_host('lldb')
    adaptor = plugin.adaptor_class()
    voltron.debugger = adaptor

    # inject mock methods
    inject_mock(adaptor)

    # start up a voltron server
    server = Server()
    server.start()

    time.sleep(2)
Esempio n. 4
0
def setup():
    global server, client, target, pm, adaptor, methods

    log.info("setting up API tests")

    # set up voltron
    voltron.setup_env()
    voltron.config['server'] = {
        "listen": {
            "domain":   True,
            "tcp":      ["127.0.0.1", 4444],
            "http":     ["127.0.0.1", 5555]
        }
    }
    pm = PluginManager()
    plugin = pm.debugger_plugin_for_host('mock')
    adaptor = plugin.adaptor_class()
    voltron.debugger = adaptor

    # inject mock methods
    inject_mock(adaptor)

    # start up a voltron server
    server = Server()
    server.start()

    time.sleep(2)
Esempio n. 5
0
def setup():
    global p, client, pm

    log.info("setting up GDB CLI tests")

    voltron.setup_env()

    # compile test inferior
    pexpect.run("cc -o tests/inferior tests/inferior.c")

    # start debugger
    start_debugger()
Esempio n. 6
0
def setup():
    global p, client, pm

    log.info("setting up GDB CLI tests")

    voltron.setup_env()

    # compile test inferior
    pexpect.run("cc -o tests/inferior tests/inferior.c")

    # start debugger
    start_debugger()
Esempio n. 7
0
def main(debugger=None):
    # Load config
    voltron.setup_env()
    voltron.setup_logging('main')

    # Set up command line arg parser
    parser = argparse.ArgumentParser()
    parser.add_argument('--debug',
                        '-d',
                        action='store_true',
                        help='print debug logging')
    top_level_sp = parser.add_subparsers(title='subcommands',
                                         description='valid subcommands')
    view_parser = top_level_sp.add_parser('view', help='display a view')
    view_sp = view_parser.add_subparsers(title='views',
                                         description='valid view types',
                                         help='additional help')

    # Set up a subcommand for each view class
    pm = PluginManager()
    for plugin in pm.view_plugins:
        pm.view_plugins[plugin].view_class.configure_subparser(view_sp)

    if HAS_CONSOLE:
        Console.configure_subparser(top_level_sp)

    # Parse args
    args = parser.parse_args()
    if args.debug:
        log.setLevel(logging.DEBUG)

    # Instantiate and run the appropriate module
    inst = args.func(args, loaded_config=voltron.config)
    inst.pm = pm
    try:
        inst.run()
    except Exception as e:
        log.error("Exception running module {}: {}".format(
            inst.__class__.__name__, traceback.format_exc()))
        print(
            "Encountered an exception while running the view '{}':\n{}".format(
                inst.__class__.__name__, traceback.format_exc()))
    except KeyboardInterrupt:
        suppress_exit_log = True
    inst.cleanup()
Esempio n. 8
0
def setup():
    global server, client, target, pm, adaptor, methods

    log.info("setting up API tests")

    # set up voltron
    voltron.setup_env()
    pm = PluginManager()
    plugin = pm.debugger_plugin_for_host('lldb')
    adaptor = plugin.adaptor_class()
    voltron.debugger = adaptor

    # inject mock methods
    inject_mock(adaptor)

    # start up a voltron server
    server = Server()
    server.start()

    time.sleep(2)
Esempio n. 9
0
def setup():
    global server, client, target, pm, adaptor, methods

    log.info("setting up API tests")

    # set up voltron
    voltron.setup_env()
    pm = PluginManager()
    plugin = pm.debugger_plugin_for_host('lldb')
    adaptor = plugin.adaptor_class()
    voltron.debugger = adaptor

    # inject mock methods
    inject_mock(adaptor)

    # start up a voltron server
    server = Server()
    server.start()

    time.sleep(2)
Esempio n. 10
0
def main(debugger=None):
    # Load config
    voltron.setup_env()
    voltron.setup_logging('main')

    # Set up command line arg parser
    parser = argparse.ArgumentParser()
    parser.add_argument('--debug', '-d', action='store_true', help='print debug logging')
    top_level_sp = parser.add_subparsers(title='subcommands', description='valid subcommands')
    view_parser = top_level_sp.add_parser('view', help='display a view')
    view_sp = view_parser.add_subparsers(title='views', description='valid view types', help='additional help')

    # Set up a subcommand for each view class
    pm = PluginManager()
    for plugin in pm.view_plugins:
        pm.view_plugins[plugin].view_class.configure_subparser(view_sp)

    if HAS_CONSOLE:
        Console.configure_subparser(top_level_sp)

    # Parse args
    args = parser.parse_args()
    if args.debug:
        log.setLevel(logging.DEBUG)

    # Instantiate and run the appropriate module
    inst = args.func(args, loaded_config=voltron.config)
    inst.pm = pm
    try:
        inst.run()
    except Exception as e:
        log.error("Exception running module {}: {}".format(inst.__class__.__name__, traceback.format_exc()))
        print("Encountered an exception while running the view '{}':\n{}".format(inst.__class__.__name__, traceback.format_exc()))
    except KeyboardInterrupt:
        suppress_exit_log = True
    inst.cleanup()
Esempio n. 11
0
def setup():
    global server, client, target, pm, adaptor, methods

    log.info("setting up API tests")

    # set up voltron
    voltron.setup_env()
    pm = PluginManager()
    plugin = pm.debugger_plugin_for_host('mock')
    adaptor = plugin.adaptor_class()
    voltron.debugger = adaptor

    # update the thingy
    inject_mock(adaptor)

    # start up a voltron server
    server = Server()
    server.start()

    time.sleep(0.5)

    # set up client
    client = Client()
    client.connect()
Esempio n. 12
0
    import voltron
    from voltron.core import Server
    from voltron.plugin import PluginManager
    try:
        import lldb
        in_lldb = True
    except ImportError:
        in_lldb = False
    try:
        import gdb
        in_gdb = True
    except ImportError:
        in_gdb = False

    voltron.setup_env()
    log = voltron.setup_logging('debugger')

    class VoltronCommand (object):
        """
        Parent class for common methods across all debugger hosts.
        """
        def handle_command(self, command):
            global log
            if "status" in command:
                self.status()
            elif 'debug' in command:
                if 'enable' in command:
                    log.setLevel(logging.DEBUG)
                    print("Debug logging enabled")
                elif 'disable' in command:
Esempio n. 13
0
import voltron
from voltron.core import *
from voltron.api import *
from voltron.plugin import PluginManager, DebuggerAdaptorPlugin

import platform
if platform.system() == 'Darwin':
    sys.path.append(
        "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python"
    )

import lldb

from common import *

voltron.setup_env()

log = logging.getLogger('tests')


def setup():
    global adaptor, dbg, target

    log.info("setting up LLDB API tests")

    # create an LLDBAdaptor
    pm = PluginManager()
    plugin = pm.debugger_plugin_for_host('lldb')
    adaptor = plugin.adaptor_class()

    # compile and load the test inferior
Esempio n. 14
0
def setup():
    voltron.setup_env()
Esempio n. 15
0
def setup():
    voltron.setup_env()