public int InsertBreakpoint(Inferior inferior, BreakpointHandle handle, TargetAddress address, int domain) { Lock(); try { int index; bool is_enabled; BreakpointHandle old = LookupBreakpoint( address, out index, out is_enabled); if (old != null) { throw new TargetException( TargetError.AlreadyHaveBreakpoint, "Already have breakpoint {0} at address {1}.", old.Breakpoint.Index, address); } int dr_index = -1; switch (handle.Breakpoint.Type) { case EventType.Breakpoint: index = inferior.InsertBreakpoint(address); break; case EventType.WatchRead: index = inferior.InsertHardwareWatchPoint( address, Inferior.HardwareBreakpointType.READ, out dr_index); break; case EventType.WatchWrite: index = inferior.InsertHardwareWatchPoint( address, Inferior.HardwareBreakpointType.WRITE, out dr_index); break; default: throw new InternalError(); } index_hash.Add(index, new BreakpointEntry(handle, domain)); return(index); } finally { Unlock(); } }