public static Breakpoint GetBreakpointByBookmark(this IEnumerable<Breakpoint> breakpoints, BreakpointBookmark breakpointBookmark)
        {
            foreach (var point in breakpoints)
            {
                if (point is FunctionBreakpoint)
                {
                    var functionBreakpoint = point as FunctionBreakpoint;
                    var sequencePointByLine = functionBreakpoint.Function.Symbols.GetSequencePointByLine(breakpointBookmark.Location.Line);
                    if (sequencePointByLine!=null && functionBreakpoint.Offset == sequencePointByLine.Offset)
                    {
                        return functionBreakpoint;
                    }
                }
            }

            return null;
        }
        public bool TrySetBreakpoint(BreakpointBookmark breakpoint)
        {
            SymbolToken token;

            Session.ProgressReporter.Report("Trying to set breakpoint {0}:{1} in module {2}", breakpoint.Location.FilePath, breakpoint.Location.Line, Name);
            if (Symbols.TryGetFunctionByLocation(breakpoint.Location, out token))
            {
                Session.ProgressReporter.Report("Method token found.");
                var function = GetFunction((uint)token.GetToken());
                if (function == null)
                    return false;

                Session.ProgressReporter.Report("Method found. Finding IL offset");
                var sequencePoint = function.Symbols.GetSequencePointByLine(breakpoint.Location.Line);
                if (sequencePoint == null)
                    return false;
                
                Session.ProgressReporter.Report("Setting breakpoint at offset {0}", sequencePoint.Offset);
                function.IlCode.CreateBreakpoint(sequencePoint.Offset);
                return true;
            }
            return false;
        }
        public void RemoveBreakpoint(BreakpointBookmark breakpoint)
        {
            Breakpoint debuggerBreakpoint = Breakpoints.GetBreakpointByBookmark(breakpoint);

            if (debuggerBreakpoint != null)
            {
                debuggerBreakpoint.Enabled = false;
            }
        }
        public void AddBreakpoint(BreakpointBookmark breakpoint)
        {
            Breakpoint debuggerBreakpoint = Breakpoints.GetBreakpointByBookmark(breakpoint);

            if (debuggerBreakpoint == null)
            {
                var module = FindModule(x => x.Symbols != null);
                if (module == null)
                {
                    PendingBreakpoints.Add(breakpoint);
                }
                else
                {
                    module.TrySetBreakpoint(breakpoint);
                }
            }

            if (debuggerBreakpoint != null)
                debuggerBreakpoint.Enabled = true;
        }
 public CodeEditorBreakpoint(FastColoredTextBox textBox, BreakpointBookmark breakpoint, TextStyle style)
     : base(textBox, breakpoint, style)
 {
     ColorizeEntireLine = true;
 }