# 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
# (void)walker GDB backend
# Copyright (C) 2012-2013 David Holm <dholmster@gmail.com>

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.





def get_current_inferior(inferior_repository, inferior_factory):
    inferior_num = gdb.selected_inferior().num
    if not inferior_repository.has_inferior(inferior_num):
        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,

# 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

# (void)walker GDB backend
# Copyright (C) 2012-2013 David Holm <dholmster@gmail.com>

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.





def get_current_inferior(inferior_repository, inferior_factory):
    inferior_num = gdb.selected_inferior().num
    if not inferior_repository.has_inferior(inferior_num):
        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):