# Path: debugger/debugee.py
# class Breakpoint(object):
#     """
#     Represents a breakpoint.
#     """
#     def __init__(self, number, location, line):
#         """
#         @type number: int
#         @type location: str
#         @type line: int
#         """
#         self.number = number
#         self.location = location
#         self.line = line
# 
#     def __repr__(self):
#         return "BP #{0}: {1}:{2}".format(self.number, self.location, self.line)


import os
import ptrace
from debugger.debugee import Breakpoint
#    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 Devi.  If not, see <http://www.gnu.org/licenses/>.
#





class BreakpointManager(object):
    BREAKPOINT_ID = 0

    def __init__(self, debugger):
        self.debugger = debugger
        self.breakpoints = []
        self.original_instructions = {}

    def add_breakpoint(self, file, line):
        file = os.path.abspath(file)

        assert self.debugger.program_info.has_location(file, line)

        for bp in self.breakpoints:  # assumes different (file, line) maps to
            # different addresses
            if bp.location == file and bp.line == line:
                return


# Path: debugger/debugee.py
# class Breakpoint(object):
#     """
#     Represents a breakpoint.
#     """
#     def __init__(self, number, location, line):
#         """
#         @type number: int
#         @type location: str
#         @type line: int
#         """
#         self.number = number
#         self.location = location
#         self.line = line
# 
#     def __repr__(self):
#         return "BP #{0}: {1}:{2}".format(self.number, self.location, self.line)


# Path: debugger/pycgdb/breakpoint_manager.py
import os
import ptrace
from debugger.debugee import Breakpoint

#    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 Devi.  If not, see <http://www.gnu.org/licenses/>.
#





class BreakpointManager(object):
    BREAKPOINT_ID = 0

    def __init__(self, debugger):
        self.debugger = debugger
        self.breakpoints = []
        self.original_instructions = {}

    def add_breakpoint(self, file, line):
        file = os.path.abspath(file)

        assert self.debugger.program_info.has_location(file, line)

        for bp in self.breakpoints:  # assumes different (file, line) maps to
            # different addresses
            if bp.location == file and bp.line == line:
                return


        self.breakpoints.append(Breakpoint(BreakpointManager.BREAKPOINT_ID,