# Path: avatar2/targets/target.py
# class TargetStates(IntEnum):
#     """
#     A simple Enum for the different states a target can be in.
#     """
#     CREATED = 0x1
#     INITIALIZED = 0x2
#     STOPPED = 0x4
#     RUNNING = 0x8
#     SYNCING = 0x10
#     EXITED = 0x20
#     NOT_RUNNING = INITIALIZED | STOPPED
#     BREAKPOINT = SYNCING | STOPPED


import logging
import re
import socket
import binascii
import struct
import xml.etree.ElementTree as ET
from time import sleep
from struct import pack
from types import MethodType
from threading import Thread, Event
from socket import AF_INET, SOCK_STREAM, SOL_SOCKET, SO_REUSEADDR
from os.path import dirname
from avatar2.targets import TargetStates
        self.conn.send(raw_bytes)


    def check_breakpoint_hit(self):
        if self.target.state & TargetStates.STOPPED and self.running is True:
            if self.target.regs.pc in self.bps.values():
                self.running = False
                self.send_packet(b'S05')


    def receive_packet(self):
        pkt_finished = False
        pkt_receiving = False
        while pkt_finished is False:
            try:
                c = self.conn.recv(1)
            except socket.timeout:
                if self._do_shutdown.isSet():
                    self.send_packet(b'S03')
                    self.conn.close()
                    return

                if self.target.state & TargetStates.EXITED:
                    self.send_packet(b'S03')
                    self.conn.close()
                    return
                self.check_breakpoint_hit()
                continue

            if c == b'\x03':

# Path: avatar2/targets/target.py
# class TargetStates(IntEnum):
#     """
#     A simple Enum for the different states a target can be in.
#     """
#     CREATED = 0x1
#     INITIALIZED = 0x2
#     STOPPED = 0x4
#     RUNNING = 0x8
#     SYNCING = 0x10
#     EXITED = 0x20
#     NOT_RUNNING = INITIALIZED | STOPPED
#     BREAKPOINT = SYNCING | STOPPED


# Path: avatar2/plugins/gdbserver.py
import logging
import re
import socket
import binascii
import struct
import xml.etree.ElementTree as ET
from time import sleep
from struct import pack
from types import MethodType
from threading import Thread, Event
from socket import AF_INET, SOCK_STREAM, SOL_SOCKET, SO_REUSEADDR
from os.path import dirname
from avatar2.targets import TargetStates

        self.conn.send(raw_bytes)


    def check_breakpoint_hit(self):
        if self.target.state & TargetStates.STOPPED and self.running is True:
            if self.target.regs.pc in self.bps.values():
                self.running = False
                self.send_packet(b'S05')


    def receive_packet(self):
        pkt_finished = False
        pkt_receiving = False
        while pkt_finished is False:
            try:
                c = self.conn.recv(1)
            except socket.timeout:
                if self._do_shutdown.isSet():
                    self.send_packet(b'S03')
                    self.conn.close()
                    return

                if self.target.state & TargetStates.EXITED:
                    self.send_packet(b'S03')
                    self.conn.close()
                    return
                self.check_breakpoint_hit()
                continue

            if c == b'\x03':

                if not self.target.state & TargetStates.STOPPED: