# Path: avatar2/watchmen.py
# def watch(watched_type):
#     """
#     Decorator for the watchmen system
#     """
# 
#     def decorator(func):
#         @wraps(func)
#         def watchtrigger(self, *args, **kwargs):
#             # To avoid circular dependencies, we import here ...
#             from .avatar2 import Avatar
#             from .targets.target import Target
# 
#             cb_kwargs = dict(kwargs)
#             if isinstance(self, Avatar):
#                 avatar = self
#             elif isinstance(self, Target):
#                 avatar = self.avatar
#                 cb_kwargs['watched_target'] = self
# 
#             avatar.watchmen.t(watched_type, BEFORE, *args, **cb_kwargs)
#             ret = func(self, *args, **kwargs)
#             cb_kwargs.update({'watched_return': ret})
#             cb_ret = avatar.watchmen.t(watched_type, AFTER, *args, **cb_kwargs)
# 
#             return ret if cb_ret is None else cb_ret
# 
#         return watchtrigger
# 
#     return decorator


import logging
import time
from sys import version_info
from functools import wraps
from threading import Event
from types import MethodType
from enum import IntEnum
from ..watchmen import watch
                       condition=None, ignore_count=0, thread=0, **kwargs):
        """Inserts a breakpoint

        :param bool hardware: Hardware breakpoint
        :param bool tempory:  Tempory breakpoint
        :param str regex:     If set, inserts breakpoints matching the regex
        :param str condition: If set, inserts a breakpoint with the condition
        :param int ignore_count: Amount of times the bp should be ignored
        :param int thread:    Threadno in which this breakpoints should be added
        """
        return self.protocols.execution.set_breakpoint(line, hardware=hardware,
                                                  temporary=temporary,
                                                  regex=regex,
                                                  condition=condition,
                                                  ignore_count=ignore_count,
                                                  thread=thread, **kwargs)

    @watch('TargetSetWatchPoint')
    @action_valid_decorator_factory(TargetStates.NOT_RUNNING, 'execution')
    def set_watchpoint(self, variable, write=True, read=False):
        """Inserts a watchpoint

        :param      variable: The name of a variable or an address to watch
        :param bool write:    Write watchpoint
        :param bool read:     Read watchpoint
        """
        return self.protocols.execution.set_watchpoint(variable,
                                                  write=write,
                                                  read=read)


# Path: avatar2/watchmen.py
# def watch(watched_type):
#     """
#     Decorator for the watchmen system
#     """
# 
#     def decorator(func):
#         @wraps(func)
#         def watchtrigger(self, *args, **kwargs):
#             # To avoid circular dependencies, we import here ...
#             from .avatar2 import Avatar
#             from .targets.target import Target
# 
#             cb_kwargs = dict(kwargs)
#             if isinstance(self, Avatar):
#                 avatar = self
#             elif isinstance(self, Target):
#                 avatar = self.avatar
#                 cb_kwargs['watched_target'] = self
# 
#             avatar.watchmen.t(watched_type, BEFORE, *args, **cb_kwargs)
#             ret = func(self, *args, **kwargs)
#             cb_kwargs.update({'watched_return': ret})
#             cb_ret = avatar.watchmen.t(watched_type, AFTER, *args, **cb_kwargs)
# 
#             return ret if cb_ret is None else cb_ret
# 
#         return watchtrigger
# 
#     return decorator


# Path: avatar2/targets/target.py
import logging
import time
from sys import version_info
from functools import wraps
from threading import Event
from types import MethodType
from enum import IntEnum
from ..watchmen import watch

                       condition=None, ignore_count=0, thread=0, **kwargs):
        """Inserts a breakpoint

        :param bool hardware: Hardware breakpoint
        :param bool tempory:  Tempory breakpoint
        :param str regex:     If set, inserts breakpoints matching the regex
        :param str condition: If set, inserts a breakpoint with the condition
        :param int ignore_count: Amount of times the bp should be ignored
        :param int thread:    Threadno in which this breakpoints should be added
        """
        return self.protocols.execution.set_breakpoint(line, hardware=hardware,
                                                  temporary=temporary,
                                                  regex=regex,
                                                  condition=condition,
                                                  ignore_count=ignore_count,
                                                  thread=thread, **kwargs)

    @watch('TargetSetWatchPoint')
    @action_valid_decorator_factory(TargetStates.NOT_RUNNING, 'execution')
    def set_watchpoint(self, variable, write=True, read=False):
        """Inserts a watchpoint

        :param      variable: The name of a variable or an address to watch
        :param bool write:    Write watchpoint
        :param bool read:     Read watchpoint
        """
        return self.protocols.execution.set_watchpoint(variable,
                                                  write=write,
                                                  read=read)


    @watch('TargetRemovebreakpoint')