1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
5
using System.Collections.Generic;
6
using Debugger.Interop.CorDebug;
10
public class BreakpointCollection: CollectionWithEvents<Breakpoint>
12
public event EventHandler<CollectionItemEventArgs<Breakpoint>> Hit;
14
protected internal void OnHit(Breakpoint item)
17
Hit(this, new CollectionItemEventArgs<Breakpoint>(item));
21
public BreakpointCollection(NDebugger debugger):base(debugger) { }
23
internal Breakpoint this[ICorDebugBreakpoint corBreakpoint] {
25
foreach (Breakpoint breakpoint in this) {
26
if (breakpoint.IsOwnerOf(corBreakpoint)) {
34
public new void Add(Breakpoint breakpoint)
39
public Breakpoint Add(string filename, int line)
41
Breakpoint breakpoint = new Breakpoint(this.Debugger, filename, null, line, 0, true);
46
public Breakpoint Add(string fileName, byte[] checkSum, int line, int column, bool enabled)
48
Breakpoint breakpoint = new Breakpoint(this.Debugger, fileName, checkSum, line, column, enabled);
53
protected override void OnAdded(Breakpoint breakpoint)
55
foreach(Process process in this.Debugger.Processes) {
56
foreach(Module module in process.Modules) {
57
breakpoint.SetBreakpoint(module);
61
base.OnAdded(breakpoint);
64
public new void Remove(Breakpoint breakpoint)
66
base.Remove(breakpoint);
69
protected override void OnRemoved(Breakpoint breakpoint)
71
breakpoint.Deactivate();
73
base.OnRemoved(breakpoint);
76
internal void SetInModule(Module module)
78
// This is in case that the client modifies the collection as a response to set breakpoint
79
// NB: If client adds new breakpoint, it will be set directly as a result of his call, not here (because module is already loaded)
80
List<Breakpoint> collection = new List<Breakpoint>();
81
collection.AddRange(this);
83
foreach (Breakpoint b in collection) {
84
b.SetBreakpoint(module);