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();
            }
        }
        public void RemoveBreakpoint(Inferior inferior, BreakpointHandle handle)
        {
            Lock();
            try {
                int[] indices = new int [index_hash.Count];
                index_hash.Keys.CopyTo(indices, 0);

                for (int i = 0; i < indices.Length; i++)
                {
                    BreakpointEntry entry = (BreakpointEntry)index_hash [indices [i]];
                    if (entry.Handle != handle)
                    {
                        continue;
                    }
                    inferior.RemoveBreakpoint(indices [i]);
                    index_hash.Remove(indices [i]);
                }
            } finally {
                Unlock();
            }
        }
Esempio n. 3
0
 internal override void RemoveBreakpoint(BreakpointHandle handle)
 {
     throw new InvalidOperationException();
 }
Esempio n. 4
0
 internal override void InsertBreakpoint(BreakpointHandle handle,
                                         TargetAddress address, int domain)
 {
     throw new InvalidOperationException();
 }
Esempio n. 5
0
 // <summary>
 //   Remove breakpoint @index.  @index is the breakpoint number which has
 //   been returned by InsertBreakpoint().
 // </summary>
 internal abstract void RemoveBreakpoint(BreakpointHandle handle);
Esempio n. 6
0
 // <summary>
 //   Insert a breakpoint at address @address.
 //
 //   Returns a number which may be passed to RemoveBreakpoint() to remove
 //   the breakpoint.
 // </summary>
 internal abstract void InsertBreakpoint(BreakpointHandle handle,
                                         TargetAddress address, int domain);
 public BreakpointEntry(BreakpointHandle handle, int domain)
 {
     this.Handle = handle;
     this.Domain = domain;
 }