# Path: voidwalker/framework/interface/command.py
# class BreakpointCommand(Command):
#     __metaclass__ = abc.ABCMeta
# 
#     @abc.abstractmethod
#     def execute(self, terminal, inferior, argument):
#         raise NotImplementedError
# 
# Path: voidwalker/framework/interface/command.py
# class Command(object):
#     pass
# 
# Path: voidwalker/framework/interface/command.py
# class CommandFactory(object):
#     __metaclass__ = abc.ABCMeta
# 
#     @abc.abstractmethod
#     def create(self, command_type, inferior_repository, platform_factory,
#                inferior_factory, thread_factory, config, terminal):
#         raise NotImplementedError
# 
# Path: voidwalker/framework/interface/command.py
# class DataCommand(Command):
#     __metaclass__ = abc.ABCMeta
# 
#     @abc.abstractmethod
#     def execute(self, terminal, thread, argument):
#         raise NotImplementedError
# 
# Path: voidwalker/framework/interface/command.py
# class PrefixCommand(Command):
#     def execute(self, terminal):
#         terminal.write('%(face-error)sAttempting to invoke an '
#                        'incomplete command!\n')
# 
# Path: voidwalker/framework/interface/command.py
# class StackCommand(Command):
#     __metaclass__ = abc.ABCMeta
# 
#     @abc.abstractmethod
#     def execute(self, config, terminal, thread, platform_factory, argument):
#         raise NotImplementedError
# 
# Path: voidwalker/framework/interface/command.py
# class SupportCommand(Command):
#     __metaclass__ = abc.ABCMeta
# 
#     @abc.abstractmethod
#     def execute(self, terminal, argument):
#         raise NotImplementedError


import gdb
from functools import partial
from ...framework.interface import BreakpointCommand
from ...framework.interface import Command
from ...framework.interface import CommandFactory
from ...framework.interface import DataCommand
from ...framework.interface import PrefixCommand
from ...framework.interface import StackCommand
from ...framework.interface import SupportCommand
        inferior = inferior_factory.create_inferior(inferior_num)
        inferior_repository.add_inferior(inferior)

    return inferior_repository.get_inferior(inferior_num)


def get_current_thread(inferior_repository, inferior_factory,
                       thread_factory):
    if gdb.selected_thread() is not None:
        thread_num = gdb.selected_thread().num

        inferior = get_current_inferior(inferior_repository, inferior_factory)
        if not inferior.has_thread(thread_num):
            thread_factory.create_thread(inferior, thread_num)

        if inferior.has_thread(thread_num):
            return inferior.thread(thread_num)

    return None


def parse_argument_list(argument):
    args = []
    for obj in gdb.string_to_argv(argument):
        try:
            obj = gdb.parse_and_eval('%s' % obj)
        except gdb.error:
            pass

        args.append(obj)

# Path: voidwalker/framework/interface/command.py
# class BreakpointCommand(Command):
#     __metaclass__ = abc.ABCMeta
# 
#     @abc.abstractmethod
#     def execute(self, terminal, inferior, argument):
#         raise NotImplementedError
# 
# Path: voidwalker/framework/interface/command.py
# class Command(object):
#     pass
# 
# Path: voidwalker/framework/interface/command.py
# class CommandFactory(object):
#     __metaclass__ = abc.ABCMeta
# 
#     @abc.abstractmethod
#     def create(self, command_type, inferior_repository, platform_factory,
#                inferior_factory, thread_factory, config, terminal):
#         raise NotImplementedError
# 
# Path: voidwalker/framework/interface/command.py
# class DataCommand(Command):
#     __metaclass__ = abc.ABCMeta
# 
#     @abc.abstractmethod
#     def execute(self, terminal, thread, argument):
#         raise NotImplementedError
# 
# Path: voidwalker/framework/interface/command.py
# class PrefixCommand(Command):
#     def execute(self, terminal):
#         terminal.write('%(face-error)sAttempting to invoke an '
#                        'incomplete command!\n')
# 
# Path: voidwalker/framework/interface/command.py
# class StackCommand(Command):
#     __metaclass__ = abc.ABCMeta
# 
#     @abc.abstractmethod
#     def execute(self, config, terminal, thread, platform_factory, argument):
#         raise NotImplementedError
# 
# Path: voidwalker/framework/interface/command.py
# class SupportCommand(Command):
#     __metaclass__ = abc.ABCMeta
# 
#     @abc.abstractmethod
#     def execute(self, terminal, argument):
#         raise NotImplementedError


# Path: voidwalker/backends/gdb/command.py
import gdb
from functools import partial
from ...framework.interface import BreakpointCommand
from ...framework.interface import Command
from ...framework.interface import CommandFactory
from ...framework.interface import DataCommand
from ...framework.interface import PrefixCommand
from ...framework.interface import StackCommand
from ...framework.interface import SupportCommand

        inferior = inferior_factory.create_inferior(inferior_num)
        inferior_repository.add_inferior(inferior)

    return inferior_repository.get_inferior(inferior_num)


def get_current_thread(inferior_repository, inferior_factory,
                       thread_factory):
    if gdb.selected_thread() is not None:
        thread_num = gdb.selected_thread().num

        inferior = get_current_inferior(inferior_repository, inferior_factory)
        if not inferior.has_thread(thread_num):
            thread_factory.create_thread(inferior, thread_num)

        if inferior.has_thread(thread_num):
            return inferior.thread(thread_num)

    return None


def parse_argument_list(argument):
    args = []
    for obj in gdb.string_to_argv(argument):
        try:
            obj = gdb.parse_and_eval('%s' % obj)
        except gdb.error:
            pass

        args.append(obj)

    return args